Skip to contentSkip to conversation

ARM: add support for uncompressed uImage kernel

PATCH New Alexander Stein 5 participants 10 messages Nov 9, 2010 – Nov 18, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

---
 arch/arm/boot/Makefile |   10 ++++++++--
 init/Kconfig           |    7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
arch/arm/boot/Makefile +8 -2
index 4a590f4..37618b8 100644
@@ -77,11 +77,17 @@ else
 $(obj)/uImage: STARTADDR=$(LOADADDR)
 endif
 
-$(obj)/uImage:	$(obj)/zImage FORCE
+ifeq ($(CONFIG_KERNEL_NONE),y)
+ARM_IMAGE := Image
+else
+ARM_IMAGE := zImage
+endif
+
+$(obj)/uImage:	$(obj)/$(ARM_IMAGE) FORCE
 	$(call if_changed,uimage)
 	@echo '  Image $@ is ready'
 
-$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
+$(obj)/bootp/bootp: $(obj)/$(ARM_IMAGE) initrd FORCE
 	$(Q)$(MAKE) $(build)=$(obj)/bootp $@
 	@:
 
init/Kconfig +7 -0
index 88c1046..355d7a5 100644
@@ -155,6 +155,13 @@ choice
 
 	  If in doubt, select 'gzip'
 
+config KERNEL_NONE
+	bool "None"
+	depends on ARM
+	help
+	  If you want to use get a fast startup at the cost of kernel size
+	  you can use an uncompressed kernel.
+
 config KERNEL_GZIP
 	bool "Gzip"
 	depends on HAVE_KERNEL_GZIP
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

Is it really faster to copy an uncompressed image than it is to decompress using LZMA with caches on?

Remember that in terms of fast boot, uboot sucks - it's way over the top of what you need. Eg, it always copies the image to RAM before executing it. That gives two problems:

1. the image has to be copied, which takes time
2. the image then decompresses itself, but because its more often than not living at the address which the decompressed image has to reside, it then has to copy the decompressed image afterwards.

(2) is solved by loading the kernel compressed image elsewhere in memory.
(1) is solved by having a boot loader which can call the image where-ever it resides (eg, in flash) and using the ZBOOT_ROM options.

I suspect that if you do both 1 and 2, you'll be faster than having uboot copy an uncompressed image into system memory.

Quoted 56 lines · Alexander Stein
---
 arch/arm/boot/Makefile |   10 ++++++++--
 init/Kconfig           |    7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
arch/arm/boot/Makefile +8 -2
index 4a590f4..37618b8 100644
@@ -77,11 +77,17 @@ else
 $(obj)/uImage: STARTADDR=$(LOADADDR)
 endif
 
-$(obj)/uImage:	$(obj)/zImage FORCE
+ifeq ($(CONFIG_KERNEL_NONE),y)
+ARM_IMAGE := Image
+else
+ARM_IMAGE := zImage
+endif
+
+$(obj)/uImage:	$(obj)/$(ARM_IMAGE) FORCE
 	$(call if_changed,uimage)
 	@echo '  Image $@ is ready'
 
-$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
+$(obj)/bootp/bootp: $(obj)/$(ARM_IMAGE) initrd FORCE
 	$(Q)$(MAKE) $(build)=$(obj)/bootp $@
 	@:
 
init/Kconfig +7 -0
index 88c1046..355d7a5 100644
@@ -155,6 +155,13 @@ choice
 
 	  If in doubt, select 'gzip'
 
+config KERNEL_NONE
+	bool "None"
+	depends on ARM
+	help
+	  If you want to use get a fast startup at the cost of kernel size
+	  you can use an uncompressed kernel.
+
 config KERNEL_GZIP
 	bool "Gzip"
 	depends on HAVE_KERNEL_GZIP
Signature · 7 lines
1.7.2.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

Quoted 6 lines · Russell King - ARM Linux

Is it really faster to copy an uncompressed image than it is to decompress using LZMA with caches on?

Remember that in terms of fast boot, uboot sucks - it's way over the top of what you need. Eg, it always copies the image to RAM before executing it. That gives two problems:

Last time I checked (which is a few years ago) U-Boot was well able to start a ZBOOT_ROM image. I'd be surprised if U-Boot lost that ability.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

In reply to Russell King - ARM Linux
Quoted 3 lines · Russell King - ARM Linux

Is it really faster to copy an uncompressed image than it is to decompress using LZMA with caches on?

At least on an i.MX35 I can read a bigger image from NAND faster than I can read + uncompress a smaller image. ZBOOT_ROM is no option for NAND. Reading from NAND is done with mmu/dcache on in this case.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#4 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

