Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB Boot, no SD card #645

Open
Kingo71 opened this issue Jun 21, 2020 · 15 comments
Open

USB Boot, no SD card #645

Kingo71 opened this issue Jun 21, 2020 · 15 comments

Comments

@Kingo71
Copy link

Kingo71 commented Jun 21, 2020

Since the new USB boot option in the new Pi4 firmware, there is a way to have Berryboot booting from USB without any SD card (pinn already has this fuctionality)?

Thank you.

@gotouchgo
Copy link

My hunch is the BerryBoot code doesn't know the usb device partition. It may only load .img file from microSD.

@Kingo71
Copy link
Author

Kingo71 commented Jun 22, 2020

I guess, since they are very similar, that berryboot uses the same schema as PINN and NOOBS and since PINN has been updated to boot from USB without any SD card , berryboot should be able to eith the needed modifications.

@gotouchgo
Copy link

I now create a berryboot SD card and installed OS on USB SSD. I see a small 127MB fat32 partition is created on USB SSD and a copy of berryboot files are saved there. However I still can't boot it from USB SSD. The error is same: error finding or mounting boot partition. Hope the author has some quick idea. Maybe some special cmdline.txt can be used to use the USB SSD partition.

@superpowter77
Copy link

Same issue here. It works just fine from microsd Card, not from USB SSD. Same for latest PINN. Any tips how to fix it on Berryboot V2.0?

@gotouchgo
Copy link

gotouchgo commented Jun 22, 2020

I don't know how to fix the current BerryBoot v2. Maybe with the right kernel parameters in the commandline.txt file similar to the SysLinux style it could find the image files.

linux /boot/vmlinuz-linux root=/dev/sda3 initrd=/boot/initramfs-linux.img

I don't know what kind of boot loader is in Pi firmware though.

But I have succeeded with plain Pi OS image. The guide I used mentioned NOOBS image doesn't work. I have a write up here:
https://reachideas.wordpress.com/2020/06/22/raspberry-pi-os-boot-and-install-from-usb-ssd-msd/

With NOOBS image, the first partition is for recovery and the recovery image failed to load. It complains about missing fixup4rc.dat which doesn't exist.

From the files in PINN I see it is using recovery style image. BerryBoot is using OS image. Theoretically they should both be able to work if crafted to load kernel and initrd ramdisk image correctly from the boot device. Maybe something is still not right.

@gotouchgo
Copy link

From the pull request #582, there is a "bootdev=" parameter in cmdline.txt. Maybe it can be used. I also see after BerryBoot installs OS successfully, a "datadev=GUID" is added in cmdline.txt. Maybe it is the same syntax for bootdev. You can give it a try.

@gotouchgo
Copy link

gotouchgo commented Jun 23, 2020

Ha, found the answer. It is about using partition UUID. So I add bootdev in the cmdline.txt line:

bootdev=UUID=70A2-8001 elevator=deadline quiet bootmenutimeout=10

with the UUID shown by blkid command for the first fat32/vfat partition on your USB SSD.

Now the boot partition is loaded properly and Berryboot worked. The ... dot line is shown when the boot partition is being tried to mount. Look at the script in:
external/package/busybox-static/init

@Kingo71
Copy link
Author

Kingo71 commented Jun 23, 2020

Looking at the script, tou could put also bootdev=sd* .
We just need to understand which devoce name will get our SSD, I guess will be always the same if no sd card os inserted.

@gotouchgo
Copy link

gotouchgo commented Jun 23, 2020

If the SSD is your only USB storage device, it is usually sda1. But not guaranteed technically. A better script should get the list from lsblk and try the first partition on each block device to use. It can mount the partition and check if berryboot.img exists. This way it could detect the boot partition on either the microSD card or USB storage even if both are inserted at the time. This probably is a feature request to anyone interested to modify the script.

Oh lsblk is not available on the tiny busybox system.
From https://unix.stackexchange.com/questions/127186/stat-disk-drives-wihout-lsblk
this is available:
cat /proc/partitions shows the disk and partition sizes in blocks (KiB)
blkid shows the partition labels, UUIDs, and types (EXT4, NTFS, etc)

@proctologic
Copy link

proctologic commented Jun 23, 2020

137Mb fat32 partition on sda1 and added this to cmdline.txt
bootdev=sda1 elevator=deadline quiet bootmenutimeout=10
Still same error
bootdev=UUID=DB48-6850 elevator=deadline quiet bootmenutimeout=10
Error when try to partition/format the SSD

@gotouchgo
Copy link

gotouchgo commented Jun 24, 2020

Ok, first of all, because the boot partition sda1 is mounted, the code to partition/format the SSD has to be changed to not touch the boot partition. I guess current BerryBoot will wipe the entire disk, and would fail because sda1 is already mounted as /boot, and shouldn't be changed.

So right now still need to boot BerryBoot from microSD, and install to USB SSD. Then a copy of the /boot will be made on sda1. Then change the cmdline.txt on sda1 to add "bootdev=/dev/sda1,root=/dev/sda2" and it should be able to boot to the first OS you installed. Of course you should have enabled USB boot by using the 06-15 bootloader firmware and start*.elf, fixup*.dat from 05-22 firmware. I have not tried this end-to-end though.

Second, the bootdev=sda1 doesn't work. bootdev=/dev/sda1 should work. In the init script, there is a if [ $BOOTDEV == sd* ]; actually not working as expected under busybox. I found this when tweaking it. It should be written as [ ${BOOTDEV:0:2} == sd ];

@Kingo71
Copy link
Author

Kingo71 commented Jun 24, 2020

$BOOTDEV is already pointing to /dev/$BOOTDEV (/dev/sda1 if you edit the bootdev= )

if [ $BOOTDEV == sd* ]; then
BOOTDEV="/dev/$BOOTDEV"
fi

BerryBoot is also working with only the SD card and boot meu and installed OS's coexist in the same device (SD card), therefore should be possible to have everything on the external USB device.

@gotouchgo
Copy link

gotouchgo commented Jun 24, 2020

As in my last post, when set bootdev=sda1 in cmdline.txt, following test doesn't work like you think
in the tiny busybox shell.
if [ $BOOTDEV == sd* ]; then

It can be done by
if [ ${BOOTDEV:0:2} == sd ]; then

You should set bootdev=/dev/sda1 in cmdline.txt then it will be used as is to mount /dev/sda1 and find berryboot.img on it.

I found this when modifying the script (it is in bbloader.img) to let it detect other partitions from /proc/partitions.
I don't have much experience on Berryboot though. Don't know how it try to create or prepare partitions for OS installation.

In the case of microSD card, there is only one initial fat32 partition on it, berryboot probably resize it and then create OS root partition. If we start with a small (say, 0.5GB or less) fat32 partition on USB SSD, it may be confused and fail to do what it is doing to prepare partition for the OS.

Try create the first fat32 partition to 8GB size on USB SSD and put berryboot to boot on it. If it can use this 8GB partition to install an OS, then it would be great success for now.

@retro24
Copy link

retro24 commented Jan 12, 2021

hello is there any instructions on how to boot the rpi4 from a usb with berryboot step by step ?

@goesbysteve
Copy link

goesbysteve commented Jun 23, 2021

I’m assuming that this isn’t an interesting idea to follow up @maxnet? Seems this is an obvious thing people would want. If PINN has it won’t this mean people will head to that instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants