bouffalolab / bl808_linux

Apache License 2.0
125 stars 39 forks source link

"Unable to mount root fs" #23

Open EpicLPer opened 8 months ago

EpicLPer commented 8 months ago

Heya,

I'm by no means an expert in compiling or with the BL808 in general and I'm stuck on the following error message after booting up my M1s Dock for the first time:

[    0.155415] VFS: Cannot open root device "mtdblock0" or unknown-block(0,0): error -19
[    0.155905] Please append a correct "root=" boot option; here are the available partitions:
[    0.156422] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.156936] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.4 #1
[    0.157304] Call Trace:
[    0.157498] [<ffffffe000202810>] walk_stackframe+0x0/0xaa
[    0.157850] [<ffffffe000570276>] show_stack+0x32/0x3e
[    0.158179] [<ffffffe000572308>] dump_stack+0x72/0x8c
[    0.158505] [<ffffffe000570484>] panic+0xfc/0x2aa
[    0.158810] [<ffffffe0000021a8>] 0xffffffe0000021a8
[    0.159123] [<ffffffe0000022b6>] 0xffffffe0000022b6
[    0.159436] [<ffffffe0000023f6>] 0xffffffe0000023f6
[    0.159749] [<ffffffe000001dae>] 0xffffffe000001dae
[    0.160071] [<ffffffe000575612>] kernel_init+0x12/0xf8
[    0.160404] [<ffffffe0002012be>] ret_from_exception+0x0/0xc
[    0.160776] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

I've followed the steps in the guide and everything went fine when it comes to flashing. I've also used the switch_to_m1sdock.sh script before compiling the firmware.
What could I have done wrong? I also enabled the "Erase Flash" option in Dev Cube to erase the old Linux that was on there.

Thanks already for your help!

Pavlos1 commented 8 months ago

Use this patch: #21

Alternatively: you can run make menuconfig from the kernel directory and set up the rootfs config manually.

cd linux-5.10.4-808
cp c906.config .config
EpicLPer commented 7 months ago

Use this patch: #21

Alternatively: ~you can run make menuconfig from the kernel directory and set up the rootfs config manually.~

cd linux-5.10.4-808
cp c906.config .config

Thanks for the reply, however I'm getting the same result as before:

[    0.157355] VFS: Cannot open root device "mtdblock0" or unknown-block(0,0): error -19
[    0.157935] Please append a correct "root=" boot option; here are the available partitions:
[    0.158459] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Pavlos1 commented 7 months ago

Make sure the kernel is actually getting recompiled. The simplest way is probably to start from a fresh repository.

It could be something else, but your error message is the exact same one I got when I didn't copy over the default config.

EpicLPer commented 7 months ago

Make sure the kernel is actually getting recompiled. The simplest way is probably to start from a fresh repository.

It could be something else, but your error message is the exact same one I got when I didn't copy over the default config.

Seems this was the issue, and in addition to that I didn't use the "switch-to-m1sdock" script this time. It apparently boots now, tho I'm not getting any UART output on one of the COM ports, the other one just shows that the bootloader ran successfully.

Pavlos1 commented 7 months ago

You do need to run the switch-to-m1sdock script though, otherwise it will output on the wrong UARTs.

EpicLPer commented 7 months ago

Okay, this seems to be related to THIS patch file for the M1s Dock. It only seems to change the UART ports, however as soon as I'm using it the .config files seems to get ignored for some reason, so the root is then not set proeprly anymore. Once I'm not using that file the onboard LED flashes a couple of times and it seems to boot? Tho thinking of it, it could just be that the output is routed to a Pin that is connected to a LED instead, making it "seem" like it's working...

EpicLPer commented 7 months ago

Okay, yeah... checking the pinout it is indeed connected to the pre-patch state GPIO8, which in the case of the M1s Dock is the LED. So that's why it's "seemingly" working, but in reality still fails to boot with a missing rootfs... image

Pavlos1 commented 7 months ago

In a fresh repository, after:

cp c906.config .config

you can run

make oldconfig

to make sure it's picking up the new configuration correctly. After that:

diff c906.config .config

will tell you if it had to change any parameters.

Pavlos1 commented 7 months ago

The only other thing I can think of: double-check to make sure you ticked the "single download" option in BLDevCube when flashing whole_img_linux.bin.

EpicLPer commented 7 months ago

you can run

make oldconfig

Running this and pressing Enter for all options it's asking me results in a 70+KB big .config afterwards, where the original c906.config is just about 56KB big.

EpicLPer commented 7 months ago

Even after doing the "make oldconfig" and then compiling all of it again (in a new repo copy) it still shows the same error that root is missing.

Pavlos1 commented 7 months ago

OK I have reproduced your issue. The problem is introduced by commits made after PR #21 was opened. I will take a look at it tomorrow.

For now you can do:

git clone https://github.com/cjacker/bl808_linux
cd bl808-linux
git checkout build_fix

and then follow the usual procedures. No messing around with .config necessary.

EpicLPer commented 7 months ago

Yep, this seemed to work :) Linux is now up and running. Thanks a lot! I haven't gotten WiFi to work yet tho, there aren't any interfaces apparently tho need to play around a bit more.

Pavlos1 commented 7 months ago

The culprit appears to be CONFIG_CMDLINE_PARTITION (and possibly CONFIG_MTD), which both got unset in 3ab7f9 for reasons unknown. Perhaps they were working towards moving the rootfs to an SD card.

Regarding wifi: see here, at a minimum you need to compile their blctl utility.

IronFist16 commented 4 months ago

OK I have reproduced your issue. The problem is introduced by commits made after PR #21 was opened. I will take a look at it tomorrow.

For now you can do:

git clone https://github.com/cjacker/bl808_linux
cd bl808-linux
git checkout build_fix

and then follow the usual procedures. No messing around with .config necessary.

Is this the current fix to this bug?

Pavlos1 commented 4 months ago

Or just revert 3ab7f93e4a198e3d701b4ab38467bc444c261956 .