Skip to contentSkip to conversation

PATCH: Use .incbin to incorporate binary files.

PATCH H. J. Lu 1 participant 1 message Jun 11, 2003 Kbuild

lore
Share & tools
lore

H. J. Lu

author
#0 lore raw

The Linux binutils 2.11.90.0.23 released on 2001-07-14 introduced a new feature, .incbin, which allows you to include a set of binary data at a given point in the assembly. It is better than

# ld -r --format binary --oformat ...

since it will set appropriate bits in the ELF header. Here is a patch against 2.5.70 to use .incbin.

H.J.

usr/Makefile renamed from usr/Makefile.binary +3 -5
@@ -5,11 +5,9 @@ host-progs  := gen_init_cpio
 
 clean-files := initramfs_data.cpio.gz
 
-LDFLAGS_initramfs_data.o := $(LDFLAGS_BLOB) -r -T
-
-$(obj)/initramfs_data.o: $(src)/initramfs_data.scr \
-			 $(obj)/initramfs_data.cpio.gz FORCE
-	$(call if_changed,ld)
+$(src)/initramfs_data.S: $(obj)/initramfs_data.cpio.gz
+	echo "	.section .init.ramfs,\"a\"" > $(src)/initramfs_data.S
+	echo ".incbin \"usr/initramfs_data.cpio.gz\"" >> $(src)/initramfs_data.S
 
 # initramfs-y are the programs which will be copied into the CPIO
 # archive. Currently, the filenames are hardcoded in gen_init_cpio,
usr/initramfs_data.scr renamed from usr/initramfs_data.scr.binary +0 -4
@@ -1,4 +0,0 @@
-SECTIONS
-{
-	.init.ramfs : { *(.data) }
-}