Skip to contentSkip to conversation

Compressed kernel image

PATCH Johannes Stezenbach 1 participant 1 message Sep 16, 2002 MIPS

lore
Share & tools
lore
#0 lore raw

Hi,

for the embedded Linux project I'm working on I needed the ability to boot a compressed kernel image from ROM, i.e. uncompress it to RAM and jump to the kernel entry.

So I took some parts from arch/i386/boot/compressed, and some from linux-mips.sf.net/arch/mips/zboot/ and hacked up something which works for me.

The appended patch is incomplete as I removed anything specific to my platform. To use it for a different platform you would need:

- A head.S which works for your board. Depending on what your bootloader does, you probably don't need the cache flushing stuff.
- For debug output, you need a putc() implementation; maybe the included uart16550.c works for you. If you think you don't need to debug anything ;-), you could use a dummy putc().
- Set some configuration variables in the Makefile. I tested both booting from ROM and loading the zImage to RAM, then uncompressing to some different area in RAM.
Note: For my platform I allocate a 2MB frame buffer at 0x80002000 in unified memory, so reuse this space for uncompressing the zImage.

I hope the patch is of use to someone. Comments are welcome.

Regards,
Johannes

arch/mips/Makefile +6 -0
diff -urN linux-oss.orig/arch/mips/Makefile linux-oss/arch/mips/Makefile
@@ -475,6 +475,11 @@
 endif
 
 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
+MAKEZBOOT = $(MAKE) -C arch/$(ARCH)/boot/compressed
+
+BOOT_TARGETS = zImage
+$(BOOT_TARGETS):  vmlinux
+	@$(MAKEZBOOT) $@
 
 vmlinux.ecoff: vmlinux
 	@$(MAKEBOOT) $@
@@ -484,6 +489,7 @@
 	rm -f arch/$(ARCH)/ld.script
 	$(MAKE) -C arch/$(ARCH)/tools clean
 	$(MAKE) -C arch/mips/baget clean
+	$(MAKE) -C arch/$(ARCH)/boot/compressed clean
 
 archmrproper:
 	@$(MAKEBOOT) mrproper
arch/mips/boot/compressed/Makefile +74 -0

74 lines not on this page · raw message

arch/mips/boot/compressed/head.S +100 -0

100 lines not on this page · raw message

arch/mips/boot/compressed/misc.c +311 -0

311 lines not on this page · raw message

arch/mips/boot/compressed/uart16550.c +141 -0

141 lines not on this page · raw message