2024.10 U-Boot Kirkwood - DNS-325
This instruction is under tested. Please wait until I remove this warning.
=========================================
Update 09 Apr 2025
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.dns325.bodhi.tar
This tarball contains 5 files:
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
If you are running an OS (eg. stock FW) that does not provide mtd-utils and uboot-tools (fw_setenv, fw_printenv, flash_erase, nandwrite), you can download the NAND and U-Boot tools binaries here in this thread.
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
If you don't have /etc/fw_env.config file in your system then go ahead and create this file:
- And your mtd partitions should be (mtd0 is where u-boot is)
cat /proc/mtd
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:
2.2. Save envs:
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:
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 (or any folder of your own choosing)
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
Write the image
Expected output:
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
Write the image
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.
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:
DONE installation.
C. NOTE
C.1 Distro Boot
See this post for how to use Distro Boot Script: TBD.
C2. uEnv.txt
TBD
END of NOTE.
This instruction is under tested. Please wait until I remove this warning.
=========================================
Update 09 Apr 2025
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.dns325.bodhi.tar
md5: 191129892f36f5e6538e86ffccd07fa9 sha256: 4f6eefbc570019b47f6db83a963876d6c213d221b59c07d6cdd874020f8830bd
This tarball contains 5 files:
uboot.2024.10-tld-1.dns325.kwb uboot.2024.10-tld-1.dns325.environment uboot.2024.10-tld-1.dns325.environment.img uboot.2024.10-tld-1.dns325.boot.cmd uboot.2024.10-tld-1.dns325.boot.scr
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
If you are running an OS (eg. stock FW) that does not provide mtd-utils and uboot-tools (fw_setenv, fw_printenv, flash_erase, nandwrite), you can download the NAND and U-Boot tools binaries here in this thread.
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 (0x00100000 hex) or greater then it's OK. The other mtds are not relevant to u-boot, so should be kept as is.
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 mtd0.dns325 /dev/mtd0
2.2. Save envs:
fw_printenv > current_envs.txtFor 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 (or any folder of your own choosing)
cd /tmp tar xf uboot.2024.10-tld-1.dns325.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 4Expected 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.dns325.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 1Expected 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.dns325.environment.imgExpected 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 (Apr 08 2025 - 13:52:33 -0700) D-Link DNS-325
DONE installation.
C. NOTE
C.1 Distro Boot
See this post for how to use Distro Boot Script: TBD.
C2. uEnv.txt
TBD
END of NOTE.