ARM: dts: kzm9g: Extend DTS with hints on how to build
From: Magnus Damm <[email protected]>
Include hints in the DTS for KZM9G on how to build a kernel that may be booted using the old on-board boot loader. Special handling includes:
- The DTB needs to be appended to the zImage before generating the uImage
- LOADADDR needs to be set to 0x48008000 to be able to generate an uImage
- CONFIG_ATAGS=n is needed for the board to boot
Perhaps there is a better place where this kind of information should be placed? Many years ago the LOADADDR information used to be part of the kernel makefiles (and make uImage just worked out of the box) but when going DTS and zImage this seems to have been dropped. So these days special care is needed to build a uImage file which is required by the boot loader.
---
arch/arm/boot/dts/sh73a0-kzm9g.dts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sh73a0-kzm9g.dts +17 -2
@@ -2,9 +2,24 @@ /* * Device Tree Source for the KZM-A9-GT board * - * Copyright (C) 2012 Horms Solutions Ltd. + * The KZM9G board comes with on-board out-of-tree U-Boot from 2012 with: + * uImage support but without zImage support + * one way or the other busted ATAGs + * + * Generate an uImage at the correct load address with apppended DTB like this: + * make ARCH=arm CROSS_COMPILE=_ uImage LOADADDR=0x48008000 + * rm arch/arm/boot/zImage + * make ARCH=arm CROSS_COMPILE=_ dtbs zImage + * cat arch/arm/boot/dts/sh73a0-kzm9g.dtb >> arch/arm/boot/zImage + * $(cut -f 3- -d ' ' < arch/arm/boot/.uImage.cmd) + * + * For a working recent kernel (v5.10+) the following configuration is needed: + * CONFIG_ARM_APPENDED_DTB=y + * CONFIG_ATAGS=n * - * Based on sh73a0-kzm9g.dts + * The shmobile_defconfig works well after setting CONFIG_ATAGS=n + * + * Copyright (C) 2012 Horms Solutions Ltd. * Copyright (C) 2012 Renesas Solutions Corp. */
Hi Magnus,
Quoted 7 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Include hints in the DTS for KZM9G on how to build a kernel that may be booted using the old on-board boot loader. Special handling includes:
- The DTB needs to be appended to the zImage before generating the uImage
- LOADADDR needs to be set to0x48008000to be able to generate an uImage
-CONFIG_ATAGS=nis needed for the board to boot
Quoted 7 lines
Perhaps there is a better place where this kind of information should be placed? Many years ago the LOADADDR information used to be part of the kernel makefiles (and make uImage just worked out of the box) but when going DTS and zImage this seems to have been dropped. So these days special care is needed to build a uImage file which is required by the boot loader.
Not-Yet-Signed-off-by Magnus Damm <[email protected]>
Thanks for your patch!
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 6
Quoted 9 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +2
-1@@ -2,9 +2,24 @@ /* * Device Tree Source for the KZM-A9-GT board * - * Copyright (C) 2012 Horms Solutions Ltd. + * The KZM9G board comes with on-board out-of-tree U-Boot from 2012 with: + * uImage support but without zImage support
Funny, mine (which I never upgraded) has:
U-Boot 2013.01.-rc1 (Nov 15 2012 - 11:13:00)
and does boot zImage, with appended DTB.
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 9
Quoted 3 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +3
-0+ * one way or the other busted ATAGs + * + * Generate an uImage at the correct load address with apppended DTB like this:
appended
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 20
Quoted 12 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +10
-1+ * make ARCH=arm CROSS_COMPILE=_ uImage LOADADDR=0x48008000 + * rm arch/arm/boot/zImage + * make ARCH=arm CROSS_COMPILE=_ dtbs zImage + * cat arch/arm/boot/dts/sh73a0-kzm9g.dtb >> arch/arm/boot/zImage + * $(cut -f 3- -d ' ' < arch/arm/boot/.uImage.cmd) + * + * For a working recent kernel (v5.10+) the following configuration is needed: + * CONFIG_ARM_APPENDED_DTB=y + * CONFIG_ATAGS=n * - * Based on sh73a0-kzm9g.dts + * The shmobile_defconfig works well after setting CONFIG_ATAGS=n
Why CONFIG_ATAGS=n? I have CONFIG_ATAGS=y in my .config.
IIRC, shmobile_defconfig works, if I change CONFIG_CMDLINE to match what I need, as U-Boot cannot update chosen/cmdline in an appended DTB.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert,
Quoted 17 lines · Geert Uytterhoeven
Hi Magnus,
Quoted 13 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Include hints in the DTS for KZM9G on how to build a kernel that may be booted using the old on-board boot loader. Special handling includes:
- The DTB needs to be appended to the zImage before generating the uImage
- LOADADDR needs to be set to0x48008000to be able to generate an uImage
-CONFIG_ATAGS=nis needed for the board to bootPerhaps there is a better place where this kind of information should be placed? Many years ago the LOADADDR information used to be part of the kernel makefiles (and make uImage just worked out of the box) but when going DTS and zImage this seems to have been dropped. So these days special care is needed to build a uImage file which is required by the boot loader.
Quoted 3 lines
Quoted 1 line
Not-Yet-Signed-off-by Magnus Damm <[email protected]>Thanks for your patch!
Thanks for your review!
Quoted 12 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 6
Quoted 9 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +2
-1@@ -2,9 +2,24 @@ /* * Device Tree Source for the KZM-A9-GT board * - * Copyright (C) 2012 Horms Solutions Ltd. + * The KZM9G board comes with on-board out-of-tree U-Boot from 2012 with: + * uImage support but without zImage supportFunny, mine (which I never upgraded) has:
Quoted 3 lines
U-Boot 2013.01.-rc1 (Nov 15 2012 - 11:13:00)and does boot zImage, with appended DTB.
My board has serial number k0000019 and gives the following printout at boot:
U-Boot 2012.04.01-00384-g4398d55-dirty (June 05 2012 - 19:45:48)
This is also the original bootloader, but it might just happen to be an early development snapshot.
In the U-Boot git repo I notice the files and directory "configs/kzm9g/defconfig" and "board/kmc/kzm9g". Maybe those can be used to improve the situation.
Perhaps this is a good opportunity to hook up J-Link/ST-Link/Olimex to OpenOCD and update the boot loader?
Quoted 5 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 9
Quoted 3 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +3
-0+ * one way or the other busted ATAGs + * + * Generate an uImage at the correct load address with apppended DTB like this:appended
Indeed, thanks.
Quoted 13 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 20
Quoted 12 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +10
-1+ * make ARCH=arm CROSS_COMPILE=_ uImage LOADADDR=0x48008000 + * rm arch/arm/boot/zImage + * make ARCH=arm CROSS_COMPILE=_ dtbs zImage + * cat arch/arm/boot/dts/sh73a0-kzm9g.dtb >> arch/arm/boot/zImage + * $(cut -f 3- -d ' ' < arch/arm/boot/.uImage.cmd) + * + * For a working recent kernel (v5.10+) the following configuration is needed: + * CONFIG_ARM_APPENDED_DTB=y + * CONFIG_ATAGS=n * - * Based on sh73a0-kzm9g.dts + * The shmobile_defconfig works well after setting CONFIG_ATAGS=n
Quoted 1 line
Why
CONFIG_ATAGS=n? I haveCONFIG_ATAGS=yin my .config.
I tried various boot-related options to see if it would unbreak the situation. And deselecting ATAGS happened to fix the issue.
By the way, on this board it seems the bootloader environment comes without bootargs set.
Quoted 2 lines
IIRC,
shmobile_defconfigworks, if I changeCONFIG_CMDLINEto match what I need, as U-Boot cannot update chosen/cmdline in an appended DTB.
So I've locally modified .config from shmobile_defconfig default:CONFIG_CMDLINE=""
to:CONFIG_CMDLINE="ignore_loglevel" CONFIG_CMDLINE_FROM_BOOTLOADER=y
This also seems to fix the issue - thank you!
Related to ATAGS or not, on the console I get the following on v5.10:
[ 0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x4800000
This is similar to the output on from the old v3.18 kernel I happen to have around:
Ignoring memory range 0x41000000 - 0x48000000
Does the kzm9g boot all the way to user space for you? Perhaps my board is busted but I seem to get some oopses and freeze.
For anyone with an old bootloader, what do you think about documenting the LOADADDR and how to build an uImage?
Is there some way we can make the kernel boot out-of-the-box with shmobile_defconfig?
Cheers,
/ magnus
Hi Magnus,
Quoted 32 lines · Magnus Damm
Quoted 30 lines · Geert Uytterhoeven
Quoted 18 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Include hints in the DTS for KZM9G on how to build a kernel that may be booted using the old on-board boot loader. Special handling includes:
- The DTB needs to be appended to the zImage before generating the uImage
- LOADADDR needs to be set to0x48008000to be able to generate an uImage
-CONFIG_ATAGS=nis needed for the board to bootPerhaps there is a better place where this kind of information should be placed? Many years ago the LOADADDR information used to be part of the kernel makefiles (and make uImage just worked out of the box) but when going DTS and zImage this seems to have been dropped. So these days special care is needed to build a uImage file which is required by the boot loader.
Not-Yet-Signed-off-by Magnus Damm <[email protected]>arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 6
Quoted 6 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +2
-1@@ -2,9 +2,24 @@ /* * Device Tree Source for the KZM-A9-GT board * - * Copyright (C) 2012 Horms Solutions Ltd. + * The KZM9G board comes with on-board out-of-tree U-Boot from 2012 with: + * uImage support but without zImage supportFunny, mine (which I never upgraded) has:
U-Boot 2013.01.-rc1 (Nov 15 2012 - 11:13:00)
Quoted 8 lines
Quoted 1 line
and does boot zImage, with appended DTB.
My board has serial number k0000019 and gives the following printout at boot:
U-Boot 2012.04.01-00384-g4398d55-dirty (June 05 2012 - 19:45:48)
This is also the original bootloader, but it might just happen to be an early development snapshot.
Mine was used by Uli before. Perhaps he upgraded the boot loader?
Quoted 24 lines
Quoted 13 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 line 17
Quoted 12 lines
arch/arm/boot/dts/sh73a0-kzm9g.dts 2021-03-21 18:10:53.515741849 +0900 renamed from arch/arm/boot/dts/sh73a0-kzm9g.dts +10
-1+ * make ARCH=arm CROSS_COMPILE=_ uImage LOADADDR=0x48008000 + * rm arch/arm/boot/zImage + * make ARCH=arm CROSS_COMPILE=_ dtbs zImage + * cat arch/arm/boot/dts/sh73a0-kzm9g.dtb >> arch/arm/boot/zImage + * $(cut -f 3- -d ' ' < arch/arm/boot/.uImage.cmd) + * + * For a working recent kernel (v5.10+) the following configuration is needed: + * CONFIG_ARM_APPENDED_DTB=y + * CONFIG_ATAGS=n * - * Based on sh73a0-kzm9g.dts + * The shmobile_defconfig works well after setting CONFIG_ATAGS=nQuoted 1 line
Why
CONFIG_ATAGS=n? I haveCONFIG_ATAGS=yin my .config.I tried various boot-related options to see if it would unbreak the situation. And deselecting ATAGS happened to fix the issue.
By the way, on this board it seems the bootloader environment comes without bootargs set.
Quoted 2 lines
IIRC,
shmobile_defconfigworks, if I changeCONFIG_CMDLINEto match what I need, as U-Boot cannot update chosen/cmdline in an appended DTB.
Quoted 7 lines
So I've locally modified .config from
shmobile_defconfigdefault:CONFIG_CMDLINE=""
to:CONFIG_CMDLINE="ignore_loglevel"CONFIG_CMDLINE_FROM_BOOTLOADER=yThis also seems to fix the issue - thank you!
I just realized that for passing the kernel command line to an appended DTB, you need CONFIG_ARM_ATAG_DTB_COMPAT=y, too. Unfortunately that doesn't seem to help: the kernel doesn't boot (no output, haven't tried DEBUG_LL).
However, ever plain shmobile_defconfig seems to be very flaky on
kzm9g: the kernel locks up in the middle of the boot.
Quoted 6 lines
Related to ATAGS or not, on the console I get the following on v5.10:
[ 0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x4800000This is similar to the output on from the old v3.18 kernel I happen to have around:
Ignoring memory range0x41000000-0x48000000
That's normal, you cannot use memory below the kernel load address.
Quoted 2 lines
Does the kzm9g boot all the way to user space for you? Perhaps my board is busted but I seem to get some oopses and freeze.
My own kernel works well (I test it after each renesas-drivers release), albeit with an "irq nobody cared" warning (which has been there forever, and might explain the lock-up). I've sent its config by PM. Other known issues on kzm9g are that secondary CPU bringup is a bit unreliable, especially during resume from s2ram, and that switching to DT-based l2c-310 would break secondary CPU bringup completely (still the case last time I tried).
Quoted 2 lines
For anyone with an old bootloader, what do you think about documenting the LOADADDR and how to build an uImage?
https://elinux.org/R-Mobile/Boards/KZM-A9-GT
Feel free to update!
Quoted 2 lines
Is there some way we can make the kernel boot out-of-the-box with
shmobile_defconfig?
Upgrade to a modern U-Boot, everywhere?
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds