Raspberry pi 4 usb boot

did search around a bit (no info on rpi4 wiki page or i missed?) but i'm really not sure:

i flashed official 21.02 image (rpi-4-squashfs-factory.img) to an usb stick (4gb) but it does not boot (rpi has correct firmware with usb boot, working with rasp os), would editing cmdline.txt to

##console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait
console=serial0,115200 console=tty1 root=/dev/sda2 rootfstype=squashfs,ext4 rootwait

be the correct way to go? my guess was that since originally it looks on second partition of sd card pointing to second partition of usb would be correct? would this mess up future sysupgrades (with official rpi-4-squashfs-sysupgrade.img)?? or should i include this change somehow maybe with imagebuilder??

thank you

1 Like

yes, that is the correct way to go

I wish the openwrt image would simply use

root=PARTUUID=5452574f-02

Then USB boot would work out of the box

Personally, I make the change in imagebuilder if I want to upgrade (I also make the root partition larger, but then, I am running a 128GB SSD :stuck_out_tongue:

1 Like

so i modified this in imagebuilder directory to boot from usb

target/linux/bcm27xx/image/cmdline.txt

console=serial0,115200 console=tty1 root=/dev/sda2 rootfstype=squashfs,ext4 rootwait

and this for some extra space

.config

CONFIG_TARGET_ROOTFS_PARTSIZE=512

and why not? :stuck_out_tongue_winking_eye:

target/linux/bcm27xx/image/config.txt

# Place your custom settings here.
over_voltage=2
arm_freq=1750

generated image with my configuration files (mainly for wireless management)

make image PROFILE="rpi-4" PACKAGES="my packages list" FILES="files/"

and wrote (dd) the factory image to usb stick and it's booting/working correctly. i made some changes to the files directory and generated a new image, flashed the sysupgrade image out of curiosity with out retaining settings and it's working correctly but my guess is that it's not "resetting" the configuration (maybe luci or the sysupgade process is trying to erase from sdcard not usb?) so i performed a factory reset from luci and that worked, everything was correctly configured as per my files in image.

2 Likes

I'd personally go with root=PARTUUID=5452574f-02 for pure flexibility - then, it won't matter if you write that image to an SD card - it'll work - also, if you add a second USB drive, I'm not sure how reliable/consistent drive device naming is ... i.e. is the boot drive guaranteed to be /dev/sda?

Since OpenWRT "disk id" is hard coded to 5452574f (That's TRWO in ascii) it should be a safe bet

Oh! ok! i didn't catch your suggestion in your first post but this make a lot of sense :slight_smile: i did change to root=PARTUUID=5452574f-02 and rasp boots fine, only "strange" thing left is sysupgrade -n from terminal or not retaining setting from luci still keeps settings and have to perform a factory reset after sysupgrade.. the config difference for testing in the new sysupgrade image are correctly in place after reset.. guess i can live with that.

sysupgrade for this target is currently not setup to handle usb...

you can probably trick it (setting save and restore logic) by leaving a blank formatted vfat partition on sdcard in the device...

otherwise assume your settings will be lost and perform manual backup and restore (if not factory flash) each upgrade...

i think i'm facing the opposite, i want to lose all settings.. flashing sysupgrade image does not delete all settings ( -n from terminal or not retaining setting from luci), have to perform a factory reset after flash.. who knows :stuck_out_tongue:

squashfs filesystem?

yes squashfs, imagebuilde with package and files so the result is a fully working image so no need to keep settings..

1 Like

I don't get why would you want to set up from scratch every time?

all packages are included in image and fully working personal configuration is included in image with imagabuilder "files" option, so the image i'm flashing is fully working out of the box no need to save configuration/re-configure whatsoever.. i can also test as much as i want and just factory reset to my working config when i'm done.. i'm not starting from scratch but from a perfectly working image :smiley:

1 Like

Thank you for teaching me something useful!!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.