Welcome! Log In Create A New Profile

Advanced

Updating Pogoplug V4 u-boot from Arch u-boot

Posted by kt97679 
Updating Pogoplug V4 u-boot from Arch u-boot
October 21, 2017 05:30PM
Hello,

I have pogo plug v4 a3-01. Some time ago I used information from https://archlinuxarm.org/platforms/armv5/pogoplug-series-4 and installed arch linux on this device. Recently I downloaded latest debian image from https://forum.doozan.com/read.php?2,12096 and was able to successfuly boot it with old u-boot. Now I want to update u-boot and I see that output of cat /proc/mtd differes from what is shown in guidelines:

dev:    size   erasesize  name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00300000 00020000 "uImage"
mtd2: 00300000 00020000 "uImage2"
mtd3: 00800000 00020000 "failsafe"
mtd4: 07000000 00020000 "root"


Please let me know if I can proceed with installation per guidelines or I need to do something additionally.

Thanks,
Kirill.

PS I read this thread: https://forum.doozan.com/read.php?3,29504,29578 but it is year old so I'm not sure if it is still applicable.



Edited 3 time(s). Last edit at 10/21/2017 09:04PM by bodhi.
Re: Updating Pogoplug V4 u-boot from Arch u-boot
October 21, 2017 09:08PM
kt97679,

>. Now I
> want to update u-boot and I see that output of cat
> /proc/mtd differes from what is shown in
> guidelines:
>
>
> dev:    size   erasesize  name
> mtd0: 00200000 00020000 "u-boot"
> mtd1: 00300000 00020000 "uImage"
> mtd2: 00300000 00020000 "uImage2"
> mtd3: 00800000 00020000 "failsafe"
> mtd4: 07000000 00020000 "root"
>

That looks OK. Go ahead and install new u-boot:
https://forum.doozan.com/read.php?3,12381

The mtd partition definition is different for the Pogo V4, but that can be taken care of later after you have booted back into Debian with new u-boot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Updating Pogoplug V4 u-boot from Arch u-boot
October 22, 2017 04:42PM
Thank you very much for the quick response Bodhi. Currently I have DTB file appended to the kernel. Per guidelines I need to clear dtb_file:

fw_setenv dtb_file

May I ask you to clarify what is preferred: to use kernel with the appended DTB or not? What will happen if there will be mismatch between kernel and dtb_file setting?

Thanks,
Kirill.
Re: Updating Pogoplug V4 u-boot from Arch u-boot
October 22, 2017 05:02PM
Kirill,

Quote

> Per guidelines I need to clear dtb_file:
>
>
> fw_setenv dtb_file
> 

That's correct, to boot with DTB appended to uImage.


After you've installed new u-boot and its default envs, you can boot either way. The best way is with separate DTB. This give us the most flexible configuration. IOW, you could replace the DTB with a better one offline easily. And one rootfs such as one I've released can boot all Kirkwood boxes (Kirkwood DTB files are presented in /boot/dts)

As long as you don't append the DTB to uImage, and specify the DTB path in u-boot envs, the kernel will pick up that DTB and boot correctly.

If you have the DTB embedded inside uImage, and also specify the separate DTB path using the env dtb_file, the kernel will start booting and then stop. It will not complete booting.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 10/22/2017 05:03PM by bodhi.
Re: Updating Pogoplug V4 u-boot from Arch u-boot
October 22, 2017 05:44PM
Thanks a lot for the clarifications Bodhi! Based on the guidelines I've created following script for the u-boot update, may I ask you to have a quick look? More questions after reading guidelines and writing this script:

I don't have mtdparts in the environment, what I should use for the value?
My current environment is very different from the default environment I'm going to write, is this a concern?
In current environment ethaddr is set to 00:00:11:22:33:44, though ifconfig shows 00:25:31:05:eb:0a. What value should I use?
Should I use dtb_file in the uEnv.txt or it will conflict with the value set via fw_setenv?
Do you think uEnv.txt looks reasonable? I'm going to boot from usb only and I don't have other disks.

#!/bin/bash

set -u -e

flash_erase=echo
nandwrite=echo
fw_setenv=echo
nanddump=echo

netconsole_client_ip=192.168.1.139
netconsole_server_ip=192.168.1.100

uenv_txt=/tmp/uEnv.txt
#uenv_txt=/boot/uEnv.txt

read_keyboard() {
    read -p "Continue (y/n)? "
    [ "$REPLY" != "y" ] && exit 1
    return 0
}

echo "Checking /etc/fw_env.config"
set -- $(grep -v ^# /etc/fw_env.config)
[ "$1" != /dev/mtd0 ] && exit 1
[ "$2" != 0xc0000 ] && exit 1
[ "$3" != 0x20000 ] && exit 1
[ "$4" != 0x20000 ] && exit 1

echo "Checking ethaddr"
ethaddr=$(fw_printenv ethaddr|cut -f2 -d=)
[ -z "$ethaddr" ] && exit 1

echo "Dumping /dev/mtd0"
$nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0

echo "Saving current env"
fw_printenv > current_envs.txt

echo "Checking for bad blocks"
[ $(dmesg | grep -c -i 'bad') != 1 ] && exit 1

cat <<MSG
Erasing /dev/mtd0, expected output:
Erase Total 4 Units
Performing Flash Erase of length 131072 at offset 0x60000 done
Actual output:
MSG
$flash_erase /dev/mtd0 0 4
read_keyboard

cat <<MSG
Writing /dev/mtd0, expected output:
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
Actual output:
MSG
$nandwrite /dev/mtd0 uboot.2016.05-tld-1.pogo_v4.mtd0.kwb
read_keyboard

cat <<MSG
Erasing /dev/mtd0, expected output:
Erase Total 1 Units
Performing Flash Erase of length 131072 at offset 0xc0000 done
Actual output:
MSG
$flash_erase /dev/mtd0 0xc0000 1
read_keyboard

cat <<MSG
Writing /dev/mtd0, expected output:
Writing data to block 6 at offset 0xc0000
Actual output:
MSG
$nandwrite -s 786432 /dev/mtd0 uboot.2016.05-tld-1.environment.img
read_keyboard

echo "Modifying environment"
$fw_setenv arcNumber 3960
$fw_setenv machid f78
# TODO I don't have mtdparts
$fw_setenv mtdparts 'xxxxxxxxx'
$fw_setenv ethaddr $ethaddr
$fw_setenv dtb_file '/boot/dts/kirkwood-pogoplug_v4.dtb'

echo "!!! Please check environment below !!!"
fw_printenv
read_keyboard

echo "Configuring netconsole"
$fw_setenv 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'
$fw_setenv preboot 'run preboot_nc'
$fw_setenv ipaddr $netconsole_client_ip
$fw_setenv serverip $netconsole_server_ip

# TODO Will dtb_file in the uEnv.txt conflict with dtb_file set via fw_setenv?
echo "Creating $uenv_txt"
cat >$uenv_txt <<UENV
dtb_file=/boot/dts/kirkwood-pogoplug_v4.dtb
devices=usb
UENV



Edited 2 time(s). Last edit at 10/22/2017 05:53PM by kt97679.
Re: Updating Pogoplug V4 u-boot from Arch u-boot
October 23, 2017 12:05AM
> I don't have mtdparts in the environment, what I
> should use for the value?

For the Pogo V4 and Pogo Mobile:
fw_setenv mtdparts 'mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)'


> My current environment is very different from the
> default environment I'm going to write, is this a
> concern?
> In current environment ethaddr is set to
> 00:00:11:22:33:44, though ifconfig shows
> 00:25:31:05:eb:0a. What value should I use?

When in doubt, look at the box bottom, or the retail box label. The real MAC address should be there.

> Should I use dtb_file in the uEnv.txt or it will
> conflict with the value set via fw_setenv?
> Do you think uEnv.txt looks reasonable? I'm going
> to boot from usb only and I don't have other
> disks.
>

The dtb_file in u-boot envs is used, if there is no dtb_file variable in the uEnv.txt. The variable in uEnv.txt will overwrite the exisiting one in RAM (without saving to NAND).

> echo "Checking for bad blocks"
> [ $(dmesg | grep -c -i 'bad') != 1 ] && exit 1
>

The check above will not work. The bad block number will appear after the text. And not all bad blocks are relevant, only block 0 to 7 are relevant to u-boot for this box.

For example, this is OK:

dmesg | grep -i bad
[    5.976998] Scanning device for bad blocks
[    5.985954] Bad eraseblock 100 at 0x000000c80000
[    5.995373] Bad eraseblock 200 at 0x000001900000

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 10/26/2017 04:38AM by bodhi.
Re: Updating Pogoplug V4 u-boot from Arch u-boot
October 25, 2017 08:31PM
Hi Bodhi,

thanks a bunch for your help! I finally completed updating of the uboot today and everything worked ok.

Thanks,
Kirill.
Re: Updating Pogoplug V4 u-boot from Arch u-boot
October 25, 2017 11:10PM
kt97679 Wrote:
-------------------------------------------------------
> Hi Bodhi,
>
> thanks a bunch for your help! I finally completed
> updating of the uboot today and everything worked
> ok.
>
> Thanks,
> Kirill.

Cool! glad I can help.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: