Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3247

2024.10 U-Boot Kirkwood - Synology DS211 (1 reply)

$
0
0
2024.10 U-Boot Kirkwood - Synology DS211

Warning: this is still under test. Do not use.

Warning: flashing this new u-boot will wipe out stock FW. You will no longer able to boot into stock OS.

This instruction is basically ready for use. Some TBDs will be filled in later.


=========================================
Update 16 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.ds211.bodhi.tar
sha256:
d110467d3fe0fd2a482f24223b30dfe49da73f4a2f7dd0529f91556e0a656ed9

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

A. Preparation

A.1. Create Debian rootfs on a USB drive.

See the release thread.

At this writing, the rootfs is Debian-6.5.7-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (01 Nov 2023) .

A.2. Backup stock FW

If you wish to restore to stock FW in the future, back up the current SPI flash mtds.
dd if=/dev/mtd0 of=mtd0.ds211 conv=sync
dd if=/dev/mtd1 of=mtd1.ds211 conv=sync
dd if=/dev/mtd2 of=mtd2.ds211 conv=sync
dd if=/dev/mtd3 of=mtd3.ds211 conv=sync
dd if=/dev/mtd4 of=mtd4.ds211 conv=sync
dd if=/dev/mtd5 of=mtd5.ds211 conv=sync
And copy these files to a persistent storage.

A.3. Serial Console

Serial console connection is required if you are still booting stock FW.

A.4. 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.5. Flashing tools

TBD

B. Flashing Instruction:

1. Setup fw_env.config and mtds in your Debian rootfs

1.a U-Boot envs config

It 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/mtd1 0x0 0x10000 0x10000

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

1.b. MTD partitions

Your mtd0 and mtd1 partitions should looks like this. mdt0 is 512KB starting at 0, mtd1 is 64K starting at 768K. Other mtds, if any, can be defined in the remaining space, but will not be used for u-boot.

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00010000 "u-boot"		 
mtd1: 00010000 00010000 "u-boot-env"
cat /sys/class/mtd/mtd0/offset /sys/class/mtd/mtd1/offset
0
786432

Synology stock u-boots usually define the MTD partition badly wrong (thus causing many bricks). The above MTD partition definition is required for this new u-boot. Please post question if your cat /proc/mtd result for mtd0 and mtd1 is not as above.

2. Backup the 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. Extract the archive to /tmp

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

5. Flash u-boot image to SPI

Be extra careful with the next command, 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.

Write the u-boot image
flashcp -v /tmp/uboot.2024.10-tld-1.ds211.kwb /dev/mtd0
Expected output:
Erasing blocks: xxx/xxx (100%)
Writing data: 512k/0k (100%)
Verifying data: 512k/0k (100%)

6. Flash default u-boot envs image

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


Write the envs image
flashcp -v uboot.2024.10-tld-1.ds211.environment.img /dev/mtd1
Expected output:
Erasing blocks: xxx/xxx (100%)
Writing data: 64k/0k (100%)
Verifying data: 64k/0k (100%)

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 for this box as ipaddr (IP address of this box, if you use static IP). But these info can be restored later u-boot has been installed and reboot into Debian.

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 17 2024 ...)
Synology DS211

DONE installation.


C. NOTE

Distro Boot

uEnv.txt

TBD

END of NOTE.

Viewing all articles
Browse latest Browse all 3247

Trending Articles