49 lines · plain
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 initramfs_data includes the compressed binary that is the4 filesystem used for early user space.5 Note: Older versions of "as" (prior to binutils 2.11.90.0.236 released on 2001-07-14) dit not support .incbin.7 If you are forced to use older binutils than that then the8 following trick can be applied to create the resulting binary:9 10 11 ld -m elf_i386 --format binary --oformat elf32-i386 -r \12 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o13 ld -m elf_i386 -r -o built-in.a initramfs_data.o14 15 For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.16 17 The above example is for i386 - the parameters vary from architectures.18 Eventually look up LDFLAGS_BLOB in an older version of the19 arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.20 21 Using .incbin has the advantage over ld that the correct flags are set22 in the ELF header, as required by certain architectures.23 24 wasm32 amendment (K6-A1, patches/0007):25 * Section flags switched from `,"a"` to `,"",@` so the LLVM wasm26 assembler accepts them.27 * `.incbin` removed because the wasm assembler does not support it.28 For wasm32 builds the upstream-embedded cpio at `.init.ramfs`29 is left empty; HardwareJS supplies the actual initramfs at30 boot via wasm_boot_info v2 (`initrd_offset/size`), which31 setup_arch() converts into `initrd_start/end` for the bootloader32 branch of `init/initramfs.c::do_populate_rootfs()`.33 * Explicit `.size` directives added (the wasm-clang assembler34 requires every data symbol to declare its size).35*/36 37.section .init.ramfs,"",@38.globl __irf_start39.globl __irf_end40__irf_start:41__irf_end:42.size __irf_start, 043.size __irf_end, 044.section .init.ramfs.info,"",@45.globl __initramfs_size46__initramfs_size:47 .long __irf_end - __irf_start48.size __initramfs_size, 449