Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Thu, Aug 06, 2009 at 11:40:55PM +0100, Russell King - ARM Linux wrote : On Mon, Aug 03, 2009 at 04:58:19PM +0200, Albin Tonnerre wrote: This is the second part of patch. This part includes: - changes to ach/arch/boot/Makefile to make it easier to add new compression types - new piggy.lzo.S necessary for lzo compression - changes in arch/arm/boot/compressed/misc.c to allow the use of lzo or gzip, depending on the config - Kconfig support FYI, with these patches applied and selecting GZIP method, I get linker errors. I've been unable to track down what's going on, but it appears to be a libgcc issue. In spite of the decompressor being built as an EABI object, gcc seems to be issuing calls to __umodsi3, which isn't in the EABI libgcc (they're called something different - don't ask.) Looks like this one is on its way to getting solved. So I think these patches need further testing and evaluation on ARM before they can be merged. Moreover, I'd like to see some comparisons between the _current_ gzip method, the new gzip method and the lzo method on ARM. The figures I posted with my patch were from an ARM (AT91SAM9263) 180MHz CPU. For the record (average on 25 boots with each compression method): Uncompressed size: 3.24Mo gzip 1.61Mo 0.72s lzo 1.75Mo 0.48s Some tests with the current gzip code give about 1.64s decompression time. Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On 08/13/2009 02:30 AM, Albin Tonnerre wrote: On Tue, Aug 11, 2009 at 09:31:25AM -0700, H. Peter Anvin wrote : On 08/11/2009 09:27 AM, Albin Tonnerre wrote: So I guess the only options left are either define a dummy raise() function, or get rid of the divisions like Alain Knaff did in his patch ? Define a dummy raise, get rid of the divisions, or provide your own division function (there is probably one in the kernel already...) Yes, there's such a function in arch/arm/lib/lib1funcs.S, which in turns requires the __div0 symbol, defined in arch/arm/kernel/traps.c, and this one cannot be used as it brings plenty of symbols that aren't available in the pre-boot environment. So anyway, we have to define our own symbols there. Either we use libgcc and define raise(), or lib1funcs and define __div0(). I would go with the variant in the kernel, as being a known quantity. Your __div0 function can just loop forever. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf. -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
Hi Sam, On Fri, Aug 07, 2009 at 11:08:16PM +0200, Sam Ravnborg wrote : We could add libgcc as a prerequisite. Untested patch below. When compiling with this patch applied, I get the following error: Kernel: arch/arm/boot/Image is ready LD arch/arm/boot/compressed/vmlinux /home/albin/x-tools/arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.2/libgcc.a(_dvmd_lnx.o): In function `__div0': /home/albin/devel/free-electrons/toolchain/targets/src/gcc-4.3.2/libgcc/../gcc/config/arm/lib1funcs.asm:1079: undefined reference to `raise' make[2]: *** [arch/arm/boot/compressed/vmlinux] Error 1 make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2 I've got no idea where this symbol is defined, though. Has anyone an idea on this ? Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Tue, Aug 11, 2009 at 09:03:14AM -0700, H. Peter Anvin wrote : On 08/11/2009 02:44 AM, Albin Tonnerre wrote: Hi Sam, On Fri, Aug 07, 2009 at 11:08:16PM +0200, Sam Ravnborg wrote : We could add libgcc as a prerequisite. Untested patch below. When compiling with this patch applied, I get the following error: Kernel: arch/arm/boot/Image is ready LD arch/arm/boot/compressed/vmlinux /home/albin/x-tools/arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.2/libgcc.a(_dvmd_lnx.o): In function `__div0': /home/albin/devel/free-electrons/toolchain/targets/src/gcc-4.3.2/libgcc/../gcc/config/arm/lib1funcs.asm:1079: undefined reference to `raise' make[2]: *** [arch/arm/boot/compressed/vmlinux] Error 1 make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2 I've got no idea where this symbol is defined, though. Has anyone an idea on this ? raise() gets called by libgcc to handle division by zero. So I guess the only options left are either define a dummy raise() function, or get rid of the divisions like Alain Knaff did in his patch ? Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Thu, Aug 06, 2009 at 11:40:55PM +0100, Russell King - ARM Linux wrote : On Mon, Aug 03, 2009 at 04:58:19PM +0200, Albin Tonnerre wrote: This is the second part of patch. This part includes: - changes to ach/arch/boot/Makefile to make it easier to add new compression types - new piggy.lzo.S necessary for lzo compression - changes in arch/arm/boot/compressed/misc.c to allow the use of lzo or gzip, depending on the config - Kconfig support FYI, with these patches applied and selecting GZIP method, I get linker errors. I've been unable to track down what's going on, but it appears to be a libgcc issue. In spite of the decompressor being built as an EABI object, gcc seems to be issuing calls to __umodsi3, which isn't in the EABI libgcc (they're called something different - don't ask.) I also happen to have issues related to the linker not finding __aeabi_uidivmod, but only when compiling with CONFIG_CC_OPTIMIZE_FOR_SIZE. Is it similar for you, or does it also fail when compiling with -O2 ? So I think these patches need further testing and evaluation on ARM before they can be merged. Moreover, I'd like to see some comparisons between the _current_ gzip method, the new gzip method and the lzo method on ARM. I don't have my ARM platforms at hand, but I'll so these comparisons in a couple days when I access to them again. Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Fri, Aug 07, 2009 at 11:24:52AM +0200, Albin Tonnerre wrote: I also happen to have issues related to the linker not finding __aeabi_uidivmod, but only when compiling with CONFIG_CC_OPTIMIZE_FOR_SIZE. Is it similar for you, or does it also fail when compiling with -O2 ? I tend not to build with -O2 because it seems to tickle compiler bugs (which is the reverse of -Os on x86.) I'll give it a go over the next few days. -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On 08/07/09 11:24, Albin Tonnerre wrote: On Thu, Aug 06, 2009 at 11:40:55PM +0100, Russell King - ARM Linux wrote : On Mon, Aug 03, 2009 at 04:58:19PM +0200, Albin Tonnerre wrote: This is the second part of patch. This part includes: - changes to ach/arch/boot/Makefile to make it easier to add new compression types - new piggy.lzo.S necessary for lzo compression - changes in arch/arm/boot/compressed/misc.c to allow the use of lzo or gzip, depending on the config - Kconfig support FYI, with these patches applied and selecting GZIP method, I get linker errors. I've been unable to track down what's going on, but it appears to be a libgcc issue. In spite of the decompressor being built as an EABI object, gcc seems to be issuing calls to __umodsi3, which isn't in the EABI libgcc (they're called something different - don't ask.) I also happen to have issues related to the linker not finding __aeabi_uidivmod, but only when compiling with CONFIG_CC_OPTIMIZE_FOR_SIZE. Is it similar for you, or does it also fail when compiling with -O2 ? So I think these patches need further testing and evaluation on ARM before they can be merged. Moreover, I'd like to see some comparisons between the _current_ gzip method, the new gzip method and the lzo method on ARM. I don't have my ARM platforms at hand, but I'll so these comparisons in a couple days when I access to them again. Regards, Could it be that the patches that remove division (zutil.h and inflate.c) have somehow not been applied? Regards, Alain -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Fri, Aug 07, 2009 at 11:36:56AM +0200, Alain Knaff wrote : On 08/07/09 11:24, Albin Tonnerre wrote: On Thu, Aug 06, 2009 at 11:40:55PM +0100, Russell King - ARM Linux wrote : On Mon, Aug 03, 2009 at 04:58:19PM +0200, Albin Tonnerre wrote: This is the second part of patch. This part includes: - changes to ach/arch/boot/Makefile to make it easier to add new compression types - new piggy.lzo.S necessary for lzo compression - changes in arch/arm/boot/compressed/misc.c to allow the use of lzo or gzip, depending on the config - Kconfig support FYI, with these patches applied and selecting GZIP method, I get linker errors. I've been unable to track down what's going on, but it appears to be a libgcc issue. In spite of the decompressor being built as an EABI object, gcc seems to be issuing calls to __umodsi3, which isn't in the EABI libgcc (they're called something different - don't ask.) I also happen to have issues related to the linker not finding __aeabi_uidivmod, but only when compiling with CONFIG_CC_OPTIMIZE_FOR_SIZE. Is it similar for you, or does it also fail when compiling with -O2 ? So I think these patches need further testing and evaluation on ARM before they can be merged. Moreover, I'd like to see some comparisons between the _current_ gzip method, the new gzip method and the lzo method on ARM. I don't have my ARM platforms at hand, but I'll so these comparisons in a couple days when I access to them again. Regards, Could it be that the patches that remove division (zutil.h and inflate.c) have somehow not been applied? Indeed, they've not been applied. However, I'd rather try to understand why exactly this is an issue when compiling with -Os and not -O2 instead of working around it by removing the divisions. Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
Albin Tonnerre a écrit : On Fri, Aug 07, 2009 at 01:50:03PM +0200, Matthieu CASTET wrote : Albin Tonnerre a écrit : On Fri, Aug 07, 2009 at 11:36:56AM +0200, Alain Knaff wrote : On 08/07/09 11:24, Albin Tonnerre wrote: Regards, Could it be that the patches that remove division (zutil.h and inflate.c) have somehow not been applied? Indeed, they've not been applied. However, I'd rather try to understand why exactly this is an issue when compiling with -Os and not -O2 instead of working around it by removing the divisions. Look at the generated code. Arm doesn't have division instruction. May be at -Os gcc emit a call to the software division, but at -O2 it manage to optimise the division (transform it in shift, inline some builtin, ...). Yes, I figured that out. What I don't get, though, is that it fails while the software division symbol (__aeabi_uidivmod here) does seem to be provided by libgcc. AFAIK we don't link the kernel with libgcc. That's why the kernel provide __aeabi_* in arch/arm/lib -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Fri, Aug 07, 2009 at 03:27:00PM +0200, Matthieu CASTET wrote : Albin Tonnerre a écrit : On Fri, Aug 07, 2009 at 01:50:03PM +0200, Matthieu CASTET wrote : Albin Tonnerre a écrit : On Fri, Aug 07, 2009 at 11:36:56AM +0200, Alain Knaff wrote : On 08/07/09 11:24, Albin Tonnerre wrote: Regards, Could it be that the patches that remove division (zutil.h and inflate.c) have somehow not been applied? Indeed, they've not been applied. However, I'd rather try to understand why exactly this is an issue when compiling with -Os and not -O2 instead of working around it by removing the divisions. Look at the generated code. Arm doesn't have division instruction. May be at -Os gcc emit a call to the software division, but at -O2 it manage to optimise the division (transform it in shift, inline some builtin, ...). Yes, I figured that out. What I don't get, though, is that it fails while the software division symbol (__aeabi_uidivmod here) does seem to be provided by libgcc. AFAIK we don't link the kernel with libgcc. That's why the kernel provide __aeabi_* in arch/arm/lib That's true for the actual kernel image, but not for the bootstrap code we use when compiling compressed kernels. arch/arm/boot/compressed/Makefile uses libgcc, unless I'm overlooking something here: arm-unknown-linux-uclibcgnueabi-ld -EL--defsym zreladdr=0x20008000 --defsym initrd_phys=0x2041 --defsym params_phys=0x2100 -p --no-undefined -X /home/albin/x-tools/arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.2/libgcc.a -T arch/arm/boot/compressed/vmlinux.lds arch/arm/boot/compressed/head.o arch/arm/boot/compressed/piggy.gzip.o arch/arm/boot/compressed/misc.o -o arch/arm/boot/compressed/vmlinux Regards, -- Albin Tonnerre, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Fri, Aug 07, 2009 at 03:55:24PM +0200, Albin Tonnerre wrote: That's true for the actual kernel image, but not for the bootstrap code we use when compiling compressed kernels. arch/arm/boot/compressed/Makefile uses libgcc, unless I'm overlooking something here: arm-unknown-linux-uclibcgnueabi-ld -EL--defsym zreladdr=0x20008000 --defsym initrd_phys=0x2041 --defsym params_phys=0x2100 -p --no-undefined -X /home/albin/x-tools/arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.2/libgcc.a -T arch/arm/boot/compressed/vmlinux.lds arch/arm/boot/compressed/head.o arch/arm/boot/compressed/piggy.gzip.o arch/arm/boot/compressed/misc.o -o arch/arm/boot/compressed/vmlinux It's because libgcc appears in the wrong place in the command line, and due to the way kbuild works, we can't get it into the right place easily. Linkers are sensitive to the order of archives on the command line - its pointless having an archive as the first file argument because none of the contained objects will ever be pulled in. Sam - any ideas how to solve this? -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On 08/07/2009 01:00 PM, Russell King - ARM Linux wrote: On Fri, Aug 07, 2009 at 03:55:24PM +0200, Albin Tonnerre wrote: That's true for the actual kernel image, but not for the bootstrap code we use when compiling compressed kernels. arch/arm/boot/compressed/Makefile uses libgcc, unless I'm overlooking something here: arm-unknown-linux-uclibcgnueabi-ld -EL--defsym zreladdr=0x20008000 --defsym initrd_phys=0x2041 --defsym params_phys=0x2100 -p --no-undefined -X /home/albin/x-tools/arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.2/libgcc.a -T arch/arm/boot/compressed/vmlinux.lds arch/arm/boot/compressed/head.o arch/arm/boot/compressed/piggy.gzip.o arch/arm/boot/compressed/misc.o -o arch/arm/boot/compressed/vmlinux It's because libgcc appears in the wrong place in the command line, and due to the way kbuild works, we can't get it into the right place easily. Linkers are sensitive to the order of archives on the command line - its pointless having an archive as the first file argument because none of the contained objects will ever be pulled in. Sam - any ideas how to solve this? Can we use the group feature of ld for this? -hpa -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Fri, Aug 07, 2009 at 09:00:01PM +0100, Russell King - ARM Linux wrote: On Fri, Aug 07, 2009 at 03:55:24PM +0200, Albin Tonnerre wrote: That's true for the actual kernel image, but not for the bootstrap code we use when compiling compressed kernels. arch/arm/boot/compressed/Makefile uses libgcc, unless I'm overlooking something here: arm-unknown-linux-uclibcgnueabi-ld -EL--defsym zreladdr=0x20008000 --defsym initrd_phys=0x2041 --defsym params_phys=0x2100 -p --no-undefined -X /home/albin/x-tools/arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.2/libgcc.a -T arch/arm/boot/compressed/vmlinux.lds arch/arm/boot/compressed/head.o arch/arm/boot/compressed/piggy.gzip.o arch/arm/boot/compressed/misc.o -o arch/arm/boot/compressed/vmlinux It's because libgcc appears in the wrong place in the command line, and due to the way kbuild works, we can't get it into the right place easily. Linkers are sensitive to the order of archives on the command line - its pointless having an archive as the first file argument because none of the contained objects will ever be pulled in. Sam - any ideas how to solve this? We could add libgcc as a prerequisite. Untested patch below. This is a ittle hackish - otherwise we have to change the definition of ld or use a private version. I added explanations for some of the linker symbols when I was there. I cannot the ld options. If you decide to use this it has my: Signed-off-by: Sam Ravnborg s...@ravnborg.org Sam diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index ce39dc5..4f980f2 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -87,15 +87,24 @@ endif ifneq ($(PARAMS_PHYS),) LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) endif -LDFLAGS_vmlinux += -p --no-undefined -X \ - $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T + +# ? +LDFLAGS_vmlinux += -p +# Report unresolved symbol references +LDFLAGS_vmlinux += --no-undefined +# Delete all temporary local symbols +LDFLAGS_vmlinux += -X +# Next argument is a linker script +LDFLAGS_vmlinux += -T + +libgcc = $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) # Don't allow any static data in misc.o, which # would otherwise mess up our GOT table CFLAGS_misc.o := -Dstatic= $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \ - $(addprefix $(obj)/, $(OBJS)) FORCE + $(addprefix $(obj)/, $(OBJS)) $(libgcc) FORCE $(call if_changed,ld) @: Sam -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] Add support for LZO-compressed kernels for ARM
On Mon, Aug 03, 2009 at 04:58:19PM +0200, Albin Tonnerre wrote: This is the second part of patch. This part includes: - changes to ach/arch/boot/Makefile to make it easier to add new compression types - new piggy.lzo.S necessary for lzo compression - changes in arch/arm/boot/compressed/misc.c to allow the use of lzo or gzip, depending on the config - Kconfig support FYI, with these patches applied and selecting GZIP method, I get linker errors. I've been unable to track down what's going on, but it appears to be a libgcc issue. In spite of the decompressor being built as an EABI object, gcc seems to be issuing calls to __umodsi3, which isn't in the EABI libgcc (they're called something different - don't ask.) So I think these patches need further testing and evaluation on ARM before they can be merged. Moreover, I'd like to see some comparisons between the _current_ gzip method, the new gzip method and the lzo method on ARM. I was going to get those numbers, but the platform I was going to run the tests on has died on me today. -- To unsubscribe from this list: send the line unsubscribe linux-embedded in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html