make PHYS_OFFSET determined at run time (unfinished)
Subsystems (2)
Hello,
I'm looking into making PHYS_OFFSET determined at run time. I saw a patch for it that already made it a few times on the list[1].
I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe
[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 arm: don't define unused symbol initrd_phys for zImage
The only user of initrd_phys is arch/arm/boot/bootp/init.S which still gets the value passed to.
--- arch/arm/boot/compressed/Makefile | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/boot/compressed/Makefile +3 -6
@@ -78,16 +78,13 @@ endif EXTRA_CFLAGS := -fpic -fno-builtin EXTRA_AFLAGS := -Wa,-march=all -# Supply ZRELADDR, INITRD_PHYS and PARAMS_PHYS to the decompressor via -# linker symbols. We only define initrd_phys and params_phys if the -# machine class defined the corresponding makefile variable. +# Supply ZRELADDR and PARAMS_PHYS to the decompressor via linker symbols. We +# only define params_phys if the machine class defined the corresponding +# makefile variable. LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR) ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) LDFLAGS_vmlinux += --be8 endif -ifneq ($(INITRD_PHYS),) -LDFLAGS_vmlinux += --defsym initrd_phys=$(INITRD_PHYS) -endif ifneq ($(PARAMS_PHYS),) LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) endif
Signature · 1 line
1.6.6
PATCH 1/1 arm: add a comment to __atags_pointer describing where it's set
In reply to Uwe Kleine-König--- arch/arm/kernel/setup.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/kernel/setup.c +4 -0
@@ -73,6 +73,10 @@ EXPORT_SYMBOL(__machine_arch_type);unsigned int cacheid;EXPORT_SYMBOL (cacheid); +/* +* This is assigned to in arch/arm/kernel/head-common.S +* before calling start_kernel +*/ unsigned int __atags_pointer__initdata ;unsigned int system_rev;
Signature · 1 line
1.6.6
PATCH 1/1 arm: add a comment to __atags_pointer describing where it's set
Quoted 1 line · Uwe Kleine-K?nig
Signed-off-by Uwe Kleine-K?nig <[email protected]>
Grep is a wonderful tool for this; we have many more like this and it really doesn't make sense to start adding comments describing where things get written.
PATCH 1/1 arm: remove support for old way to pass kernel parameters
In reply to Uwe Kleine-KönigThis was deprecated in 2001 and announced to live on for 5 years.
squash_mem_tags is the only function defined in compat.c that is still needed. As setup.c is the only user move it into there and make is static. This allows removing compat.c.
The result is:
add/remove: 0/2 grow/shrink: 2/0 up/down: 32/-476 (-444)
function old new delta
setup_arch 1584 1612 +28
cpu_init 108 112 +4
squash_mem_tags 64 - -64
convert_to_tag_list 412 - -412
(The change in cpu_init isn't really related. There a
mov r1, #332
changed into
ldr r1, [pc, #56]
and so the size of the local pool is increased by one word.)
--- arch/arm/kernel/Makefile | 2 +- arch/arm/kernel/compat.c | 226 ---------------------------------------------- arch/arm/kernel/compat.h | 13 --- arch/arm/kernel/setup.c | 14 ++-- 4 files changed, 8 insertions(+), 247 deletions(-) delete mode 100644 arch/arm/kernel/compat.c delete mode 100644 arch/arm/kernel/compat.h
arch/arm/kernel/Makefile +1 -1
@@ -13,7 +13,7 @@ CFLAGS_REMOVE_return_address.o = -pg # Object file lists. -obj-y := compat.o elf.o entry-armv.o entry-common.o irq.o \ +obj-y := elf.o entry-armv.o entry-common.o irq.o \ process.o ptrace.o return_address.o setup.o signal.o \ sys_arm.o stacktrace.o time.o traps.o
arch/arm/kernel/compat.c deleted +0 -226
226 lines not on this page · raw message
arch/arm/kernel/compat.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* -* linux/arch/arm/kernel/compat.h -* -* Copyright (C) 2001 Russell King -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -extern void convert_to_tag_list (struct tag *tags); - -extern void squash_mem_tags (struct tag *tag);
arch/arm/kernel/setup.c +7 -7
@@ -43,7 +43,6 @@#include <asm/traps.h> #include <asm/unwind.h> -#include "compat.h" #include "atags.h" #include "tcm.h"
@@ -699,6 +698,13 @@ static int __init customize_machine(void) }arch_initcall (customize_machine); +static void __init squash_mem_tags (struct tag *tag) +{ +for (; tag->hdr.size; tag =tag_next (tag)) +if (tag->hdr.tag ==ATAG_MEM ) + tag->hdr.tag =ATAG_NONE ; +} +void __init setup_arch (char **cmdline_p) {struct tag *tags = (struct tag *)&init_tags;
@@ -719,12 +725,6 @@ void __init setup_arch(char **cmdline_p)else if (mdesc->boot_params) tags =phys_to_virt (mdesc->boot_params); -/* -* If we have the old style parameters, convert them to -* a tag list. -*/ -if (tags->hdr.tag !=ATAG_CORE ) -convert_to_tag_list (tags);if (tags->hdr.tag !=ATAG_CORE ) tags = (struct tag *)&init_tags;
Signature · 1 line
1.6.6
PATCH 1/1 arm: remove support for old way to pass kernel parameters
Quoted 1 line · Uwe Kleine-K?nig
This was deprecated in 2001 and announced to live on for 5 years.
Unfortunately, there are still boot loaders around which use the old way (eg, my firewall and server machines) - maybe make it a config option for the time being.
PATCH 1/1 arm: deprecate support for old way to pass kernel parameters
This was deprecated in 2001 and announced to live on for 5 years.
For now provide a kernel parameter for those who still need it.
--- arch/arm/Kconfig | 6 ++++++ arch/arm/kernel/Makefile | 4 +++- arch/arm/kernel/compat.c | 7 ------- arch/arm/kernel/compat.h | 2 -- arch/arm/kernel/setup.c | 11 +++++++++++ 5 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/Kconfig +6 -0
@@ -1254,6 +1254,12 @@ config UACCESS_WITH_MEMCPY However, if the CPU data cache is using a write-allocate mode, this option is unlikely to provide any performance gain. +config DEPRECATED_PARAM_STRUCT + bool "Provide old way to pass kernel parameters" + help + This was deprecated in 2001 and announced to live on for 5 years. + Some old boot loaders still use this way. + endmenu menu "Boot options"
arch/arm/kernel/Makefile +3 -1
@@ -13,10 +13,12 @@ CFLAGS_REMOVE_return_address.o = -pg # Object file lists. -obj-y := compat.o elf.o entry-armv.o entry-common.o irq.o \ +obj-y := elf.o entry-armv.o entry-common.o irq.o \ process.o ptrace.o return_address.o setup.o signal.o \ sys_arm.o stacktrace.o time.o traps.o +obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o + obj-$(CONFIG_OC_ETM) += etm.o obj-$(CONFIG_ISA_DMA_API) += dma.o
arch/arm/kernel/compat.c +0 -7
@@ -217,10 +217,3 @@ void __init convert_to_tag_list(struct tag *tags)struct param_struct *params = (struct param_struct *)tags;build_tag_list (params, ¶ms->u2); } - -void __init squash_mem_tags (struct tag *tag) -{ -for (; tag->hdr.size; tag =tag_next (tag)) -if (tag->hdr.tag ==ATAG_MEM ) - tag->hdr.tag =ATAG_NONE ; -}
arch/arm/kernel/compat.h +0 -2
@@ -9,5 +9,3 @@*/ extern void convert_to_tag_list (struct tag *tags); - -extern void squash_mem_tags (struct tag *tag);
arch/arm/kernel/setup.c +11 -0
@@ -43,7 +43,9 @@#include <asm/traps.h> #include <asm/unwind.h> +#if defined(CONFIG_DEPRECATED_PARAM_STRUCT )#include "compat.h" +#endif #include "atags.h" #include "tcm.h"
@@ -699,6 +701,13 @@ static int __init customize_machine(void) }arch_initcall (customize_machine); +static void __init squash_mem_tags (struct tag *tag) +{ +for (; tag->hdr.size; tag =tag_next (tag)) +if (tag->hdr.tag ==ATAG_MEM ) + tag->hdr.tag =ATAG_NONE ; +} +void __init setup_arch (char **cmdline_p) {struct tag *tags = (struct tag *)&init_tags;
@@ -719,12 +728,14 @@ void __init setup_arch(char **cmdline_p)else if (mdesc->boot_params) tags =phys_to_virt (mdesc->boot_params); +#if defined(CONFIG_DEPRECATED_PARAM_STRUCT )/* * If we have the old style parameters, convert them to * a tag list. */ if (tags->hdr.tag !=ATAG_CORE )convert_to_tag_list (tags); +#endif if (tags->hdr.tag !=ATAG_CORE ) tags = (struct tag *)&init_tags;
Signature · 1 line
1.6.6
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.
As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 32 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
Quoted 9 lines
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.
Or of course, boot zImages. I belive u-boot has support for zImage.
Quoted 16 lines
~Ryan
Signature · 12 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.
Quoted 43 lines · Ben Dooks
Quoted 32 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
Quoted 9 lines
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.
Quoted 1 line
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
Thanks
Steve
Quoted 44 lines · Steve Chen
Quoted 43 lines · Ben Dooks
Quoted 41 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.
Quoted 5 lines
Quoted 1 line
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
u-boot should be doing the right thing, I thought uImage was simply a zImage wrapped in the right uboot descriptors to tell uboot it was a kernel and where to load it.
Certianly uboots i've used can boto zImage just fine.
Quoted 4 lines
Thanks
Steve
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.
Quoted 51 lines · Ben Dooks
Quoted 44 lines · Steve Chen
Quoted 43 lines · Ben Dooks
Quoted 41 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.Quoted 5 lines
Quoted 1 line
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
Quoted 5 lines
u-boot should be doing the right thing, I thought uImage was simply a zImage wrapped in the right uboot descriptors to tell uboot it was a kernel and where to load it.
Certianly uboots i've used can boto zImage just fine.
I'm also able to boot zImage under u-boot. However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. Any tips will be greatly appreciated.
Steve
Hello Steve,
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
u-boot should be doing the right thing, I thought uImage was simply a zImage wrapped in the right uboot descriptors to tell uboot it was a kernel and where to load it.
Quoted 6 lines
Quoted 1 line
Certianly uboots i've used can boto zImage just fine.
I'm also able to boot zImage under u-boot. However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. Any tips will be greatly appreciated.
Maybe this doesn't help you much, but barebox (aka. u-boot-v2) can boot zImages just fine and passes the cmdline as with booting an uImage.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 56 lines · Steve Chen
Quoted 55 lines · Ben Dooks
Quoted 44 lines · Steve Chen
Quoted 43 lines · Ben Dooks
Quoted 41 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. ?I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.Quoted 5 lines
Quoted 1 line
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? ?Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. ?Just wondering if there is a better way.
u-boot should be doing the right thing, I thought uImage was simply a zImage wrapped in the right uboot descriptors to tell uboot it was a kernel and where to load it.
Quoted 6 lines
Quoted 1 line
Certianly uboots i've used can boto zImage just fine.
I'm also able to boot zImage under u-boot. ?However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. ?Any tips will be greatly appreciated.
Perhaps you use 'go' instead of 'bootm' command in u-boot? How about:-
u-boot # <load zImage@_addr_ by some means>
u-boot # setenv machid <your machine ID in hex without the '0x'> u-boot # saveenv //persistently save the machid
// now you don't need to set machid even after cold reset
u-boot # bootm _addr_
hth.
Quoted 63 lines · jassi brar
Quoted 52 lines · Steve Chen
Quoted 51 lines · Ben Dooks
Quoted 42 lines · Steve Chen
Quoted 41 lines · Ben Dooks
Quoted 40 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.Quoted 4 lines
Quoted 1 line
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
u-boot should be doing the right thing, I thought uImage was simply a zImage wrapped in the right uboot descriptors to tell uboot it was a kernel and where to load it.
Quoted 5 lines
Quoted 1 line
Certianly uboots i've used can boto zImage just fine.
I'm also able to boot zImage under u-boot. However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. Any tips will be greatly appreciated.
Perhaps you use 'go' instead of 'bootm' command in u-boot? How about:-
u-boot # <load zImage@_addr_ by some means>
Quoted 7 lines
u-boot # setenv machid <your machine ID in hex without the '0x'> u-boot # saveenv //persistently save the machid
// now you don't need to set machid even after cold resetu-boot # bootm _addr_
hth.
The problem is not having something I can boot in U-Boot since users can always generate their own uImages from an image/zImage. The problem is that uImages have a fixed load address, so generating a uImage which contains support for several boards with different load addresses will be non-bootable on some of those boards.
IMHO, the kernel build scripts shouldn't make it easy to build broken images. So, either remove the 'make uImage' support (and let users generate the uImages themselves) or have the build system print a warning stating that the image will only boot on boards with PHYS_OFFSET=0xsomething.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 70 lines · Ryan Mallon
Quoted 69 lines · jassi brar
Quoted 52 lines · Steve Chen
Quoted 51 lines · Ben Dooks
Quoted 42 lines · Steve Chen
Quoted 41 lines · Ben Dooks
Quoted 40 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.Quoted 4 lines
Quoted 1 line
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
u-boot should be doing the right thing, I thought uImage was simply a zImage wrapped in the right uboot descriptors to tell uboot it was a kernel and where to load it.
Quoted 5 lines
Quoted 1 line
Certianly uboots i've used can boto zImage just fine.
I'm also able to boot zImage under u-boot. However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. Any tips will be greatly appreciated.
Perhaps you use 'go' instead of 'bootm' command in u-boot? How about:-
u-boot # <load zImage@_addr_ by some means>
u-boot # setenv machid <your machine ID in hex without the '0x'> u-boot # saveenv //persistently save the machid
// now you don't need to set machid even after cold resetu-boot # bootm _addr_
Quoted 7 lines
Quoted 1 line
hth.
The problem is not having something I can boot in U-Boot since users can always generate their own uImages from an image/zImage. The problem is that uImages have a fixed load address, so generating a uImage which contains support for several boards with different load addresses will be non-bootable on some of those boards.
I think that much everyone agrees. One of the proposals is to use zImage instead of uImage which eliminates the fixed load address issue. In summary, the advantage is that there are already code out there that supports zImage that boots multiple boards. The disadvantage is that a u-boot version 2.0 or later is required, so many released products won't be able to take advantage of this feature.
Quoted 9 lines
IMHO, the kernel build scripts shouldn't make it easy to build broken images. So, either remove the 'make uImage' support (and let users generate the uImages themselves) or have the build system print a warning stating that the image will only boot on boards with PHYS_OFFSET=0xsomething.
~Ryan
Quoted 78 lines · Steve Chen
Quoted 70 lines · Ryan Mallon
Quoted 69 lines · jassi brar
Quoted 52 lines · Steve Chen
Quoted 51 lines · Ben Dooks
Quoted 42 lines · Steve Chen
Quoted 41 lines · Ben Dooks
Quoted 40 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.Quoted 4 lines
Quoted 1 line
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
u-boot should be doing the right thing, I thought uImage was simply a zImage wrapped in the right uboot descriptors to tell uboot it was a kernel and where to load it.
Quoted 5 lines
Quoted 1 line
Certianly uboots i've used can boto zImage just fine.
I'm also able to boot zImage under u-boot. However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. Any tips will be greatly appreciated.
Perhaps you use 'go' instead of 'bootm' command in u-boot? How about:-
u-boot # <load zImage@_addr_ by some means>
u-boot # setenv machid <your machine ID in hex without the '0x'> u-boot # saveenv //persistently save the machid
// now you don't need to set machid even after cold resetu-boot # bootm _addr_
Quoted 7 lines
Quoted 1 line
hth.
The problem is not having something I can boot in U-Boot since users can always generate their own uImages from an image/zImage. The problem is that uImages have a fixed load address, so generating a uImage which contains support for several boards with different load addresses will be non-bootable on some of those boards.
Quoted 5 lines
I think that much everyone agrees. One of the proposals is to use zImage instead of uImage which eliminates the fixed load address issue. In summary, the advantage is that there are already code out there that supports zImage that boots multiple boards. The disadvantage is that a u-boot version 2.0 or later is required, so many released products won't
Uwe,
Seems like I mis-quoted you again. My apologies.
Steve
Quoted 2 lines
be able to take advantage of this feature.
Quoted 10 lines · jassi brar
Quoted 5 lines
I'm also able to boot zImage under u-boot. However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. Any tips will be greatly appreciated.
Perhaps you use 'go' instead of 'bootm' command in u-boot? How about:-
u-boot # <load zImage@_addr_ by some means>
Quoted 7 lines
u-boot # setenv machid <your machine ID in hex without the '0x'> u-boot # saveenv //persistently save the machid
// now you don't need to set machid even after cold resetu-boot # bootm _addr_
hth.
Yes, I did use go instead of bootm. I'll give this a try. I'm using u-boot version 1.3.3. Based on Uwe's comment, there is a good chance that I'll need to upgrade my u-boot. Thank you all for the feedback.
Steve
Hi Steve,
Quoted 3 lines
Yes, I did use go instead of bootm. I'll give this a try. I'm using u-boot version 1.3.3. Based on Uwe's comment, there is a good chance that I'll need to upgrade my u-boot. Thank you all for the feedback.
note I only pointed out that barebox (aka. u-boot-v2) can boot zImages. I don't know about u-boot-v1.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 15 lines · Steve Chen
Quoted 14 lines · jassi brar
Quoted 5 lines
I'm also able to boot zImage under u-boot. However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. Any tips will be greatly appreciated.
Perhaps you use 'go' instead of 'bootm' command in u-boot? How about:-
u-boot # <load zImage@_addr_ by some means>
u-boot # setenv machid <your machine ID in hex without the '0x'> u-boot # saveenv //persistently save the machid
// now you don't need to set machid even after cold reset
Quoted 8 lines
Quoted 3 lines
u-boot # bootm _addr_
hth.
Yes, I did use go instead of bootm. I'll give this a try. I'm using u-boot version 1.3.3. Based on Uwe's comment, there is a good chance that I'll need to upgrade my u-boot. Thank you all for the feedback.
I did a quick test, and I got
U-Boot > bootm 0xc0700000
Wrong Image Format for bootm command
ERROR: can't get kernel image!
It appears that I need a newer u-boot.
Steve
Quoted 24 lines · Steve Chen
Quoted 15 lines · Steve Chen
Quoted 14 lines · jassi brar
Quoted 5 lines
I'm also able to boot zImage under u-boot. ?However, I had to set r1 manually, and I don't know how to pass kernel parameters (stuff passed into kernel uImage via bootargs) to zImage. ?Any tips will be greatly appreciated.
Perhaps you use 'go' instead of 'bootm' command in u-boot? How about:-
?u-boot # <load zImage@_addr_ by some means>
?u-boot # setenv machid <your machine ID in hex without the '0x'> ?u-boot # saveenv //persistently save the machid
? ? ? ? ? ? ?// now you don't need to set machid even after cold resetQuoted 8 lines
Quoted 3 lines
?u-boot # bootm _addr_
hth.
Yes, I did use go instead of bootm. ?I'll give this a try. ?I'm using u-boot version 1.3.3. ?Based on Uwe's comment, there is a good chance that I'll need to upgrade my u-boot. ?Thank you all for the feedback.
Quoted 7 lines
I did a quick test, and I got
U-Boot > bootm
0xc0700000
Wrong Image Format for bootm command
ERROR: can't get kernel image!It appears that I need a newer u-boot.
I use u-boot-1.3.4 though
Quoted 6 lines · Steve Chen
Quoted 1 line · Ben Dooks
Or of course, boot zImages. I belive u-boot has support for zImage.
Is there a clean way to pass kernel parameters and machine type from u-boot to zImage? Last time I boot zImage in u-boot, some ugly hack was needed in ARM startup code. Just wondering if there is a better way.
I don't know about the u-boot side of things, but the kernel has supported a clean way to do this for the last 10 or so years.
Quoted 32 lines · Ryan Mallon
Quoted 10 lines · Uwe Kleine-K?nig
Hello,
I'm looking into making
PHYS_OFFSETdetermined at run time. I saw a patch for it that already made it a few times on the list[1].I'm not yet done, but first want to announce that I look into that to prevent duplicate work---so if you intended to do the same let's look together---and to post some clean up patches that are the result up to now of my digging in the boot code.
Quoted 8 lines
I will send now three patches in reply to this mail, and later hopefully more.
Best regards
Uwe[1] e.g. http://thread.gmane.org/gmane.linux.ports.arm.kernel/53793/
One of the problems that got brought up previously was the 'make uImage' can end up generating unbootable images with runtime
PHYS_OFFSET. The older format uImage's (pre 1.3.3) encode a load address (zrealaddr), so uImage's need to have a fixed load address encoded.As I stated in the previous thread, this is _not_ a kernel issue, however it is no good having a kernel which contains support for two boards which boot from different address and then generating a uImage which can only boot on one of them without warning the user about this problem. Otherwise you are going to start getting "I did make uImage and my board won't boot" problems.
Quoted 9 lines
There are a few solutions to this problem:
1) Drop uImage make support and require users generate them manually.
2) Have a uImage offset config option to allow uImage users to specify what they want the load address to be. See:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/53151/focus=53230
3) Print an error if "make uImage" is run for a kernel which has more than one boot address (possible?)
4) Use FIT U-Boot images. This is supported from U-Boot 1.3.3 onwards, however a number of people are still using older U-Boots.
5) use a mkimage(gzip(Image))-Image instead of mkimage(zImage). ($(make uImage) creates the latter.) See
http://thread.gmane.org/gmane.linux.ports.arm.kernel/36547
. You need gzip support in U-Boot for that.
6) boot a zImage as pointed out by Ben.
My preference would be:
- rename uImage to uzImage (probably with a deprecation window)
- introduce uImagegz that creates a mkimage(gzip(Image))-Image
- allow overriding the load address for uzImage
- for uImagegz that don't have a fixed zreladdr require specifing a loadaddr
Last time I suggested something like that Russell wasn't happy as no boot loader different from U-Boot needs so much magic in the kernel Makefile. If it's only not wanting to hatch that part of the kernel, I'd volunteer to do that.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Hello,
just a short status report: The code seems to work OK if PHYS_OFFSET is determined correctly.
The problem is when it does not. Currently I place arch/arm/boot/Image at 0xa1008000[1] with PHYS_OFFSET being 0xa0000000. Then arch/arm/boot/head.S guesses PHYS_OFFSET to be 0xa1000000 resulting __va(bank->start) of my only bank to be 0xbf000000. And so this bank is discarded by sanity_check_meminfo as 0xbf000000 overlaps the vmalloc region.
So how to proceed? These possiblities come to (my) mind:
- parse the atag list to better guess phys_offset
(both zImage and Image would need to do that)
- require that zImage and Image are placed such that the guess is done right (which is stupid for zImage as then the decompressor needs to move the decompressed image)
- require the bootloader to pass phys_offset (r3?)
- make the ram mapping non-linear
- don't discard the whole bank, only the addresses overlaping the vmalloc region
Anything else? Preferences? Thoughts?
Best regards
Uwe
[1] I think the same happens with zImage placed at 0xa1008000
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
change boot requirements [Was: make PHYS_OFFSET determined at run time (unfinished)]
Hello,
Quoted 22 lines · Uwe Kleine-K?nig
just a short status report: The code seems to work OK if
PHYS_OFFSETis determined correctly.The problem is when it does not. Currently I place
arch/arm/boot/Imageat 0xa1008000[1] withPHYS_OFFSETbeing0xa0000000. Thenarch/arm/boot/head.SguessesPHYS_OFFSETto be0xa1000000resulting__va(bank->start)of my only bank to be0xbf000000. And so this bank is discarded bysanity_check_meminfoas0xbf000000overlaps the vmalloc region.So how to proceed? These possiblities come to (my) mind:
- parse the atag list to better guess
phys_offset
(both zImage and Image would need to do that)
- require that zImage and Image are placed such that the guess is done right (which is stupid for zImage as then the decompressor needs to move the decompressed image)
- require the bootloader to passphys_offset(r3?)
- make the ram mapping non-linear
- don't discard the whole bank, only the addresses overlaping the vmalloc region
Quoted 1 line
Anything else? Preferences? Thoughts?
I'd like to go forward here and if I don't hear anything here I'll start requiring that the bootloader sets r3=PHYS_OFFSET as this seems the most robust solution to me.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
change boot requirements [Was: make PHYS_OFFSET determined at run time (unfinished)]
Quoted 25 lines · Uwe Kleine-K?nig
Hello,
Quoted 22 lines · Uwe Kleine-K?nig
just a short status report: The code seems to work OK if
PHYS_OFFSETis determined correctly.The problem is when it does not. Currently I place
arch/arm/boot/Imageat 0xa1008000[1] withPHYS_OFFSETbeing0xa0000000. Thenarch/arm/boot/head.SguessesPHYS_OFFSETto be0xa1000000resulting__va(bank->start)of my only bank to be0xbf000000. And so this bank is discarded bysanity_check_meminfoas0xbf000000overlaps the vmalloc region.So how to proceed? These possiblities come to (my) mind:
- parse the atag list to better guess
phys_offset
(both zImage and Image would need to do that)
- require that zImage and Image are placed such that the guess is done right (which is stupid for zImage as then the decompressor needs to move the decompressed image)
- require the bootloader to passphys_offset(r3?)
- make the ram mapping non-linear
- don't discard the whole bank, only the addresses overlaping the vmalloc region
Quoted 4 lines
Quoted 1 line
Anything else? Preferences? Thoughts?
I'd like to go forward here and if I don't hear anything here I'll start requiring that the bootloader sets r3=PHYS_OFFSET as this seems the most robust solution to me.
As long as you can still build images the old way. There will be some people who cannot modify their bootloaders to support this.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
change boot requirements [Was: make PHYS_OFFSET determined at run time (unfinished)]
Hello,
Quoted 24 lines · Ryan Mallon
Quoted 23 lines · Uwe Kleine-K?nig
Quoted 22 lines · Uwe Kleine-K?nig
just a short status report: The code seems to work OK if
PHYS_OFFSETis determined correctly.The problem is when it does not. Currently I place
arch/arm/boot/Imageat 0xa1008000[1] withPHYS_OFFSETbeing0xa0000000. Thenarch/arm/boot/head.SguessesPHYS_OFFSETto be0xa1000000resulting__va(bank->start)of my only bank to be0xbf000000. And so this bank is discarded bysanity_check_meminfoas0xbf000000overlaps the vmalloc region.So how to proceed? These possiblities come to (my) mind:
- parse the atag list to better guess
phys_offset
(both zImage and Image would need to do that)
- require that zImage and Image are placed such that the guess is done right (which is stupid for zImage as then the decompressor needs to move the decompressed image)
- require the bootloader to passphys_offset(r3?)
- make the ram mapping non-linear
- don't discard the whole bank, only the addresses overlaping the vmalloc region
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Anything else? Preferences? Thoughts?
I'd like to go forward here and if I don't hear anything here I'll start requiring that the bootloader sets r3=PHYS_OFFSET as this seems the most robust solution to me.
It works now for me.
zImage expects to get PHYS_OFFSET passed in r3. It doesn't hurt at all if the value is wrong if RUNTIME_PHYS_OFFSET is off. If it's on it is used if the value is 128MiB-aligned. If not sp & 0xf8000000 is used. This should work for most machines.
There is no machine support included yet, but adding it for your machine should be easy. Just select RUNTIME_PHYS_OFFSET and remove the definition of PHYS_OFFSET from <mach/memory.h>.
The whole series is available via git, see below, and I will send the patches not yet send in reply to this mail.
Best regards
Uwe
The following changes since commit 499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' of git://git.kernel.org/.../dtor/input
are available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.git arm/booting
Uwe Kleine-K?nig (9):
zImage: fix comments for cache_on, cache_off and cache_clean_flush
zImage: some comments for __armv3_mpu_cache_on
zImage: __armv3_mpu_cache_flush: respect should-be-zero specification
zImage: annotate debug functions about corrupted registers
zImage: don't define unused symbol initrd_phys
arm: deprecate support for old way to pass kernel parameters
zImage: don't hard code the stack size twice
uImage: require passing a LOADADDR when building with RUNTIME_PHYSOFFSET Allow PHYS_OFFSET to be runtime determined
Documentation/arm/Booting | 1 + arch/arm/Kconfig | 9 ++++ arch/arm/boot/Makefile | 6 ++- arch/arm/boot/compressed/Makefile | 10 ++--- arch/arm/boot/compressed/head.S | 76 +++++++++++++++++++++++++++++++++---- arch/arm/include/asm/memory.h | 5 ++ arch/arm/kernel/Makefile | 4 +- arch/arm/kernel/compat.c | 7 --- arch/arm/kernel/compat.h | 2 - arch/arm/kernel/head.S | 31 +++++++++++---- arch/arm/kernel/setup.c | 21 ++++++++++- 11 files changed, 138 insertions(+), 34 deletions(-)
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/3 zImage: don't hard code the stack size twice
--- arch/arm/boot/compressed/head.S | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/boot/compressed/head.S +2 -1
@@ -314,7 +314,7 @@ LC0: .word LC0 @ r1 .word _start @ r5 .word _got_start @ r6 .word _got_end @ ip - .word user_stack+4096 @ sp + .word user_stack_end @ sp LC1: .word reloc_end - reloc_start .size LC0, . - LC0
@@ -1089,3 +1089,4 @@ reloc_end: .align .section ".stack", "w" user_stack: .space 4096 +user_stack_end:
Signature · 1 line
1.6.6
PATCH 2/3 uImage: require passing a LOADADDR when building with RUNTIME_PHYSOFFSET
In reply to Uwe Kleine-Königthe default load address (in the CONFIG_ZBOOT_ROM=n case) is ZRELADDR which (apart from being a stupid load address for the RUNTIME_PHYSOFFSET=n case) might not be a valid read/write memory on the target machine at all. So require passing a LOADADDR on the command line. This obiously makes the uImage more machine dependant than the zImage.
--- arch/arm/boot/Makefile | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/boot/Makefile +5 -1
@@ -64,11 +64,13 @@ quiet_cmd_uimage = UIMAGE $@ -C none -a $(LOADADDR) -e $(STARTADDR) \ -n 'Linux-$(KERNELRELEASE)' -d $< $@ +ifeq ($(CONFIG_RUNTIME_PHYS_OFFSET),) ifeq ($(CONFIG_ZBOOT_ROM),y) $(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT) else $(obj)/uImage: LOADADDR=$(ZRELADDR) endif +endif ifeq ($(CONFIG_THUMB2_KERNEL),y) # Set bit 0 to 1 so that "mov pc, rx" switches to Thumb-2 mode
@@ -77,7 +79,9 @@ else $(obj)/uImage: STARTADDR=$(LOADADDR) endif -$(obj)/uImage: $(obj)/zImage FORCE +$(obj)/uImage: $(obj)/zImage FORCE + @test -n "$(LOADADDR)" || \ + (echo "You must specify a load address (i.e. make uImage LOADADDR=0x...)"; exit 1) $(call if_changed,uimage) @echo ' Image $@ is ready'
Signature · 1 line
1.6.6
PATCH 3/3 Allow PHYS_OFFSET to be runtime determined
In reply to Uwe Kleine-KönigThis bases on work done earlier by Lennert Buytenhek and Mark A. Greer. Compared to their approach zreladdr isn't guessed based on the pc register but the bootloader is expected to pass PHYS_OFFSET in r3. If that value doesn't look right (e.g. isn't aligned) it is guessed based on the value of sp. This should work for CONFIG_ZBOOT_ROM, too.
To use it for your machine removing the definition of PHYS_OFFSET from <mach/memory.h> and selecting CONFIG_RUNTIME_PHYS_OFFSET should be enough.
--- Documentation/arm/Booting | 1 + arch/arm/Kconfig | 3 ++ arch/arm/boot/compressed/Makefile | 1 + arch/arm/boot/compressed/head.S | 50 +++++++++++++++++++++++++++++++++++++ arch/arm/include/asm/memory.h | 5 +++ arch/arm/kernel/head.S | 31 +++++++++++++++++------ arch/arm/kernel/setup.c | 10 ++++++- 7 files changed, 92 insertions(+), 9 deletions(-)
Documentation/arm/Booting +1 -0
@@ -126,6 +126,7 @@ In either case, the following conditions must be met: r0 = 0, r1 = machine type number discovered in (3) above. r2 = physical address of tagged list in system RAM. + r3 = PHYS_OFFSET - CPU mode All forms of interrupts must be disabled (IRQs and FIQs)
arch/arm/Kconfig +3 -0
@@ -1254,6 +1254,9 @@ config UACCESS_WITH_MEMCPY However, if the CPU data cache is using a write-allocate mode, this option is unlikely to provide any performance gain. +config RUNTIME_PHYS_OFFSET + bool + config DEPRECATED_PARAM_STRUCT bool "Provide old way to pass kernel parameters" help
arch/arm/boot/compressed/Makefile +1 -0
@@ -4,6 +4,7 @@ # create a compressed vmlinuz image from the original vmlinux # +AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) HEAD = head.o OBJS = misc.o FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
arch/arm/boot/compressed/head.S +50 -0
74 lines not on this page · raw message
arch/arm/include/asm/memory.h +5 -0
@@ -24,6 +24,11 @@*/ #define UL (x) _AC(x, UL) +#if defined(CONFIG_RUNTIME_PHYS_OFFSET ) && !defined(__ASSEMBLY__) +extern unsigned long phys_offset; +#define PHYS_OFFSET phys_offset +#endif +#ifdef CONFIG_MMU /*
arch/arm/kernel/head.S +23 -8
@@ -22,12 +22,14 @@ #include <asm/thread_info.h> #include <asm/system.h> +#if !defined(CONFIG_RUNTIME_PHYS_OFFSET) #if (PHYS_OFFSET & 0x001fffff) #error "PHYS_OFFSET must be at an even 2MiB boundary!" #endif +#define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET) +#endif #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) -#define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET) /*
@@ -44,8 +46,8 @@ .globl swapper_pg_dir .equ swapper_pg_dir, KERNEL_RAM_VADDR - 0x4000 - .macro pgtbl, rd - ldr \rd, =(KERNEL_RAM_PADDR - 0x4000) + .macro pgtbl, rd, phys_offset + add \rd, \phys_offset, #(TEXT_OFFSET - 0x4000) .endm #ifdef CONFIG_XIP_KERNEL
@@ -215,9 +217,25 @@ ENDPROC(__turn_mmu_on) * Returns: * r0, r3, r6, r7 corrupted * r4 = physical page table address + * r5 = physical start address of (the first bank of) RAM (PHYS_OFFSET) */ __create_page_tables: - pgtbl r4 @ page table address +#if defined(CONFIG_RUNTIME_PHYS_OFFSET) + @ stext is at PHYS_OFFSET + TEXT_OFFSET. As PHYS_OFFSET has to be + @ 2MiB-aligned and assuming that TEXT_OFFSET < 2MiB + @ stext & 0xffe00000 yields PHYS_OFFSET + adr r5, stext + ldr r4, =0xffe00000 + and r5, r5, r4 + + @ save phys_offset + ldr r4, =(phys_offset - PAGE_OFFSET) + str r5, [r4, r5] +#else + ldr r5, =PHYS_OFFSET +#endif + + pgtbl r4, r5 @ r4 = page table address /* * Clear the 16K level 1 swapper page table
@@ -282,10 +300,7 @@ __create_page_tables: * Then map first 1MB of ram in case it contains our boot params. */ add r0, r4, #PAGE_OFFSET >> 18 - orr r6, r7, #(PHYS_OFFSET & 0xff000000) - .if (PHYS_OFFSET & 0x00f00000) - orr r6, r6, #(PHYS_OFFSET & 0x00f00000) - .endif + orr r6, r7, r5 str r6, [r0] #ifdef CONFIG_DEBUG_LL
arch/arm/kernel/setup.c +9 -1
@@ -68,6 +68,12 @@ __setup("fpe=", fpe_setup);extern void paging_init (struct machine_desc *desc);extern void reboot_setup (char *str); +#if defined(CONFIG_RUNTIME_PHYS_OFFSET ) +/* assign a value to prevent phys_offset from ending in up bss */ +unsigned long phys_offset =0xdeadbeef ; +EXPORT_SYMBOL (phys_offset); +#endif +unsigned int processor_id;EXPORT_SYMBOL (processor_id);unsigned int __machine_arch_type;
@@ -682,7 +688,7 @@ static struct init_tags { { tag_size(tag_core), ATAG_CORE }, { 1, PAGE_SIZE, 0xff }, { tag_size(tag_mem32), ATAG_MEM }, - { MEM_SIZE, PHYS_OFFSET }, + { MEM_SIZE, }, { 0, ATAG_NONE } };
@@ -723,6 +729,8 @@ void __init setup_arch(char **cmdline_p) tags =phys_to_virt (__atags_pointer); else if (mdesc->boot_params) tags =phys_to_virt (mdesc->boot_params); + else + init_tags.mem.start = PHYS_OFFSET;#if defined(CONFIG_DEPRECATED_PARAM_STRUCT )/*
Signature · 1 line
1.6.6
change boot requirements [Was: make PHYS_OFFSET determined at run time (unfinished)]
In reply to Uwe Kleine-KönigHello Russell,
Quoted 7 lines
The following changes since commit
499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' ofgit://git.kernel.org/.../dtor/inputare available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.gitarm/booting
Can you please pull this branch for the .34 merge window? Since the last post one new patch was added to that branch. I'll send it in reply to this mail.
Current shortlog and diffstat are below.
Thanks
Uwe
The following changes since commit 499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' of git://git.kernel.org/.../dtor/input
are available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.git arm/booting
Uwe Kleine-K?nig (10):
zImage: fix comments for cache_on, cache_off and cache_clean_flush
zImage: some comments for __armv3_mpu_cache_on
zImage: __armv3_mpu_cache_flush: respect should-be-zero specification
zImage: annotate debug functions about corrupted registers
zImage: don't define unused symbol initrd_phys
arm: deprecate support for old way to pass kernel parameters
zImage: don't hard code the stack size twice
uImage: require passing a LOADADDR when building with RUNTIME_PHYSOFFSET Allow PHYS_OFFSET to be runtime determined
arm: remove bit-rotten STANDALONE_DEBUG for decompressor
Documentation/arm/Booting | 1 + arch/arm/Kconfig | 9 ++++ arch/arm/boot/Makefile | 6 ++- arch/arm/boot/compressed/Makefile | 10 ++--- arch/arm/boot/compressed/Makefile.debug | 23 --------- arch/arm/boot/compressed/head.S | 76 +++++++++++++++++++++++++++--- arch/arm/boot/compressed/misc.c | 27 ----------- arch/arm/include/asm/memory.h | 5 ++ arch/arm/kernel/Makefile | 4 +- arch/arm/kernel/compat.c | 7 --- arch/arm/kernel/compat.h | 2 - arch/arm/kernel/head.S | 31 +++++++++--- arch/arm/kernel/setup.c | 21 ++++++++- 13 files changed, 138 insertions(+), 84 deletions(-) delete mode 100644 arch/arm/boot/compressed/Makefile.debug
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 arm: remove bit-rotten STANDALONE_DEBUG for decompressor
I tried to get this running to debug the regression introduced by e7db7b4 without success. But this has several problems that make it hard to fix:
- lib/decompress_inflate.c includes in-kernel headers that make it difficult to compile for user space.
- the binary formats changed both in kernel and user space and at least for the kernel side there isn't only a single variant.
--- arch/arm/boot/compressed/Makefile.debug | 23 ----------------------- arch/arm/boot/compressed/misc.c | 27 --------------------------- 2 files changed, 0 insertions(+), 50 deletions(-) delete mode 100644 arch/arm/boot/compressed/Makefile.debug
arch/arm/boot/compressed/Makefile.debug deleted +0 -23
@@ -1,23 +0,0 @@ -# -# linux/arch/arm/boot/compressed/Makefile -# -# create a compressed vmlinux image from the original vmlinux -# - -COMPRESSED_EXTRA=../../lib/ll_char_wr.o -OBJECTS=misc-debug.o ll_char_wr.aout.o - -CFLAGS=-D__KERNEL__ -O2 -DSTDC_HEADERS -DSTANDALONE_DEBUG -Wall -I../../../../include -c - -test-gzip: piggy.aout.o $(OBJECTS) - $(CC) -o $@ $(OBJECTS) piggy.aout.o - -misc-debug.o: misc.c - $(CC) $(CFLAGS) -o $@ misc.c - -piggy.aout.o: piggy.o - arm-linuxelf-objcopy --change-leading-char -I elf32-arm -O arm-aout32-linux piggy.o piggy.aout.o - -ll_char_wr.aout.o: $(COMPRESSED_EXTRA) - arm-linuxelf-objcopy --change-leading-char -I elf32-arm -O arm-aout32-linux $(COMPRESSED_EXTRA) ll_char_wr.aout.o -
arch/arm/boot/compressed/misc.c +0 -27
@@ -28,10 +28,6 @@ unsigned int __machine_arch_type;#include <asm/unaligned.h> -#ifdef STANDALONE_DEBUG -#define putstr printf -#else -static void putstr (const char *ptr);#include <mach/uncompress.h>
@@ -115,8 +111,6 @@ static void putstr(const char *ptr)flush (); } -#endif -#define __ptr_t void *#define memzero (s,n) __memzero(s,n)
@@ -238,10 +232,6 @@ static void putstr(const char *);static unsigned long free_mem_ptr;static unsigned long free_mem_end_ptr; -#ifdef STANDALONE_DEBUG -#define NO_INFLATE_MALLOC -#endif -#define ARCH_HAS_DECOMP_WDOG #ifdef CONFIG_KERNEL_GZIP
@@ -272,8 +262,6 @@ asmlinkage void __div0(void)error ("Attempting division by 0!" ); } -#ifndef STANDALONE_DEBUG - unsigned long decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, unsigned long free_mem_ptr_end_p,
@@ -297,18 +285,3 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,putstr (" done, booting the kernel.\n" );return output_ptr; } -#else - -char output_buffer[1500 *1024 ]; - -int main () -{ - output_data = output_buffer; - -putstr ("Uncompressing Linux..." ); -decompress (input_data, input_data_end - input_data, -NULL ,NULL , output_data,NULL , error); -putstr ("done.\n" ); -return 0 ; -} -#endif
Signature · 1 line
1.6.6
[PULL REQUEST] runtime physoffset [Was: change boot requirements]
In reply to Uwe Kleine-KönigHello Russell,
Quoted 11 lines · Uwe Kleine-K?nig
Quoted 7 lines
The following changes since commit
499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' ofgit://git.kernel.org/.../dtor/inputare available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.gitarm/bootingCan you please pull this branch for the .34 merge window? Since the last post one new patch was added to that branch. I'll send it in reply to this mail.
Do you consider pulling? If not, can you please say why?
Best regards
Uwe
Quoted 35 lines
The following changes since commit
499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' ofgit://git.kernel.org/.../dtor/inputare available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.gitarm/bootingUwe Kleine-K?nig (10):
zImage: fix comments forcache_on,cache_offandcache_clean_flush
zImage: some comments for__armv3_mpu_cache_on
zImage:__armv3_mpu_cache_flush: respect should-be-zero specification
zImage: annotate debug functions about corrupted registers
zImage: don't define unused symbolinitrd_phys
arm: deprecate support for old way to pass kernel parameters
zImage: don't hard code the stack size twice
uImage: require passing a LOADADDR when building withRUNTIME_PHYSOFFSETAllowPHYS_OFFSETto be runtime determined
arm: remove bit-rottenSTANDALONE_DEBUGfor decompressorDocumentation/arm/Booting | 1 + arch/arm/Kconfig | 9 ++++ arch/arm/boot/Makefile | 6 ++- arch/arm/boot/compressed/Makefile | 10 ++--- arch/arm/boot/compressed/Makefile.debug | 23 --------- arch/arm/boot/compressed/head.S | 76 +++++++++++++++++++++++++++--- arch/arm/boot/compressed/misc.c | 27 ----------- arch/arm/include/asm/memory.h | 5 ++ arch/arm/kernel/Makefile | 4 +- arch/arm/kernel/compat.c | 7 --- arch/arm/kernel/compat.h | 2 - arch/arm/kernel/head.S | 31 +++++++++--- arch/arm/kernel/setup.c | 21 ++++++++- 13 files changed, 138 insertions(+), 84 deletions(-) delete mode 100644 arch/arm/boot/compressed/Makefile.debug
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
[PULL REQUEST] runtime physoffset [Was: change boot requirements]
Quoted 11 lines · Uwe Kleine-K?nig
Hello Russell,
Quoted 8 lines · Uwe Kleine-K?nig
Quoted 7 lines
The following changes since commit
499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' ofgit://git.kernel.org/.../dtor/inputare available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.gitarm/booting
Quoted 7 lines
Quoted 3 lines
Can you please pull this branch for the .34 merge window? Since the last post one new patch was added to that branch. I'll send it in reply to this mail.
Do you consider pulling? If not, can you please say why?
Best regards
Uwe
Bumping up this thread since these patches are necessary to reach our eventual goal of a common kernel.
Russell, any feedback on this set?
/Amit
Quoted 44 lines
Quoted 35 lines
The following changes since commit
499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' ofgit://git.kernel.org/.../dtor/inputare available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.gitarm/bootingUwe Kleine-K?nig (10):
zImage: fix comments forcache_on,cache_offandcache_clean_flush
zImage: some comments for__armv3_mpu_cache_on
zImage:__armv3_mpu_cache_flush: respect should-be-zero specification
zImage: annotate debug functions about corrupted registers
zImage: don't define unused symbolinitrd_phys
arm: deprecate support for old way to pass kernel parameters
zImage: don't hard code the stack size twice
uImage: require passing a LOADADDR when building withRUNTIME_PHYSOFFSETAllowPHYS_OFFSETto be runtime determined
arm: remove bit-rottenSTANDALONE_DEBUGfor decompressorDocumentation/arm/Booting | 1 + arch/arm/Kconfig | 9 ++++ arch/arm/boot/Makefile | 6 ++- arch/arm/boot/compressed/Makefile | 10 ++--- arch/arm/boot/compressed/Makefile.debug | 23 --------- arch/arm/boot/compressed/head.S | 76 +++++++++++++++++++++++++++--- arch/arm/boot/compressed/misc.c | 27 ----------- arch/arm/include/asm/memory.h | 5 ++ arch/arm/kernel/Makefile | 4 +- arch/arm/kernel/compat.c | 7 --- arch/arm/kernel/compat.h | 2 - arch/arm/kernel/head.S | 31 +++++++++--- arch/arm/kernel/setup.c | 21 ++++++++- 13 files changed, 138 insertions(+), 84 deletions(-) delete mode 100644 arch/arm/boot/compressed/Makefile.debugSignature · 7 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
------------------------------------------------------------------------- Amit Kucheria, Kernel Developer, Verdurent -------------------------------------------------------------------------
[PULL REQUEST] runtime physoffset [Was: change boot requirements]
Hello,
Quoted 15 lines · Amit Kucheria
Quoted 14 lines · Uwe Kleine-K?nig
Hello Russell,
Quoted 11 lines · Uwe Kleine-K?nig
Quoted 7 lines
The following changes since commit
499a2673713c85734a54c37dd90b4b729de399c4:
Linus Torvalds (1):
Merge branch 'for-linus' ofgit://git.kernel.org/.../dtor/inputare available in the git repository at:
git://git.pengutronix.de/git/ukl/linux-2.6.gitarm/bootingCan you please pull this branch for the .34 merge window? Since the last post one new patch was added to that branch. I'll send it in reply to this mail.
Quoted 7 lines
Quoted 4 lines
Do you consider pulling? If not, can you please say why?
Best regards
UweBumping up this thread since these patches are necessary to reach our eventual goal of a common kernel.
Actually the patches in arm/booting are only some cleanups. This series contained in arm/booting doesn't contain the two runtime physoffset patches[1]
Russell?
Best regards
Uwe
[1] these are in my arm/booting-pu branch
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |