Welcome! Log In Create A New Profile

Advanced

Trying to boot Debian 12 inside Asustor AS-1002T NAS, I am almost finished but stuck at something

Posted by ahlaklisuvari 
I was trying to install debian armhf to my Asustor AS-1002T NAS. I used debian Linksys WRT-AC1200 official guide: https://wiki.debian.org/InstallingDebianOn/Linksys/WRT1200AC because it used the same CPU, and probably same ethernet driver too. Because it downloaded all the stuff from the internet inside the installer, so it works. Changed the links and stuff to the bookworm accordingly. So, I set u boot to load that installer, done everything. I completed the install.
One thing is I didn’t do flash-kernel related stuff, because the E-MMC inside is borked totally, or I couldn’t see it from debian installer. So I asked chatgpt to how to do it without flash-kernel, it said to me just pass on those flash-kernel related commands.
So it said me to do just:
sudo update-initramfs -u

Then I just did it. Then chatgpt gave me some temporary and permanent booting options(if temporary works at all) I checked it with
ext2ls scsi 0:1 /

so I can see that files, vmlinuz and initrd stuff.
So these were the commands chatgpt said:
setenv bootargs 'console=ttyS0,115200 root=/dev/sda2 rw rootwait'
saveenv
reset

After the reset, stop booting then enter these commands:
scsi init
ext2load scsi 0:1 0x80000000 /vmlinuz
ext2load scsi 0:1 0x88000000 /initrd.img
bootz 0x80000000 0x88000000

But, it’s stuck actually. It won’t do anything after that. I removed the HDD from inside, and checked if the vmlinuz is actually zImage, because that’s what bootz does, loads zImages. So it’s a zImage after all:
$:file vmlinuz-6.1.0-21-armmp
vmlinuz-6.1.0-21-armmp: Linux kernel ARM boot executable zImage (little-endian)

This is the u-boot output when I try these, no output even after 5 minutes. Why would it boot the debian installer and not this? I am very close. No device is up I checked it from my router too:
Marvell>> scsi init
AHCI init for unit0
SATA link 0 timeout.
Target spinup took 0 ms.
Error: SCSI Controller(s) 1B4B:9215 1B4B:9235 not found
scanning bus for devices...
Device 0: (1:0) Vendor: ATA Prod.: ST9160310AS Rev: 0303
Type: Hard Disk
Capacity: 152627.8 MB = 149.0 GB (312581808 x 512)
Found 1 device(s).
Marvell>> ext2load scsi 0:1 0x80000000 /vmlinuz
5423616 bytes read in 237 ms (21.8 MiB/s)
Marvell>> ext2load scsi 0:1 0x88000000 /initrd.img
23415107 bytes read in 987 ms (22.6 MiB/s)
Marvell>> grep
Unknown command 'grep' - try 'help'
Marvell>> bootz 0x80000000 0x88000000



Edited 1 time(s). Last edit at 06/15/2024 05:00PM by ahlaklisuvari.
ahlaklisuvari,

Why use chatgpt? apparently it gave you a wrong instruction.

If you run the installer as instructed at Debian site https://wiki.debian.org/InstallingDebianOn/Linksys/WRT1200AC, then you need to do everything according to the instruction on that site.

Quote

One thing is I didn’t do flash-kernel related stuff, because the E-MMC inside is borked totally, or I couldn’t see it from debian installer.

Then you should install on USB first. Later you can investigate why the eMMC is not recognized by the kernel. I'd suspect it is becasue the Linksys Caiman (WRT1200AC) DTS lacks some definition that your Asustor AS-1002T NAS needs.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
In anycase, I think it (https://wiki.debian.org/InstallingDebianOn/Linksys/WRT1200AC) might not be an appropriate instruction for your box.

Quote

Invoke /usr/sbin/flash-kernel, it should overwrite /dev/mtd4 with Debian kernel and /dev/mtd5 with Debian initrd.

The above step might corrupt your stock FW.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Yes I know that much, that's why I didn't do any of these commands and asked chatgpt. Also mtd wasn't visible to the debian installer anyway.
I don't think MTD is a problem here, I simply don't touch MTD. But on HDD. The installer run just fine, with that caiman.dtb file. Even recognized the ethernet. After the installer, it won't boot now. Did I create kernel images just the wrong way? Does update-initramfs -u add that dtb file to the kernel images whatsoever?
ahlaklisuvari,

> I don't think MTD is a problem here, I simply
> don't touch MTD. But on HDD. The installer run
> just fine, with that caiman.dtb file. Even
> recognized the ethernet. After the installer, it
> won't boot now.

> Did I create kernel images just
> the wrong way?

The kernel image seems OK. That was done in these commands for the installer.

cat vmlinuz armada-385-linksys-caiman.dtb > blob
mkimage -A arm -O linux -T kernel -C none -a 0x200000 -e 0x200000 -n "d-i" -d blob vmlinux
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x4200000 -e 0x4200000 -n "d-i initrd" -d initrd.gz initrd

But when you boot the final vmlinuz, it seems wrong.

ext2load scsi 0:1 0x80000000 /vmlinuz
It must have the DTB appended like the installer, and must be in u-boot format (i.e. uImage, uInitrd). These images have a u-boot header and a payload.

> Does update-initramfs -u add that
> dtb file to the kernel images whatsoever?

No, there is no need to run update-initramfs. IIRC, in Debian installation, that only relevant after you have set up flash-kernel.

Marvell>> bootz 0x80000000 0x88000000

How much RAM this box has? 0x80000000 is 2GB.


=========

I don't think I can help much with Debian installation. We don't use it here. The way we install Debian is manual installation. Here is the kernel and rootfs release thread for MVEBU SoCs:

https://forum.doozan.com/read.php?2,32146

There are quite a few Armada 385 boxes on the support list. But each has a different installation instruction (because different u-boot is on each).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Quote
bodhi
It must have the DTB appended like the installer, and must be in u-boot format (i.e. uImage, uInitrd). These images have a u-boot header and a payload.
DTB appended, got it. I assume it is done with something similiar with those mkimage commands? I think I've done it too. I've appended the dtb to vmlinuz and turned it into a uImage in the end. Just curious, why not zImage though? Because this marvell's u-boot has bootz command too.
Quote
bodhi
No, there is no need to run update-initramfs. IIRC, in Debian installation, that only relevant after you have set up flash-kernel.
I think flash-kernel is for MTD devices isn't it? My MTD is broken or inaccessible, atleast the rootfs part. u-boot works.

Quote
bodhi
How much RAM this box has? 0x80000000 is 2GB.
I think it has 512MB. Is that so? Because tftpboot command as default, writes to that 0x8000000 field. For example, I used this guide to install debian: https://wiki.debian.org/InstallingDebianOn/Linksys/WRT1200AC
In here it also loads to RAM like that. Although I load from HDD to RAM in my case, but when installing I used the exact commands and they worked?

I am also trying the topic found on this forum, on a different HDD: https://forum.doozan.com/read.php?2,32146



Edited 2 time(s). Last edit at 06/16/2024 04:12PM by ahlaklisuvari.
ahlaklisuvari,

> DTB appended, got it. I assume it is done with
> something similiar with those mkimage commands? I
> think I've done it too. I've appended the dtb to
> vmlinuz and turned it into a uImage in the end.
> Just curious, why not zImage though? Because this
> marvell's u-boot has bootz command too.

Usually whatever (bootm or bootz) the stock u-boot envs use, that's likely to work. But Marvell stock u-boot bootz for these Armada 385 boards does not work well, for a few reasons.

>
Quote
bodhi
> No, there is no need to run update-initramfs.
> IIRC, in Debian installation, that only relevant
> after you have set up flash-kernel.
>
> I think flash-kernel is for MTD devices isn't it?
> My MTD is broken or inaccessible, atleast the
> rootfs part. u-boot works.

That's a problem with name "flash-kernel", it is a bit confusing. It is meant to be used even when the kernel files are on disk storage. Whatever the /etc/flash-kernel/db defines, that's where the kernel files are.

In this case, just so happens that Debian installation for the WRT1200AC use kernel1 and rootfs1 MTDs (probably what stock FW uses).

> I am also trying the topic found on this forum, on
> a different HDD:
> https://forum.doozan.com/read.php?2,32146

OK so. Power up, interrupt serial console and
bdinfo
map          # this might not work
help
printenv
And please post the entire log here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
DAMN I DID IT!!!
I APPENDED THE DTB LIKE YOU SAID AND WOW! AND I THINK 0x8000 WASNT A GOOD ADDRESS. HERE S HOW!
Marvell>> ext2load scsi 0:1 0x3000000 /vmlinux
5443723 bytes read in 258 ms (20.1 MiB/s)
Marvell>> ext2load scsi 0:1 0x4000000 /initrdeski
23400842 bytes read in 692 ms (32.2 MiB/s)
Marvell>> setenv bootargs 'console=ttyS0,115200 root=/dev/sda2 rw rootwait'
Marvell>> bootm 0x3000000 0x4000000
and boom, it works.
I am gonna explain more, but I am tired too much. See y'all



Edited 1 time(s). Last edit at 06/16/2024 07:20PM by ahlaklisuvari.
Here comes how I did it. This isn't risk free, but pretty much safe. I just install this on an HDD, so if you can revert u-boot back, you can restore stock fw easily. First of all, there are some problems with ethernet on this device. Sometimes device doesn't respond. But, you can just try this, this commands fixed it for some other marvell device of mine. I don't have that device anymore so. Try this. but install hdparm first:

hdparm -S 0 /dev/sda
hdparm -B 255 /dev/sda
I followed this wiki at first, even used that dtb file of wrt ac1200:
https://wiki.debian.org/InstallingDebianOn/Linksys/WRT1200AC
Then continue installing from serial console etc. I skipped flash-kernel installation because I don't use MTD for install. I am not sure it's needed. But it might be needed for auto kernel updates. I don't really know for sure. I install on HDD. This has 16mb flash. Debian won't fit anyway. After finishing the installation, I did these.
After installation, you can either open up shell from installer inside, chroot to disk; or close the device and unplug HDD and do it from another PC. So, there is vmlinuz-6.1.0-18-armmp file, also there is initrd.img-6.1.0-18-armmp file, inside /boot partition(on the advised install there is two partitions on the HDD /dev/sda1 is boot, sda2 is root. I did that)
Also there is dtb file at /boot, which is the same as that wrt 1200ac dtb file. You can check them with sha256sum, they are the exact same file. So use that file to do these commands(use sudo or root if possible):

cat vmlinuz-6.1.0-18-armmp dtb > blob
mkimage -A arm -O linux -T kernel -C none -a 0x200000 -e 0x200000 -n "d-i" -d blob vmlinux
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x4200000 -e 0x4200000 -n "d-i initrd" -d initrd.img-6.1.0-18-armmp initrdnew

Marvell>> ext2load scsi 0:1 0x3000000 /vmlinux
5443723 bytes read in 258 ms (20.1 MiB/s)
Marvell>> ext2load scsi 0:1 0x4000000 /initrdnew
23400842 bytes read in 692 ms (32.2 MiB/s)
Marvell>> setenv bootargs 'console=ttyS0,115200 root=/dev/sda2 rw rootwait'
Marvell>> bootm 0x3000000 0x4000000

Now it will boot debian.
It's common practice to use the names uImage and uInitrd (which could be symlinks to uImage-<version> etc) for u-boot images. vmlinux normally is a 'raw' kernel.
Quote
Mijzelf
It's common practice to use the names uImage and uInitrd (which could be symlinks to uImage-<version> etc) for u-boot images. vmlinux normally is a 'raw' kernel.

+1

Quote
ahlaklisuvari
First of all, there are some problems with ethernet on this device

Great that you can boot this with the WRT1200AC dtb. However, it is definitely not the correct one to use for real. This Linksys Caiman is a router, so ethernet is different (it has a DSA switch). And likely you cannot see all the SATA slots with this DTB. Eventually, you will find other problems, too.

Of course, you can run my released kernel. However, if you only want to run mainline kernel 6.1, you can just download my released kernel tarball and use the DTBs in it for testing.

Quote
https://forum.doozan.com/read.php?2,32146
Updated 25 Jan 2023:

Kernel 6.1.8-mvebu-tld-1 package has been uploaded.

These are Armada 385 DTBs in linux-dtb-6.1.8-mvebu-tld-1.tar

armada-385-atl-x530.dtb
armada-385-clearfog-gtr-l8.dtb
armada-385-clearfog-gtr-s4.dtb
armada-385-db-88f6820-amc.dtb
armada-385-db-ap.dtb
armada-385-linksys-caiman.dtb
armada-385-linksys-cobra.dtb
armada-385-linksys-rango.dtb
armada-385-linksys-shelby.dtb
armada-385-synology-ds116.dtb
armada-385-synology-ds216.dtb
armada-385-synology-ds218j.dtb
armada-385-synology-rs816.dtb
armada-385-thecus-n2350.dtb
armada-385-turris-omnia.dtb
armada-385-wd-ex2100.dtb
armada-385-wd-ex2-ultra.dtb

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

Could you get some information for this box.

Power up, interrupt serial console countdown, and

bdinfo
md.l f1018000 8
md.l f1018100 1
md.l f1018140 1
help
printenv
and then boot
boot
Let it boot all the way to the Debian login prompt.

And post the entire serial console log here (from the u-boot banner until the login prompt).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: