Pulver
83
MT7988> ubi list
Error, no UBI device selected!
MT7988> ubi list UBI_DEV
Error, no UBI device selected!
Pulver
85
Oh, now we are getting somewhere, thanks 
MT7988> ubi part UBI_DEV
ubi0: attaching mtd4
ubi0: scanning is finished
ubi0 error: check_av: bad attaching information, error 1
Volume attaching information dump:
vol_id 3
highest_lnum 240
leb_count 55
compat 0
vol_type 3
used_ebs 0
last_data_size 0
data_pad 0
Volume information dump:
vol_id 3
reserved_pebs 47
alignment 1
data_pad 0
vol_type 3
name_len 5
usable_leb_size 126976
used_ebs 47
used_bytes 5967872
last_eb_bytes 126976
corrupted 0
upd_marker 0
skip_check 0
name linux
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
UBI error: cannot attach mtd4
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
But its just the same error as before, right ?
Are you have backup of volumes? Or UBI_DEV partition?
Yes => try nand erase UBI_DEV and reset
Pulver
87
I have a backup of the original mtd0 that I have checked with binwalk:
binwalk -B mtd0_bootloader
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
2056 0x808 Mediatek File Info File Type: ARM-Bootloader Flash Type: NAND Sequential Flash Signature Type: PHASH Load Address: 0x200D00 File Length: 252776 Maximum Size: 254824 Content Offset: 0x300 Signature Lenght: 32 Jump Offset: 768 POST_BUILD_DONE
213632 0x34280 xz compressed data
253232 0x3DD30 Flattened device tree, size: 618 bytes, version: 17
2110125 0x2032AD CRC32 polynomial table, little endian
2111445 0x2037D5 HTML document header
2111717 0x2038E5 HTML document footer
2111849 0x203969 HTML document header
2112667 0x203C9B HTML document footer
2112693 0x203CB5 HTML document header
2113137 0x203E71 HTML document footer
2113585 0x204031 HTML document header
2114167 0x204277 HTML document footer
2114193 0x204291 HTML document header
2114559 0x2043FF HTML document footer
2173003 0x21284B LZO compressed data
2207092 0x21AD74 uImage header, header size: 64 bytes, header CRC: 0x70776D20, created: 2022-11-12 09:59:02, image size: 1768366128 bytes, Data Address: 0x20302031, Entry Point: 0x30303020, data CRC: 0x30007077, image name: "nfig 0 1 1000 0"
2340977 0x23B871 Flattened device tree, size: 10936 bytes, version: 17
This is the file that Daniel said was OK.
Thats enough, right ?
As I understand it, your backup is only 4 megabytes?
Pulver
90
Yes, Daniel asked me to send him the mtd0 4mb (bootloader) - I did not backup the others at that time (yes, we know now that I should have done that)
Thanks, tempted to try anyway - it sounds like it could work 
This is not OK at all! You should have at least backed up the Factory volume.
I doubt that the bootloader/RecoverTool can recover the contents of volume Factory.
1 Like
Pulver
92
I meant that he checked that the bootloader file was dumped the correct way and that the file was OK - not that I made a proper backup of the entire router.
I will wait to see if there is new solution coming - thanks for your help and engagement 
Pulver
93
Sorry to bother again, but I realized that I have two options if I try:
nand erase UBI_DEV
and
reset
I have the Asus original firmware file, and the OpenWRT factory file:
The proper way is to upload the OpenWRT factory file with Asus web-restore, then use the OpenWRT sysupgrade file.
Does it sound safer to do it that way ?
BTW - I have already tried the OpenWRT factory file in the current condition on my router but get the same results as with the Asus firmware file.
daniel
94
I don't think that's a good idea. You would loose everything, including calibration data, MAC addresses and so on. Unless you have a backup, it'd be much better to try to recover UBI using OpenWrt's initramfs system.
Pulver
95
OK, thanks 
I understand that I have mount it somehow (if it is possible) and maybe delete some parts in it ?
If thats not possible, maybe run some diagnostics and a recovery program ?
I actually have some (simple) nand hardware equipment now and jtag coming so I will probably be able to rescue it somehow someday when I learn how to use the equipment
, but I'd rather find a simple solution first
(the nand equipment probably dont work with this nand anyway)
Im happy for any suggestions on how to mount and software to use that I can get from anyone 
Edit:
And its unfortunate that I saw this easy option (that RolandoMagico was talking about earlier) 2 days too late 
But I am doing this to learn so its probably for the best 
Pulver
96
For anyone interested in this router - the latest testupdate is probably working just fine.
I have been running it in initramfs mode with wireless for several days without problems.
Im also making some progress in restoring my nand-flash:
I have been able to recreate the problem on my laptop by extracting the ubi file, mounting mtd and ubi but in the end getting the same -22 error, looking for software that can analyze and correct ubi or mtd somehow.
My cheap eeprom/nand/flash equipment turned out to be rather good and I have been extracting, editing and restoring complete backups from other routers. I have found a software compatible with the Asus nand-chip but am having trouble getting connected - so I have ordered a "professional" connector that is for this specified for the size of this chip 
1 Like
daniel
97
I've prepared the necessary bits in the asus-bt8-for-installer branch of my staging tree. The installer generator requires the binaries to be available on downloads.openwrt.org, so an installer can only be released after the commits now in my staging tree are merged. In the meantime, when building from source, it is of course possible to generate the installer locally.
(README.md, installation video, ... still needs to be done, I hope to get to complete all that during the upcoming weekend)
To try, build OpenWrt, git clone the installer and create a folder dl in the tree of the installer, then copy the build artifacts of the openwrt build from target/linux/mediatek/filogic there. Prevent download and signature validation by patching the script:
diff --git a/build_installer.sh b/build_installer.sh
index 6d13808..5b76867 100755
--- a/build_installer.sh
+++ b/build_installer.sh
@@ -37,19 +37,19 @@ prepare_openwrt_ib() {
cd "${INSTALLERDIR}/dl"
gpg --no-default-keyring --keyring "${INSTALLERDIR}/openwrt-keyring" --list-key $OPENWRT_PGP 1>/dev/null 2>/dev/null || gpg --no-default-keyring --keyring "${INSTALLERDIR}/openwrt-keyring" --keyserver ${KEYSERVER} --recv-key $OPENWRT_PGP
gpg --no-default-keyring --keyring "${INSTALLERDIR}/openwrt-keyring" --list-key $OPENWRT_PGP 1>/dev/null 2>/dev/null || exit 0
- rm -f "sha256sums.asc" "sha256sums"
- wget "${OPENWRT_TARGET}/sha256sums.asc"
- wget "${OPENWRT_TARGET}/sha256sums"
- gpg --no-default-keyring --keyring "${INSTALLERDIR}/openwrt-keyring" --verify sha256sums.asc sha256sums || exit 1
+# rm -f "sha256sums.asc" "sha256sums"
+# wget "${OPENWRT_TARGET}/sha256sums.asc"
+# wget "${OPENWRT_TARGET}/sha256sums"
+# gpg --no-default-keyring --keyring "${INSTALLERDIR}/openwrt-keyring" --verify sha256sums.asc sha256sums || exit 1
trap - EXIT
rm -rf -- "${GNUPGHOME}"
export -n GNUPGHOME
sha256sum -c sha256sums --ignore-missing || rm -f "$OPENWRT_SYSUPGRADE" "$OPENWRT_IB" "$OPENWRT_INITRD"
- wget -c "${OPENWRT_TARGET}/${OPENWRT_INITRD}"
- wget -c "${OPENWRT_TARGET}/${OPENWRT_SYSUPGRADE}"
- wget -c "${OPENWRT_TARGET}/${OPENWRT_IB}"
+# wget -c "${OPENWRT_TARGET}/${OPENWRT_INITRD}"
+# wget -c "${OPENWRT_TARGET}/${OPENWRT_SYSUPGRADE}"
+# wget -c "${OPENWRT_TARGET}/${OPENWRT_IB}"
sha256sum -c sha256sums --ignore-missing || exit 1
mkdir -p "${OPENWRT_DIR}" || exit 1
tar -xf "${INSTALLERDIR}/dl/${OPENWRT_IB}" -C "${OPENWRT_DIR}" --strip-components=1
I've tested all that quite a bit now and it seems very solid and robust to me.
5 Likes
Pulver
98
I dont think that this is going to work with my broken nandflash, but I still wanted to compile to see if I could generate the files.
After some initial trouble I got the script going without errors, but the result turned out empty - I assume that 'unfit' only works on x86/64 ? (since its looking for openwrt-imagebuilder-mediatek-filogic.Linux-x86_64.tar.zst) I changed this in the build_installer.sh manually to openwrt-imagebuilder-mediatek-filogic.Linux-aarch64.tar.zst since i used an arm-computer to compile.
Setting up a x64 Ubuntu install as we speak.
daniel
99
If you change the name of the ImageBuilder to aarch64 all should work there as well, including unfit (which is built from source). You will probably need a Linux environment though, WSL2 or Darwin (or any other UNIX) is untested.
Pulver
100
OK, thanks - yes, this is Ubuntu 24.04 (Lenovo X13s)
I have banana r4 with unstable cpu@3. System works only after removing fourth core from dts. And here is the question: is it possile to activate 4th core (cpu@3) on mt7988d?
daniel
102
MT7988D only got three cores. Trying to activate a 4th core (ie. removing /delete-node/ cpu@3; from DT) just results in a warning during boot that the 4th core could not be brought up.
1 Like
Pulver
103
Hmm, im doing something wrong - the script seems to run OK, but it does not actually make anything ?
./build_installer.sh
+ set -o errexit
+ set -o nounset
+ set -o pipefail
+ DESTDIR=/home/pulver/asus-bt8
+ OPENWRT_PGP=0x1D53D1877742E911
+ KEYSERVER=keyserver.ubuntu.com
+++ dirname ./build_installer.sh
++ cd .
++ pwd
+ INSTALLERDIR=/home/pulver/asus-bt8
+ OPENWRT_DIR=/home/pulver/asus-bt8/openwrt-ib
+ CPIO=/home/pulver/asus-bt8/openwrt-ib/staging_dir/host/bin/cpio
+ MKIMAGE=/home/pulver/asus-bt8/openwrt-ib/staging_dir/host/bin/mkimage
+ APK=/home/pulver/asus-bt8/openwrt-ib/staging_dir/host/bin/apk
+ XZ=/home/pulver/asus-bt8/openwrt-ib/staging_dir/host/bin/xz
+ UNFIT=/home/pulver/asus-bt8/unfit
+ '[' -x /home/pulver/asus-bt8/unfit ']'
++ git log -1 --pretty=%ct -C /home/pulver/asus-bt8
+ SOURCE_DATE_EPOCH=1738896436
+ DTC=
+ FILEBASE=
+ WORKDIR=
+ ITSFILE=
+ asus_bt8_installer
+ OPENWRT_TARGET=https://downloads.openwrt.org/snapshots/targets/mediatek/filogic
+ OPENWRT_IB=openwrt-imagebuilder-mediatek-filogic.Linux-x86_64.tar.zst
+ OPENWRT_INITRD=openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-recovery.itb
+ OPENWRT_SYSUPGRADE=openwrt-mediatek-filogic-asus_zenwifi-bt8-squashfs-sysupgrade.itb
+ OPENWRT_ADD_REC_PACKAGES=(uhttpd luci-mod-admin-full luci-theme-bootstrap)
+ OPENWRT_REMOVE_PACKAGES=(kmod-mt7996-firmware kmod-mt7996e kmod-mt76-connac kmod-mt76-core kmod-mt7996-firmware mt7988-wo-firmware odhcp6c odhcpd-ipv6only ppp ppp-mod-pppoe wpad-basic-mbedtls)
+ OPENWRT_ADD_PACKAGES=()
+ prepare_openwrt_ib
++ mktemp -d
+ GNUPGHOME=/tmp/tmp.XOwsocsu3R
+ export GNUPGHOME
+ trap 'rm -rf -- "${GNUPGHOME}"' EXIT
+ mkdir -p /home/pulver/asus-bt8/dl
+ cd /home/pulver/asus-bt8/dl
+ gpg --no-default-keyring --keyring /home/pulver/asus-bt8/openwrt-keyring --list-key 0x1D53D1877742E911
+ gpg --no-default-keyring --keyring /home/pulver/asus-bt8/openwrt-keyring --list-key 0x1D53D1877742E911
+ trap - EXIT
+ rm -rf -- /tmp/tmp.XOwsocsu3R
+ export -n GNUPGHOME
+ sha256sum -c sha256sums --ignore-missing
config.buildinfo: OK
feeds.buildinfo: OK
mt7981-ram-ddr3-bl2.bin: OK
mt7981-ram-ddr4-bl2.bin: OK
mt7986-ram-ddr3-bl2.bin: OK
mt7986-ram-ddr4-bl2.bin: OK
mt7988-ram-comb-bl2.bin: OK
openwrt-imagebuilder-mediatek-filogic.Linux-x86_64.tar.zst: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8-factory.bin: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-kernel.bin: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8-squashfs-sysupgrade.bin: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8.manifest: OK
profiles.json: OK
version.buildinfo: OK
+ sha256sum -c sha256sums --ignore-missing
config.buildinfo: OK
feeds.buildinfo: OK
mt7981-ram-ddr3-bl2.bin: OK
mt7981-ram-ddr4-bl2.bin: OK
mt7986-ram-ddr3-bl2.bin: OK
mt7986-ram-ddr4-bl2.bin: OK
mt7988-ram-comb-bl2.bin: OK
openwrt-imagebuilder-mediatek-filogic.Linux-x86_64.tar.zst: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8-factory.bin: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-kernel.bin: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8-squashfs-sysupgrade.bin: OK
openwrt-mediatek-filogic-asus_zenwifi-bt8.manifest: OK
profiles.json: OK
version.buildinfo: OK
+ mkdir -p /home/pulver/asus-bt8/openwrt-ib
+ tar -xf /home/pulver/asus-bt8/dl/openwrt-imagebuilder-mediatek-filogic.Linux-x86_64.tar.zst -C /home/pulver/asus-bt8/openwrt-ib --strip-components=1
++ ls -1 /home/pulver/asus-bt8/openwrt-ib/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/linux-6.6.74/scripts/dtc/dtc
+ DTC=/home/pulver/asus-bt8/openwrt-ib/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/linux-6.6.74/scripts/dtc/dtc
+ '[' -x /home/pulver/asus-bt8/openwrt-ib/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/linux-6.6.74/scripts/dtc/dtc ']'
+ make -C /home/pulver/asus-bt8/openwrt-ib info
+ grep 'Default Packages:'
+ grep -q fitblk
+ bundle_initrd recovery /home/pulver/asus-bt8/dl/openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-recovery.itb
+ local imgtype=recovery
+ shift
+ unfit_image /home/pulver/asus-bt8/dl/openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-recovery.itb
+ INFILE=/home/pulver/asus-bt8/dl/openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-recovery.itb
++ basename /home/pulver/asus-bt8/dl/openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-recovery.itb
+ FILEBASE=openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-recovery.itb
++ mktemp -d
+ WORKDIR=/tmp/tmp.wVQ8P80F9a
+ ITSFILE=/tmp/tmp.wVQ8P80F9a/image.its
+ mkdir -p /tmp/tmp.wVQ8P80F9a
+ cd /tmp/tmp.wVQ8P80F9a
+ /home/pulver/asus-bt8/unfit /home/pulver/asus-bt8/dl/openwrt-mediatek-filogic-asus_zenwifi-bt8-initramfs-recovery.itb
There is no recovery.itb created.