1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds/*
31da177e4SLinus Torvalds  initramfs_data includes the compressed binary that is the
41da177e4SLinus Torvalds  filesystem used for early user space.
51da177e4SLinus Torvalds  Note: Older versions of "as" (prior to binutils
61da177e4SLinus Torvalds  released on 2001-07-14) dit not support .incbin.
71da177e4SLinus Torvalds  If you are forced to use older binutils than that then the
81da177e4SLinus Torvalds  following trick can be applied to create the resulting binary:
91da177e4SLinus Torvalds
101da177e4SLinus Torvalds
111da177e4SLinus Torvalds  ld -m elf_i386  --format binary --oformat elf32-i386 -r \
121da177e4SLinus Torvalds  -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
13f49821eeSNicholas Piggin   ld -m elf_i386  -r -o built-in.a initramfs_data.o
141da177e4SLinus Torvalds
15ffe8018cSHendrik Brueckner  For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.
161da177e4SLinus Torvalds
171da177e4SLinus Torvalds  The above example is for i386 - the parameters vary from architectures.
181da177e4SLinus Torvalds  Eventually look up LDFLAGS_BLOB in an older version of the
191da177e4SLinus Torvalds  arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
201da177e4SLinus Torvalds
211da177e4SLinus Torvalds  Using .incbin has the advantage over ld that the correct flags are set
221da177e4SLinus Torvalds  in the ELF header, as required by certain architectures.
231da177e4SLinus Torvalds*/
241da177e4SLinus Torvalds
256ae64e42SHendrik Brueckner.section .init.ramfs,"a"
26ffe8018cSHendrik Brueckner__irf_start:
2765e00e04SMasahiro Yamada.incbin "usr/initramfs_inc_data"
28ffe8018cSHendrik Brueckner__irf_end:
29ffe8018cSHendrik Brueckner.section .init.ramfs.info,"a"
30c4df32c8SMasahiro Yamada.globl __initramfs_size
31c4df32c8SMasahiro Yamada__initramfs_size:
3296f93593SGeert Uytterhoeven#ifdef CONFIG_64BIT
33ffe8018cSHendrik Brueckner	.quad __irf_end - __irf_start
3496f93593SGeert Uytterhoeven#else
3596f93593SGeert Uytterhoeven	.long __irf_end - __irf_start
36ffe8018cSHendrik Brueckner#endif