In reply to Russell King - ARM Linux
Quoted 2 lines · Russell King - ARM Linux

Is it really faster to copy an uncompressed image than it is to decompress using LZMA with caches on?

In my experience, using LZMA is painfully slow on older ARM CPUs.

If you really need to boot quickly you might want to try LZO, which should give you results close to the uncompressed performance. It might still be slower though, especially if you're able to load your kernel image to memory fairly quickly

Regards,

Signature · 1 line
Albin Tonnerre
#5 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

Soory for late answer,

Quoted 10 lines · On Saturday 13 November 2010, 11:47:41 Albin Tonnerre wrote:
Quoted 2 lines · <[email protected]> wrote:

Is it really faster to copy an uncompressed image than it is to decompress using LZMA with caches on?

In my experience, using LZMA is painfully slow on older ARM CPUs.

If you really need to boot quickly you might want to try LZO, which should give you results close to the uncompressed performance. It might still be slower though, especially if you're able to load your kernel image to memory fairly quickly

We only have experience with GZIP. Our compressed kernel is ~1,8MB and uncompressed ~4MB.
On an AT91 ARM9 SoC the decompression takes about 1-2s of time. Caches should be disabled, as far as I could see in decompression code.
Copying the uncompressed kernel from NOR to SD-RAM takes about 140ms. So if you can afford the additional storage need, simply copying the uncompressed kernel is much faster than copying the compressed kernel which decompresses itself.

Best regards,
Alexander

#6 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

Quoted 14 lines · Alexander Stein

Soory for late answer,

Quoted 10 lines · On Saturday 13 November 2010, 11:47:41 Albin Tonnerre wrote:
Quoted 2 lines · <[email protected]> wrote:

Is it really faster to copy an uncompressed image than it is to decompress using LZMA with caches on?

In my experience, using LZMA is painfully slow on older ARM CPUs.

If you really need to boot quickly you might want to try LZO, which should give you results close to the uncompressed performance. It might still be slower though, especially if you're able to load your kernel image to memory fairly quickly

Quoted 4 lines

We only have experience with GZIP. Our compressed kernel is ~1,8MB and uncompressed ~4MB.
On an AT91 ARM9 SoC the decompression takes about 1-2s of time. Caches should be disabled, as far as I could see in decompression code.

Caches are enabled in line 248 of
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=arch/arm/boot/compressed/head.S;h=6825c34646d4e02f24b0eefe7ab4e012bca05208;hb=HEAD

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#7 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

In reply to Alexander Stein
Quoted 4 lines · Alexander Stein

We only have experience with GZIP. Our compressed kernel is ~1,8MB and uncompressed ~4MB.
On an AT91 ARM9 SoC the decompression takes about 1-2s of time. Caches should be disabled, as far as I could see in decompression code.

Are you sure? ARM9 is supposed to be ARMv4T, which is covered by this entry in the proc_types table:

                .word   0x00020000              @ ARMv4T
                .word   0x000f0000
                W(b)    __armv4_mmu_cache_on
                W(b)    __armv4_mmu_cache_off
                W(b)    __armv4_mmu_cache_flush

So caches _should_ be enabled.

#8 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

Hello,

Quoted 9 lines · On Thursday 18 November 2010, 10:10:46 Russell King - ARM Linux wrote:
Quoted 4 lines · Alexander Stein

We only have experience with GZIP. Our compressed kernel is ~1,8MB and uncompressed ~4MB.
On an AT91 ARM9 SoC the decompression takes about 1-2s of time. Caches should be disabled, as far as I could see in decompression code.

Are you sure? ARM9 is supposed to be ARMv4T, which is covered by this entry in the proc_types table:

Quoted 7 lines
                .word   0x00020000              @ ARMv4T
                .word   0x000f0000
                W(b)    __armv4_mmu_cache_on
                W(b)    __armv4_mmu_cache_off
                W(b)    __armv4_mmu_cache_flush

So caches _should_ be enabled.

I'm _not_ sure. That was a long time ago and I only did a short look into the decompression/setup code.
After I noticed using the uncompressed kernel is much faster, I didn't investigate further.

Best regards,
Alexander

#9 lore raw

PATCH 1/1 ARM: add support for uncompressed uImage kernel

In reply to Alexander Stein
Quoted 1 line · Alexander Stein

Quite some time ago I suggested something similar. I'm sure you can find the mail in the archives. The result of my patch was the introduction of a few more Make-targets:

	uImage -> uimage(Image)
	uzImage -> uimage(zImage) (== today's uImage)
	uImagegz -> uimage(gzip(Image))

Russell objected that though.
Today I don't use the kernel Makefile anymore to build uImages, but let ptxdist do that for me.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |