Welcome! Log In Create A New Profile

Advanced

2024.10 U-Boot Kirkwood - TBS MOI+

Posted by bodhi 
2024.10 U-Boot Kirkwood - TBS MOI+
November 13, 2024 02:04PM
2024.10 U-Boot Kirkwood - TBS MOI+

This instruction is basically ready. Some TBDs that are not important will be completed later

=========================================
Update 13 Nov 2024

Download at Dropbox

I have not uploaded the tarball to Dropbox yet. For now, please download the tarball attached to this post.

uboot.2024.10-tld-1.moi_plus.bodhi.tar
sha256:
bb1b7ad85d2282b48e4d8199bb9b882b135dc550670f4f338d34b237c305cf1b  uboot.2024.10-tld-1.moi_plus.bodhi.tar

This tarball contains 3 files:
uboot.2024.10-tld-1.moi_plus.kwb
uboot.2024.10-tld-1.moi_plus.environment
uboot.2024.10-tld-1.moi_plus.environment.img

A. Preparation

A.1. UART booting

It is strongly recommmended that you try to run kwboot to test this boot image with UART booting before flashing to NAND. This is the rescue path when and if the flashing goes wrong for some reason. See example here. And to download latest ARM kwboot binary for UART booting see here.

A.2. Flashing tools

TBD

B. Flashing Instruction:

1. Setup fw_env.config

U-Boot envs config should be defined as followed in your /etc/fw_env.config

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

If you don't have /etc/fw_env.config file in your system then go ahead and create this file:
echo "/dev/mtd0 0xc0000 0x20000 0x20000" > /etc/fw_env.config

- And your mtd partitions should be (mtd0 is where u-boot is)

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "uboot"
. . .
If your mtd0 is size 1MB or greater then it's OK.

2. Backup mtd0 and envs

Save your current uBoot image in mtd0, and save your current u-boot envs with fw_printenv. Copy these files to a persistent storage.

2.1 Dumping NAND mtd0:
nanddump --noecc --omitoob -l 0x80000 -f mtd0.moi_plus /dev/mtd0

2.2. Save envs:
fw_printenv > current_envs.txt
For most stock OS, there is no fw_printenv. So it's OK if this step fails. Howver, it's important to list the current envs (eg. in serial console) and copy them to a note file (current_envs.txt). This will be used in Step 7.

3. Check for bad blocks

Be sure there is no bad block in the first 1M of your NAND. This is very important, if there is bad block in the first 1M (blocks 0 to 7), don't flash u-boot, because you will almost certainly soft-brick your box.

Example of bad block in mtd0:
dmesg | grep -i 'bad'

[    2.413231] Scanning device for bad blocks
[    2.417731] Bad eraseblock 3 at 0x000000060000

This bad eraseblock 3 is the 4th block which resides within mtd0 first 1M (block 0 to block 7). Please stop at this step and post question in this thread for a workaround.

4. Extract the archive to /tmp

cd /tmp
tar xf uboot.2024.10-tld-1.moi_plus.bodhi.tar

5. Flash u-boot image to NAND

Be extra careful with the next 2 commands, you should see output that look like below in those steps. If there is error, then do not reboot, post your problem here so we can help.

Erase 4 blocks
flash_erase /dev/mtd0 0 4
Expected output:
Erase Total 4 Units 
Performing Flash Erase of length 131072 at offset 0x60000 done

Write the image
nandwrite /dev/mtd0 uboot.2024.10-tld-1.moi_plus.kwb

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

6. Flash default u-boot envs image

Be extra careful with the next 2 commands, you should see output that look like below. If there is error, then do not reboot, post your problem here so we can help.

Erase 1 block
flash_erase /dev/mtd0 0xc0000 1
Expected output:
Erase Total 1 Units
Performing Flash Erase of length 131072 at offset 0xc0000 done

Write the image
nandwrite -s 786432 /dev/mtd0 /tmp/uboot.2024.10-tld-1.moi_plus.environment.img
Expected output:
Writing data to block 6 at offset 0xc0000

7. Restore MAC address and other envs

Restore the MAC address using the saved envs in current_envs.txt. Or find the MAC address on the sticker outside the case. Replace xx:xx:xx:xx:xx:xx with the real values.

fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'
For sanity check, list you envs again
fw_printenv

You also want to restore other specific information such as ipaddr (IP address of this box, if you use static IP).

Don't reboot if there is error while listing U-Boot envs. Post at the forum for help.

8. (Optional) Activate netconsole

TBD

9. Reboot

Upon reboot, in either serial console or netconsole, U-Boot banner should show:

U-Boot 2024.10-tld-1 (Nov 11 2024 - . . .)
TBS2903 MOI Plus DVB to IP Gateway Box

DONE installation.


C. NOTE

Distro Boot

uEnv.txt

TBD

END of NOTE.

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



Edited 2 time(s). Last edit at 11/16/2024 05:23PM by bodhi.
Attachments:
open | download - uboot.2024.10-tld-1.moi_plus.bodhi.tar (650 KB)
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: