Initramfs

From coreboot
Revision as of 22:40, 6 August 2008 by Stuge (talk | contribs) (How to inject an initramfs into a vmlinux.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!

How to inject a separate initramfs file into a 2.6 vmlinux: (as section .init.ramfs)

First turn the initramfs into an ELF, excluding anything but the file data:

   objcopy -I binary -O elf32-i386 -B i386 --redefine-sym _binary_initramfs_start=.init.ramfs -N _binary_initramfs_end -N _binary_initramfs_size initramfs initramfs.elf

Note that the symbol names _binary_initramfs_{start,end,size} depend on the input filename. objcopy does some translation here, e.g. a period (.) in the filename will become an underscore (_) in the symbols.

Now add the .init.ramfs section from initramfs.elf into the vmlinux file:

   objcopy -I elf32-i386 -O elf32-i386 --add-section .init.ramfs=initramfs.elf vmlinux vmlinux.withnewinitramfs

All done.