Welcome! Log In Create A New Profile

Advanced

Question about load addresses for Linux Kernel 5.18.6 Kirkwood

Posted by jst818 
Question about load addresses for Linux Kernel 5.18.6 Kirkwood
August 14, 2022 12:41PM
I want to install latest kernel (Linux Kernel 5.18.6 Kirkwood; Updated Jun 25 Apr 2022:) and saw your red note about uInitrd size (Step 5).
Current version: Linux 5.17.4-kirkwood-tld-1 #1.0 PREEMPT Mon Apr 25 19:49:57 PDT 2022 armv5tel GNU/Linux
Device: pogo e02
uboot version is latest (U-Boot 2017.07-tld-1)
strings /dev/mtd0 | grep U-Boot
U-Boot BUG at %s:%d!
** Invalid partition type "%.32s" (expect "U-Boot")
U-Boot.arm
MU-Boot EFI: Relocation at %p is out of range (%lx)
U-Boot
UBIFS: only ro mode in U-Boot allowed.
U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:13:18 -0700)




uInitrd size: 10419883 (bytes) (10.175 MB)
cd /boot
ll
-rw-r--r--  1 root root  5022972 Feb  6  2022 System.map-5.16.5-kirkwood-tld-1
-rw-r--r--  1 root root  5066720 Apr 26 04:49 System.map-5.17.4-kirkwood-tld-1
-rw-r--r--  1 root root   186730 Feb  6  2022 config-5.16.5-kirkwood-tld-1
-rw-r--r--  1 root root   187655 Apr 26 04:49 config-5.17.4-kirkwood-tld-1
drwxr-xr-x  2 root root     4096 Mar 26 06:17 dts
-rw-r--r--  1 root root 10424866 Apr  7 18:46 initrd.img-5.16.5-kirkwood-tld-1
-rw-r--r--  1 root root 10421573 Aug 14 19:15 initrd.img-5.17.4-kirkwood-tld-1
-rw-r--r--  1 root root  5702912 May  1 18:03 uImage
-rw-r--r--  1 root root 10419883 May  1 18:03 uInitrd
-rwxr-xr-x  1 root root  5668936 Feb  6  2022 vmlinuz-5.16.5-kirkwood-tld-1
-rwxr-xr-x  1 root root  5702848 Apr 26 04:49 vmlinuz-5.17.4-kirkwood-tld-1



cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "rootfs"
mtd3: 05b00000 00020000 "data"

dmesg | grep -i bad
[    5.100590] Scanning device for bad blocks
[    5.200516] Bad eraseblock 892 at 0x000006f80000
[    5.212636] Bad eraseblock 956 at 0x000007780000



fw_printenv shows following:
load_dtb_addr=0x1c00000


full output
arcNumber=3542
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_rescue
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd_pogo=run bootcmd_rescue
bootcmd_rescue=run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-pogo_e02.dtb
ethact=egiga0
ethaddr=XX:XX:XX:XX:XX:XX
if_netconsole=ping $serverip
ipaddr=XX.XX.XX.XX
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
machid=dd6
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
preboot=run preboot_nc
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
rescue_installed=1
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=XX.XX.XX.XX
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
set_bootargs_rescue=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15


Should i adjust load_dtb_addr to 0x2c00000 ?


Are there any other "hardcoded" values, that need to be adjusted for successful boot in near future versions of linux kernel?



Edited 4 time(s). Last edit at 08/14/2022 03:39PM by bodhi.
Re: Question about load addresses for Linux Kernel 5.18.6 Kirkwood
August 14, 2022 03:58PM
> Should i adjust load_dtb_addr to 0x2c00000 ?

You could do that now.

> Are there any other "hardcoded" values, that need
> to be adjusted for successful boot in near future
> versions of linux kernel?

These 3 load addresses:
load_dtb_addr=0x2c00000  # might need to be adjusted
load_initrd_addr=0x1100000 # might need to be adjusted
load_uimage_addr=0x800000  # don't need to be adjusted

Note that these are temporary RAM locations. So as long as the images fit into these regions, it will be OK. It a simple math caculation to see if they will fit. The 2017 U-Boot will relocate them to appropriate locations.

But if you are booting a Kirkwood box with stock u-boot, the load addresses are different (depending on the specifics of that stock u-boot version).

I'm still debating with myself whether I need to release new u-boot for Kirkwood, or just release new envs image for the 2017.07-tld-x u-boots.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Question about load addresses for Linux Kernel 5.18.6 Kirkwood
August 21, 2022 11:54AM
Done.
Everything seems to be working fine !

new uInitrd size:10421839 B (10.177 MB).
I guess it would work without "load_dtb_addr" adjustment ;).

Thanks for help
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: