Skip to contentSkip to conversation

x86 Boot enhancements, native elf binary 9/9

PATCH New Eric W. Biederman 1 participant 1 message Apr 3, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86 Boot enhancements, native elf binary 9/9

Linus, please apply.

No actual changes are made to the generated code. Instead build.c is enhanced to add an ELF header to a zImage or a bzImage converting it into a static ELF binary.

For people concerned about having two file formats and increase the maintenance burden, an ELF formated kernel can be stripped of it's ELF header and converted into a bzImage with a simple dd command.

For boot-loaders like etherboot that look beyond the Linux kernel and strive for a general solution the ELF file format is very appropriate. The ELF file format for static executables is simple to parse, it is specified for most architectures, and despite being used everywhere it has not forked. The fact it the standard file format for user mode executables and there many tools that understand it, is just a bonus.

The ELF file format describes multiple segments of files being loaded into multiple segments of memory, and has the concept of a bss section so that data that memory that is used but is not initialized from file contents can be described.

Eric

arch/i386/Makefile +6 -0
diff -uNr linux-2.5.7.boot3.linuxbios/arch/i386/Makefile linux-2.5.7.boot3.elf/arch/i386/Makefile
@@ -119,6 +119,12 @@
 bzImage: vmlinux
 	@$(MAKEBOOT) bzImage
 
+zElf: vmlinux
+	@$(MAKEBOOT) zElf
+
+bzElf: vmlinux
+	@$(MAKEBOOT) bzElf
+
 compressed: zImage
 
 zlilo: vmlinux
arch/i386/boot/Makefile +7 -0
diff -uNr linux-2.5.7.boot3.linuxbios/arch/i386/boot/Makefile linux-2.5.7.boot3.elf/arch/i386/boot/Makefile
@@ -18,6 +18,13 @@
 bzImage: $(CONFIGURE) tools/build $(TOPDIR)/vmlinux brealmode compressed/bvmlinux 
 	tools/build -b $(TOPDIR)/vmlinux brealmode compressed/bvmlinux bzImage
 
+
+zElf: $(CONFIGURE) tools/build $(TOPDIR)/vmlinux realmode compressed/vmlinux 
+	tools/build -e $(TOPDIR)/vmlinux realmode compressed/vmlinux zElf
+
+bzElf: $(CONFIGURE) tools/build $(TOPDIR)/vmlinux brealmode compressed/bvmlinux 
+	tools/build -e -b $(TOPDIR)/vmlinux brealmode compressed/bvmlinux bzElf
+
 compressed/vmlinux: $(TOPDIR)/vmlinux
 	@$(MAKE) -C compressed vmlinux
 

Binary files linux-2.5.7.boot3.linuxbios/arch/i386/boot/bzElf and linux-2.5.7.boot3.elf/arch/i386/boot/bzElf differ

arch/i386/boot/tools/build.c +218 -7

267 lines not on this page · raw message