162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci  initramfs_data includes the compressed binary that is the
462306a36Sopenharmony_ci  filesystem used for early user space.
562306a36Sopenharmony_ci  Note: Older versions of "as" (prior to binutils 2.11.90.0.23
662306a36Sopenharmony_ci  released on 2001-07-14) dit not support .incbin.
762306a36Sopenharmony_ci  If you are forced to use older binutils than that then the
862306a36Sopenharmony_ci  following trick can be applied to create the resulting binary:
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci  ld -m elf_i386  --format binary --oformat elf32-i386 -r \
1262306a36Sopenharmony_ci  -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
1362306a36Sopenharmony_ci   ld -m elf_i386  -r -o built-in.a initramfs_data.o
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci  For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci  The above example is for i386 - the parameters vary from architectures.
1862306a36Sopenharmony_ci  Eventually look up LDFLAGS_BLOB in an older version of the
1962306a36Sopenharmony_ci  arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci  Using .incbin has the advantage over ld that the correct flags are set
2262306a36Sopenharmony_ci  in the ELF header, as required by certain architectures.
2362306a36Sopenharmony_ci*/
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci.section .init.ramfs,"a"
2662306a36Sopenharmony_ci__irf_start:
2762306a36Sopenharmony_ci.incbin "usr/initramfs_inc_data"
2862306a36Sopenharmony_ci__irf_end:
2962306a36Sopenharmony_ci.section .init.ramfs.info,"a"
3062306a36Sopenharmony_ci.globl __initramfs_size
3162306a36Sopenharmony_ci__initramfs_size:
3262306a36Sopenharmony_ci#ifdef CONFIG_64BIT
3362306a36Sopenharmony_ci	.quad __irf_end - __irf_start
3462306a36Sopenharmony_ci#else
3562306a36Sopenharmony_ci	.long __irf_end - __irf_start
3662306a36Sopenharmony_ci#endif
37