Initramfs: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (improve formatting and grammar a little) |
||
Line 1: | Line 1: | ||
How to inject a | How to inject a gzipped initramfs cpio file into vmlinux as section .init.ramfs: | ||
1. Turn the initramfs into an ELF binary, excluding everything 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} above depend on the input filename. objcopy does some translation so e.g. a period (.) in the filename becomes an underscore (_) in the symbol names. | |||
Note that the symbol names _binary_initramfs_{start,end,size} above depend on the input filename. objcopy does some translation | |||
2. Remove any previous .init.ramfs section in vmlinux and add the new one from initramfs.elf: | |||
objcopy -I elf32-i386 -O elf32-i386 -R .init.ramfs --add-section .init.ramfs=initramfs.elf vmlinux vmlinux.withnewinitramfs | objcopy -I elf32-i386 -O elf32-i386 -R .init.ramfs --add-section .init.ramfs=initramfs.elf vmlinux vmlinux.withnewinitramfs | ||
3. Done! Please test using vmlinux.withnewinitramfs as payload with coreboot and let us know the result! |
Revision as of 19:25, 9 October 2008
How to inject a gzipped initramfs cpio file into vmlinux as section .init.ramfs:
1. Turn the initramfs into an ELF binary, excluding everything 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} above depend on the input filename. objcopy does some translation so e.g. a period (.) in the filename becomes an underscore (_) in the symbol names.
2. Remove any previous .init.ramfs section in vmlinux and add the new one from initramfs.elf:
objcopy -I elf32-i386 -O elf32-i386 -R .init.ramfs --add-section .init.ramfs=initramfs.elf vmlinux vmlinux.withnewinitramfs
3. Done! Please test using vmlinux.withnewinitramfs as payload with coreboot and let us know the result!