From: Stuart M. <Stu...@st...> - 2001-11-21 18:34:38
|
Cord Its pretty simple. Assuming you have a ramdisk image, you simply need to load it into memory, and tell the kernel where it is: - loading will depend on what tools you are using to download your kernel. If you have a loader which supports the downloading of binary files, that it simple. If you are using a tool like gdb, which only supports the downloading of elf files, or a loader which can only use S-records or similar, ld or objcopy can be used to convert to the appropriate format. The image needs to be loaded into memory which the kernel knows about, so don't try and load the image into what, for the kernel's point of view, is unused memory. - telling the kernel where the image is simply involves modifying a few workds of memory near the start of the kernel image. These corrispond to the C symbol empty_zero_page, which is 4K from the start of kernel memory: empty_zero_page + 0x00: mount root read only + 0x04: ramdisk flags + 0x08: root device + 0x0c: loader type + 0x10: initrd start + 0x14: initrd size + 0x100: kernel command line The only words you should need to modify are: + 0x0c: loader type - set to 1 + 0x10: initrd start - set to the offset of the image from the start of kernel memory (CONFIG_MEMORY_START) + 0x14: initrd size - size of the initrd image Again, how you do this depends of what tools you are using. You might want to have a look at the gdb start up scripts which are part of the CVS kernel sources, in the root of the kernel sources - .gdbinit-dmida is a well commented example. Hope this helps Stuart On Nov 21, 6:01pm, cs...@em... wrote: > Subject: [linuxsh-dev] How to use an initrd? > Hi everyone, > > I'm new to Linux on SH and try to get a custom board running. I am using the > 2.4.13 kernel from the LinuxSH CVS and can load it up to my board. I managed > to hack the serial console to come out on the HD64465 UART (the only serial > line connected on my board). The kernel boots and find some minimal hardware. > Since I don't have network yet, I want to load an initrd/ramdisk with the > kernel image. Can anyone provide me with some hints on how to do this for the > SH environment? > > Thanks for any help. > > Cord > > _______________________________________________ > linuxsh-dev mailing list > lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxsh-dev > > >-- End of excerpt from cs...@em... |