# Raspberry pi 4 usb boot

**URL:** <https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646>\
**Category:** Installing and Using OpenWrt\
**Created:** [October 21, 2021, 8:23am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646 "2021-10-21T08:23:30Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mojifax](https://forum.openwrt.org/letter_avatar/mojifax/32/6_449c533f586939b6e5f246632a46421f.png) [@mojifax](https://forum.openwrt.org/u/mojifax)\
**Post date:** [October 21, 2021, 8:23am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/1 "2021-10-21T08:23:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jaromanda](https://forum.openwrt.org/user_avatar/forum.openwrt.org/jaromanda/32/6228_2.png) [@jaromanda](https://forum.openwrt.org/u/jaromanda)\
**Post date:** [October 21, 2021, 9:03am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/2 "2021-10-21T09:03:48Z")

</div>

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 😛

---

<div class="post-metadata">

**Author:** ![mojifax](https://forum.openwrt.org/letter_avatar/mojifax/32/6_449c533f586939b6e5f246632a46421f.png) [@mojifax](https://forum.openwrt.org/u/mojifax)\
**Post date:** [October 22, 2021, 2:40am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/3 "2021-10-22T02:40:35Z")

</div>

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? 😜

```
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.

---

<div class="post-metadata">

**Author:** ![jaromanda](https://forum.openwrt.org/user_avatar/forum.openwrt.org/jaromanda/32/6228_2.png) [@jaromanda](https://forum.openwrt.org/u/jaromanda)\
**Post date:** [October 22, 2021, 3:23am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/4 "2021-10-22T03:23:45Z")

</div>

> [@mojifax](#):
>
> `console=serial0,115200 console=tty1 root=/dev/sda2 rootfstype=squashfs,ext4 rootwait`

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

---

<div class="post-metadata">

**Author:** ![mojifax](https://forum.openwrt.org/letter_avatar/mojifax/32/6_449c533f586939b6e5f246632a46421f.png) [@mojifax](https://forum.openwrt.org/u/mojifax)\
**Post date:** [October 23, 2021, 1:29am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/5 "2021-10-23T01:29:12Z")

</div>

> [@jaromanda](#):
>
> Since OpenWRT "disk id" is hard coded

Oh! ok! i didn't catch your suggestion in your first post but this make a lot of sense 🙂 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.

---

<div class="post-metadata">

**Author:** ![anon50098793](https://forum.openwrt.org/letter_avatar/anon50098793/32/6_449c533f586939b6e5f246632a46421f.png) [@anon50098793](https://forum.openwrt.org/u/anon50098793)\
**Post date:** [October 23, 2021, 1:36am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/6 "2021-10-23T01:36:12Z")

</div>

sysupgrade for this target is currently [not setup to handle usb](https://forum.openwrt.org/t/rpi4-community-build/69998/161)...

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...

---

<div class="post-metadata">

**Author:** ![mojifax](https://forum.openwrt.org/letter_avatar/mojifax/32/6_449c533f586939b6e5f246632a46421f.png) [@mojifax](https://forum.openwrt.org/u/mojifax)\
**Post date:** [October 23, 2021, 1:54am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/7 "2021-10-23T01:54:24Z")

</div>

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 😛

---

<div class="post-metadata">

**Author:** ![anon50098793](https://forum.openwrt.org/letter_avatar/anon50098793/32/6_449c533f586939b6e5f246632a46421f.png) [@anon50098793](https://forum.openwrt.org/u/anon50098793)\
**Post date:** [October 23, 2021, 1:55am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/8 "2021-10-23T01:55:49Z")

</div>

squashfs filesystem?

---

<div class="post-metadata">

**Author:** ![mojifax](https://forum.openwrt.org/letter_avatar/mojifax/32/6_449c533f586939b6e5f246632a46421f.png) [@mojifax](https://forum.openwrt.org/u/mojifax)\
**Post date:** [October 23, 2021, 1:58am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/9 "2021-10-23T01:58:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jaromanda](https://forum.openwrt.org/user_avatar/forum.openwrt.org/jaromanda/32/6228_2.png) [@jaromanda](https://forum.openwrt.org/u/jaromanda)\
**Post date:** [October 23, 2021, 2:40am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/10 "2021-10-23T02:40:44Z")

</div>

> [@mojifax](#):
>
> so no need to keep settings

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

---

<div class="post-metadata">

**Author:** ![mojifax](https://forum.openwrt.org/letter_avatar/mojifax/32/6_449c533f586939b6e5f246632a46421f.png) [@mojifax](https://forum.openwrt.org/u/mojifax)\
**Post date:** [October 23, 2021, 4:19am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/11 "2021-10-23T04:19:58Z")

</div>

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 😃

---

<div class="post-metadata">

**Author:** ![jaromanda](https://forum.openwrt.org/user_avatar/forum.openwrt.org/jaromanda/32/6228_2.png) [@jaromanda](https://forum.openwrt.org/u/jaromanda)\
**Post date:** [October 23, 2021, 4:37am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/12 "2021-10-23T04:37:04Z")

</div>

> [@mojifax](#):
>
> imagabuilder "files" option

Thank you for teaching me something useful!!

---

<div class="post-metadata">

**Author:** ![system](https://forum.openwrt.org/uploads/default/original/3X/7/4/740520c71f00039bbf001045c682f0ecb25e905a.png) [@system](https://forum.openwrt.org/u/system)\
**Post date:** [November 2, 2021, 4:37am UTC](https://forum.openwrt.org/t/raspberry-pi-4-usb-boot/109646/13 "2021-11-02T04:37:19Z")

</div>

Closed on November 2, 2021, 4:37am UTC

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