inindev / odroid-m1

debian arm64 linux for the odroid m1
GNU General Public License v3.0
15 stars 2 forks source link

Support request: booting from nvme #4

Closed mkkot closed 1 year ago

mkkot commented 1 year ago

Hello, thanks for this project. I'm interested in using the system you prepared for building a NAS. I got information from odroid forum about booting from nvme:

In order to start the system from NVME, the following prerequisites are required:

Is it true or it works with petitboot? For me petitboot says "Waiting for device discovery" and I can't do anything with it when Bookworm is flashed on nvme (or SSD). To boot your system I need to disable petitboot.

Thanks!

inindev commented 1 year ago

I was only able to get devices under 500g to be recognized by petitboot. If you hold down the button near the spi nor flash it will disable it and skip petitboot.

The rc4 image here does indeed boot nvme from mmc or spi. The instructions are here: https://github.com/inindev/odroid-m1/tree/main/uboot

I use a 2TB Samsung NVME with these using u-boot on the spi nor.

First, I boot from mmc by bypassing the spi flash (using the button on the board). Install mtd utils: sudo apt update && sudo apt install mtd-utils

Second, I erase the spi flash:

sudo flash_erase /dev/mtd0 0 0
sudo flash_erase /dev/mtd1 0 0
sudo flash_erase /dev/mtd2 0 0
sudo flash_erase /dev/mtd3 0 0

Third install u-boot to spi:

wget https://github.com/inindev/odroid-m1/releases/download/v12-rc4/idbloader.img
wget https://github.com/inindev/odroid-m1/releases/download/v12-rc4/u-boot.itb
sudo flashcp -v idbloader.img /dev/mtd0
sudo flashcp -v u-boot.itb /dev/mtd2

Debian is about to release v12 bookworm at 2p EDT (in about an hour) and I plan to rebuild all images with the GA packages.

mkkot commented 1 year ago

Debian is about to release v12 bookworm at 2p EDT (in about an hour) and I plan to rebuild all images with the GA packages.

Trust me, I'm aware about that since months now :)

But that also rises a question. So I know how it works on x86 when updating the system. There is a new kernel, vmlinuz-X.Y gets regenerated by package manager hook, vmlinuz symlink gets replaced, everything is booted by UEFI/BIOS. I have a UEFI partition on my Archlinux mounted under /boot and I basically already forgot about this fact until today.

What about ARM? Will I need to write some script that runs after kernel upgrade to regenerate and reflash those images?

Sorry for newbie questions but this is who I am in ARM world.

Another thing, still about booting. So what I've done so far:

  1. fw_setenv skip_spiboot true to skip petitboot
  2. Flashed your system image to SD card and booted it
  3. wget [...]odroid-m1_bookworm-rc4.img.xz && xzcat odroid-m1_bookworm-rc4.img.xz > /dev/nvme0n1...

So I have my SSD Samsung 980 1TB already flashed with your image.

Then I got stuck and created this ticket. So based on your instruction, on my x86 machine I plugged SD card, downloaded files from Releases page and did:

[root@linux tmp]# dd if=/dev/zero of=/dev/sdb
^C
[root@linux tmp]# dd bs=4K seek=8 if=idbloader.img of=/dev/sdb conv=notrunc
46+0 records in
46+0 records out
188416 bytes (188 kB, 184 KiB) copied, 0,0809035 s, 2,3 MB/s
[root@linux tmp]# dd bs=4K seek=2048 if=u-boot.itb of=/dev/sdb conv=notrunc,fsync
255+1 records in
255+1 records out
1046528 bytes (1,0 MB, 1022 KiB) copied, 1,10409 s, 948 kB/s

Then I plugged this SD card again to odroid to get stuck on Hardkernel logo. I was hoping it will boot the SSD system. What I'm doing wrong here?

I want to learn on SD card first before I start tampering with spi. Also, if those images need to be updated, maybe it's better to keep them on SD.

mkkot commented 1 year ago

Okay, finally I used your way with SPI. It works! Finally I have what I wanted. Thanks a lot for starting this project!

I was planning to update to stable release, but... seems there's no point. There were 20 packages to update. Deb source is set to bookworm already. Kernel in the same version as on the site. I don't see any good reason to reflash it.

inindev commented 1 year ago

Glad someone can get use from this. I agree that there is not much reason to use anything after of RC4 -- the only thing I added along the way was the libpam-systemd package as it signals the ssh demon to close connections on reboot.