mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-23 13:06:29 +00:00
rpi: Add USB boot support (#440)
This commit is contained in:
parent
08fac89fb0
commit
fed40532c1
@ -2,7 +2,7 @@
|
||||
|
||||
Supported Hardware:
|
||||
|
||||
| Device | Board |
|
||||
| Device | Board |
|
||||
|--------|-----------|
|
||||
| Raspberry Pi A+/B/B+| rpi |
|
||||
| Raspberry Pi Zero | rpi |
|
||||
@ -21,7 +21,7 @@ For access to terminal over serial console, add `console=ttyAMA0,115200` to `cmd
|
||||
|
||||
## I2C
|
||||
|
||||
Add `dtparam=i2c1=on` and `dtparam=i2c_arm=on` to `config.txt`. After that we create a module file on host with [config usb stick][config] or direct into `/etc/modules-load.d`.
|
||||
Add `dtparam=i2c1=on` and `dtparam=i2c_arm=on` to `config.txt`. After that we create a module file on host with [config usb stick][config] or direct into `/etc/modules-load.d`.
|
||||
|
||||
rpi-i2c.conf:
|
||||
```
|
||||
@ -29,6 +29,19 @@ i2c-dev
|
||||
i2c-bcm2708
|
||||
```
|
||||
|
||||
## USB Boot
|
||||
|
||||
USB mass storage boot is available on Raspberry Pi 3B, 3B+, 3A+, and 2B v1.2.
|
||||
To enable USB boot, add `program_usb_boot_mode=1` into `config.txt`. Note that this **permanently** alters the one-time programmable memory of the device.
|
||||
|
||||
For more information see [RaspberryPi](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md).
|
||||
|
||||
### Caveats
|
||||
|
||||
* All bootable SD cards must be removed.
|
||||
* Boot time can be significantly longer with USB. This is due to the boot process first attempting to boot from SD card, failing, and resorting to USB.
|
||||
* Many USB drives simply do not work for boot. This is likely due to minimal driver support in uboot and will not be fixed. If you can't get it to boot on one drive, try a different brand/model. SanDisk Cruzer drives seem to have a higher rate of issues.
|
||||
|
||||
## Tweaks
|
||||
|
||||
If you don't need bluetooth, disabled it with add `dtoverlay=pi3-disable-bt` into `config.txt`.
|
||||
|
@ -1,15 +1,16 @@
|
||||
|
||||
part start mmc ${devnum} 6 mmc_env
|
||||
mmc dev ${devnum}
|
||||
part start ${devtype} ${devnum} 6 dev_env
|
||||
${devtype} dev ${devnum}
|
||||
|
||||
setenv loadbootstate " \
|
||||
echo 'loading env...'; \
|
||||
mmc read ${ramdisk_addr_r} ${mmc_env} 0x20; \
|
||||
${devtype} read ${ramdisk_addr_r} ${dev_env} 0x20; \
|
||||
env import -c ${ramdisk_addr_r} 0x4000;"
|
||||
|
||||
setenv storebootstate " \
|
||||
echo 'storing env...'; \
|
||||
env export -c -s 0x4000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \
|
||||
mmc write ${ramdisk_addr_r} ${mmc_env} 0x20;"
|
||||
${devtype} write ${ramdisk_addr_r} ${dev_env} 0x20;"
|
||||
|
||||
run loadbootstate
|
||||
test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B"
|
||||
@ -37,14 +38,14 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
|
||||
if test ${BOOT_A_LEFT} -gt 0; then
|
||||
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
|
||||
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
|
||||
setenv load_kernel "ext4load mmc 0:2 ${kernel_addr_r} zImage"
|
||||
setenv load_kernel "ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} zImage"
|
||||
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
|
||||
fi
|
||||
elif test "x${BOOT_SLOT}" = "xB"; then
|
||||
if test ${BOOT_B_LEFT} -gt 0; then
|
||||
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
|
||||
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
|
||||
setenv load_kernel "ext4load mmc 0:4 ${kernel_addr_r} zImage"
|
||||
setenv load_kernel "ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} zImage"
|
||||
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
|
||||
fi
|
||||
fi
|
||||
|
@ -1,15 +1,16 @@
|
||||
|
||||
part start mmc ${devnum} 6 mmc_env
|
||||
mmc dev ${devnum}
|
||||
part start ${devtype} ${devnum} 6 dev_env
|
||||
${devtype} dev ${devnum}
|
||||
|
||||
setenv loadbootstate " \
|
||||
echo 'loading env...'; \
|
||||
mmc read ${ramdisk_addr_r} ${mmc_env} 0x20; \
|
||||
${devtype} read ${ramdisk_addr_r} ${dev_env} 0x20; \
|
||||
env import -c ${ramdisk_addr_r} 0x4000;"
|
||||
|
||||
setenv storebootstate " \
|
||||
echo 'storing env...'; \
|
||||
env export -c -s 0x4000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \
|
||||
mmc write ${ramdisk_addr_r} ${mmc_env} 0x20;"
|
||||
${devtype} write ${ramdisk_addr_r} ${dev_env} 0x20;"
|
||||
|
||||
run loadbootstate
|
||||
test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B"
|
||||
@ -37,14 +38,14 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do
|
||||
if test ${BOOT_A_LEFT} -gt 0; then
|
||||
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
|
||||
echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining"
|
||||
setenv load_kernel "ext4load mmc 0:2 ${kernel_addr_r} Image"
|
||||
setenv load_kernel "ext4load ${devtype} ${devnum}:2 ${kernel_addr_r} Image"
|
||||
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_a} rauc.slot=A"
|
||||
fi
|
||||
elif test "x${BOOT_SLOT}" = "xB"; then
|
||||
if test ${BOOT_B_LEFT} -gt 0; then
|
||||
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
|
||||
echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining"
|
||||
setenv load_kernel "ext4load mmc 0:4 ${kernel_addr_r} Image"
|
||||
setenv load_kernel "ext4load ${devtype} ${devnum}:4 ${kernel_addr_r} Image"
|
||||
setenv bootargs "${bootargs_hassos} ${bootargs_rpi} ${bootargs_b} rauc.slot=B"
|
||||
fi
|
||||
fi
|
||||
|
@ -2,3 +2,8 @@
|
||||
# CONFIG_DOS_PARTITION is not set
|
||||
CONFIG_CMD_FILEENV=y
|
||||
CONFIG_ENV_IS_NOWHERE=Y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_FUNCTION_MASS_STORAGE=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_GENERIC=y
|
||||
CONFIG_USB_OHCI_HCD=y
|
||||
|
Loading…
x
Reference in New Issue
Block a user