Quantcast
Channel: Linux Device Hacking - uBoot
Viewing all articles
Browse latest Browse all 903

Can't write uboot env after upgrade to Debian Buster (1 reply)

$
0
0
I have a strange issue since upgrading to Debian Buster... The MTD setup by the kernel is messed up. It doesn't match the definition passed by uboot from the command line. And the partitions are set as RO. Therefore, it's impossible to use fw_printenv anymore to configure the bootloader form the OS.

I confirmed the discrepency going from Debian Stretch (9) with the official debian kernel package "linux-image-marvell" to Debian Buster (10) with the same updated official kernel package.

I have the same issue both with my dockstars and goflexnets (of course loaded with the corresponding dtb file).


Here's the initial uboot output which is identical wether I boot to Stretch or to Buster:

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:17:19 -0700)
Seagate GoFlex Net

SoC:   Kirkwood 88F6281_A1
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  0
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
*** Unhandled DHCP Option in OFFER/ACK: 42
*** Unhandled DHCP Option in OFFER/ACK: 42
DHCP client bound to address 192.168.1.14 (3921 ms)

** Getting IP Settings by DHCP (net_dhcp_c = 1):
** IP Address: 192.168.1.14
** Subnet Mask: 255.255.255.0
** Def Gateway: 192.168.1.254

** Getting NFS Boot Server by DHCP (net_dhcp_s and net_dhcp_c = 1):
** NFS Boot Server: 192.168.1.1

** Kernel Boot Arguments:
** console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=192.168.1.1:/srv/nfs/hosts/goflex-263BA8/,rsize=32768,wsize=32768,hard,intr,udp,v3 ip=192.168.1.14:192.168.1.1:192.168.1.254:255.255.255.0:dockstar:eth0:off mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)

NFS loading uImage :192.168.1.1:/srv/nfs/hosts/goflex-263BA8/boot/uImage ...
done
Bytes transferred = 2043544 (1f2e98 hex)

NFS loading uInitrd :192.168.1.1:/srv/nfs/hosts/goflex-263BA8/boot/uInitrd ...
done
Bytes transferred = 14739343 (e0e78f hex)

NFS loading DTB :192.168.1.1:/srv/nfs/hosts/goflex-263BA8/boot/dts/kirkwood-goflexnet.dtb ...
###
done
Bytes transferred = 11397 (2c85 hex)

## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-4.19.0-5-marvell
   Created:      2019-07-27  19:14:38 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2043480 Bytes = 1.9 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-4.19.0-5-marvell
   Created:      2019-07-27  19:14:38 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    14739279 Bytes = 14.1 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02000000
   Booting using the fdt blob at 0x2000000
   Loading Kernel Image ... OK
   Loading Ramdisk to 06cff000, end 07b0d74f ... OK
   Loading Device Tree to 06cf9000, end 06cfec84 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.0-5-marvell (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-7)) #1 Debian 4.19.37-5 (2019-06-19)

