The information is somewhere in the forum, but it's hard to find. Here is 3 different ways to do that.
1. Simplest
strings /dev/mtd0 | grep U-Boot\ 2
Output could be like this
U-Boot 2022.10-rc2-00031-gd765364759-dirty (Aug 10 2022 - 14:36:13 -0700)
2. Dump the mtd0 to a file and grep it
dd if=/dev/mtd0 of=/tmp/mtd0.bin conv=sync && grep -a --null-data U-Boot /tmp/mtd0.bin
Output looks like this:
1016+0 records in
1016+0 records out
520192 bytes (520 kB, 508 KiB) copied, 0.793259 s, 656 kB/s
** Invalid partition type "%.32s" (expect "U-Boot")
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; doneU-Boot.armU-Boot phaseU-BootU-Boot 2023.04-tld-1 (May 29 2023 - 14:17:55 -0700)
3. Modprobe mtd block device and grep it
modprobe mtdblock
grep -a --null-data U-Boot /dev/mtdblock0
Output looks like this:
** Invalid partition type "%.32s" (expect "U-Boot")
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; doneU-Boot.armU-BootUBIFS: only ro mode in U-Boot allowed.
U-Boot 2022.10-rc2-00031-gd765364759-dirty (Aug 10 2022 - 14:36:13 -0700)
ZyXEL NSA310S/320S 1/2-Bay Power Media Serveruboot_version=U-Boot 2022.10-rc2-00031-gd765364759-dirty (Aug 10 2022 - 14:36:13 -0700) ZyXEL NSA310S/320S 1/2-Bay Power Media Serveruboot_version=U-Boot 2021.07-tld-1 (Jul 10 2021 - 16:14:35 -0700) ZyXEL NSA310S/320S 1/2-Bay Power Media Server
I usually don't want the mtd block driver running (fdisk will give crazy and scary looking output in dmesg, but there is no harm).
With the mtdblock driver running, when you do lsblk it will show the mtd block devices.
#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 119.2G 0 disk
└─sda1 8:1 0 119.2G 0 part /media/DATA
sdb 8:16 1 28.7G 0 disk
└─sdb1 8:17 1 26G 0 part /
mtdblock0 31:0 0 2M 0 disk
mtdblock1 31:1 0 126M 0 disk
However, this is handy when you want to examine the content. For example, if stock FW uses UBIFS, then you can mount mtd block device and browse/extract the content from it.
-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Edited 1 time(s). Last edit at 11/21/2024 11:52PM by bodhi.