uboot config and kernel cmdline (Debian version independant) :
# fw_printenv
arcNumber=3089
autoload=no
bootargs=console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=192.168.1.1:/srv/nfs/hosts/dockstar/,rsize=32768,wsize=32768,hard,intr,udp,v3 ip=192.168.1.14:192.168.1.1:192.168.1.254:255.255.255.0:dockstar:eth0:off mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
bootcmd=run net_bootcmd
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_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=3
bootdev=usb
bootfile=gpxelinux.0
console=ttyS0,115200
def_bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dnsip=192.168.1.254
dtb_file=/boot/dts/kirkwood-goflexnet.dtb
ethact=egiga0
ethaddr=00:10:75:26:3B:A8
gatewayip=192.168.1.254
hostname=Goflex-Test
if_netconsole=ping $serverip
ipaddr=192.168.1.14
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=0x02000000
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
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
net_bootcmd=run net_check_dhcp_c; run net_check_dhcp_s; run net_set_bootargs; run net_bootcmd_exec
net_bootcmd_exec=run net_load_uimage; if run net_load_initrd; then if run net_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
net_check_dhcp_c=if test $net_dhcp_c -eq 1 ; then run net_set_c_ip_dhcp; else run net_set_c_ip_stat; fi;echo ** IP Address:  $ipaddr; echo ** Subnet Mask: $netmask; echo ** Def Gateway: $gatewayip
net_check_dhcp_s=if test $net_dhcp_s -eq 1 && test $net_dhcp_c -eq 1 ; then run net_set_s_ip_dhcp; else run net_set_s_ip_stat; fi; echo ** NFS Boot Server: $net_nfs_server; echo
net_dhcp_c=1
net_dhcp_s=1
net_load_dtb=echo NFS loading DTB     :$net_nfs_server:$net_nfs_path/$net_nfs_dtb ...   ; nfs $load_dtb_addr    $net_nfs_server:$net_nfs_path/$net_nfs_dtb; echo
net_load_initrd=echo NFS loading uInitrd :$net_nfs_server:$net_nfs_path/$net_nfs_initrd ...; nfs $load_initrd_addr $net_nfs_server:$net_nfs_path/$net_nfs_initrd; echo
net_load_uimage=echo NFS loading uImage  :$net_nfs_server:$net_nfs_path/$net_nfs_kernel ...; nfs $load_uimage_addr $net_nfs_server:$net_nfs_path/$net_nfs_kernel; echo
net_nfs_dtb=boot/dts/kirkwood-goflexnet.dtb
net_nfs_initrd=boot/uInitrd
net_nfs_kernel=boot/uImage
net_nfs_path=/srv/nfs/hosts/goflex-263BA8
net_nfs_server=192.168.1.1
net_set_bootargs=setenv serverip $net_nfs_server; setenv bootargs console=$console root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=$net_nfs_server:$net_nfs_path/,rsize=32768,wsize=32768,hard,intr,udp,v3 ip=$ipaddr:$net_nfs_server:$gatewayip:$netmask:dockstar:eth0:off $mtdparts $custom_params; echo ** Kernel Boot Arguments:; echo ** $bootargs; echo
net_set_c_ip_dhcp=dhcp; echo; echo ** Getting IP Settings by DHCP (net_dhcp_c = 1):
net_set_c_ip_stat=setenv ipaddr $net_c_ipaddr; setenv netmask $net_c_netmask; setenv gatewayip $net_c_gatewayip; echo; echo ** Using static IP Settings (net_dhcp_c = 0):
net_set_s_ip_dhcp=setenv net_nfs_server $serverip;echo; echo ** Getting NFS Boot Server by DHCP (net_dhcp_s and net_dhcp_c = 1):
net_set_s_ip_stat=echo; echo ** Using static NFS Boot Server (net_dhcp_s or net_dhcp_c = 0) :
netmask=255.255.255.0
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
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=192.168.1.1
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
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

# cat /proc/cmdline
console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=192.168.1.1:/srv/nfs/hosts/goflex-263BA8/,rsize=32768,wsize=32768,hard,intr,udp,v3 ip=192.168.1.14:192.168.1.1:192.168.1.254:255.255.255.0:dockstar:eth0:off mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)

# cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid; in this case the redundant
# environment sector is assumed present.
# Note that "Number of sectors" is ignored on NOR.

# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mtd0               0xc0000         0x20000         0x20000

Expected behavior as visible in Debian Stetch:

# cat /etc/debian_version
9.9

# uname -a
Linux dockstar 4.9.0-9-marvell #1 Debian 4.9.168-1 (2019-04-12) armv5tel GNU/Linux

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

# dmesg | grep -e mtd -e boot -e 0x000
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=192.168.1.1:/srv/nfs/hosts/goflex-263BA8/,rsize=32768,wsize=32768,hard,intr,udp,v3 ip=192.168.1.14:192.168.1.1:192.168.1.254:255.255.255.0:dockstar:eth0:off mtdparts=orion_nand:1M(u-boo ),4M(uImage),32M(rootfs),-(data)
[    1.914595] 0x000000000000-0x000000100000 : "u-boot"
[    1.920794] 0x000000100000-0x000000500000 : "uImage"
[    1.926926] 0x000000500000-0x000002500000 : "rootfs"
[    1.933162] 0x000002500000-0x000010000000 : "data"

# ls -l /dev/mtd*
crw------- 1 root root 90, 0 2019-08-03 18:30 /dev/mtd0
crw------- 1 root root 90, 1 2019-08-03 18:30 /dev/mtd0ro
crw------- 1 root root 90, 2 2019-08-03 18:30 /dev/mtd1
crw------- 1 root root 90, 3 2019-08-03 18:30 /dev/mtd1ro
crw------- 1 root root 90, 4 2019-08-03 18:30 /dev/mtd2
crw------- 1 root root 90, 5 2019-08-03 18:30 /dev/mtd2ro
crw------- 1 root root 90, 6 2019-08-03 18:30 /dev/mtd3
crw------- 1 root root 90, 7 2019-08-03 18:30 /dev/mtd3ro
brw-rw---- 1 root disk 31, 0 2019-08-03 18:30 /dev/mtdblock0
brw-rw---- 1 root disk 31, 1 2019-08-03 18:30 /dev/mtdblock1
brw-rw---- 1 root disk 31, 2 2019-08-03 18:30 /dev/mtdblock2
brw-rw---- 1 root disk 31, 3 2019-08-03 18:30 /dev/mtdblock3


# fw_setenv test 1

# fw_printenv | grep test=
test=1

#


Observed issue in Debian Buster:
# cat /etc/debian_version
10.0

# uname -a
Linux goflexnet 4.19.0-5-marvell #1 Debian 4.19.37-5 (2019-06-19) armv5tel GNU/Linux

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "pogoplug"
mtd3: 0d800000 00020000 "root"

# dmesg | grep -e mtd -e boot -e 0x000
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=192.168.1.1:/srv/nfs/hosts/goflex-263BA8/,rsize=32768,wsize=32768,hard,intr,udp,v3 ip=192.168.1.14:192.168.1.1:192.168.1.254:255.255.255.0:dockstar:eth0:off mtdparts=orion_nand:1M(u-boo ),4M(uImage),32M(rootfs),-(data)
[   20.049178] 0x000000000000-0x000000100000 : "u-boot"
[   20.070147] 0x000000100000-0x000000500000 : "uImage"
[   20.104547] 0x000000500000-0x000002500000 : "pogoplug"
[   20.138798] 0x000002500000-0x00000fd00000 : "root"

# ls -l /dev/mtd*
crw------- 1 root root 90, 0 2019-08-03 16:10 /dev/mtd0
crw------- 1 root root 90, 1 2019-08-03 16:10 /dev/mtd0ro
crw------- 1 root root 90, 2 2019-08-03 16:10 /dev/mtd1
crw------- 1 root root 90, 3 2019-08-03 16:10 /dev/mtd1ro
crw------- 1 root root 90, 4 2019-08-03 16:10 /dev/mtd2
crw------- 1 root root 90, 5 2019-08-03 16:10 /dev/mtd2ro
crw------- 1 root root 90, 6 2019-08-03 16:10 /dev/mtd3
crw------- 1 root root 90, 7 2019-08-03 16:10 /dev/mtd3ro

# fw_setenv test 2
Can't open /dev/mtd0: Permission denied
Error: can't write fw_env to flash

# fw_printenv | grep test=
test=1

#

I can't help but think it's a bug in the official kernel package... but I'd like a second opinion on this :)

Viewing all articles
Browse latest Browse all 903

Latest Images

Trending Articles



Latest Images