Commit e368f773985ddcb3b7ac8daa7c96eef7b4e82693
1 parent
a76bbdb6
Add a little documentation
Showing
1 changed file
with
16 additions
and
36 deletions
Readme.md
| 1 | # USB boot code | 1 | # USB boot code |
| 2 | 2 | ||
| 3 | -This is the USB MSD boot code which should work on the Raspberry Pi model A and the Compute Module. | 3 | +This is the USB MSD boot code which should work on the Raspberry Pi model A, Compute Module, Compute |
| 4 | +module 3 and Raspberry Pi Zero. | ||
| 4 | 5 | ||
| 5 | -The BCM2835 device has a number of different modes for booting, the most obvious one is the SD card | ||
| 6 | -which looks for a file called bootcode.bin on the first FAT partition of the SD card to boot from. | ||
| 7 | - | ||
| 8 | -The second method it can use is USB, the BCM2835 becomes a USB device which a standard PC (a Windows | ||
| 9 | -or Linux PC or even a Raspberry Pi) will enumerate. The usbbootcode.bin is then squirted down the USB | ||
| 10 | -to the BCM2835. | ||
| 11 | - | ||
| 12 | -This is then executing the second stage boot process that normally looks for a file called config.txt | ||
| 13 | -and start.elf on the SD card and loads start.elf (or whatever version of start you require depending | ||
| 14 | -on the settings in config.txt). | ||
| 15 | - | ||
| 16 | -With usbbootcode.bin it re-enumerates as a device (but this time with a serial number of 1 to distinguish | ||
| 17 | -the second stage from the primary boot) and waits for a message packet from the host. After | ||
| 18 | -The message packet it receives the data (the length is in the message packet), and it then checks the | ||
| 19 | -length of the downloaded information (should be an .elf file either msd.elf or buildroot.elf), if the | ||
| 20 | -length is greater than the size of the elf file, it assumes the rest of the data is a FAT16 image of a | ||
| 21 | -filesystem as created using the Raspberry Pi buildroot target raspberrypi_defconfig | 6 | +This version of rpiboot has been modified to work from directories which contain the booting |
| 7 | +firmware. There is a default directory msd/ which contains bootcode.bin and start.elf to turn | ||
| 8 | +the Raspberry Pi device into a USB Mass Storage Device (MSD). | ||
| 22 | 9 | ||
| 23 | ## Building | 10 | ## Building |
| 24 | 11 | ||
| 25 | Clone this on your Pi or an Ubuntu linux machine | 12 | Clone this on your Pi or an Ubuntu linux machine |
| 26 | 13 | ||
| 27 | ``` | 14 | ``` |
| 28 | -$ git clone --depth=1 https://github.com/raspberrypi/tools | ||
| 29 | -$ cd tools/usbboot | 15 | +$ git clone --depth=1 https://github.com/raspberrypi/usbboot |
| 16 | +$ cd usbboot | ||
| 30 | $ sudo apt-get install libusb-1.0-0-dev | 17 | $ sudo apt-get install libusb-1.0-0-dev |
| 31 | $ make | 18 | $ make |
| 32 | $ sudo make install | 19 | $ sudo make install |
| 33 | $ sudo rpiboot | 20 | $ sudo rpiboot |
| 34 | ``` | 21 | ``` |
| 35 | 22 | ||
| 36 | -Checkout the upstream buildroot from git | 23 | +## Running your own (not MSD) build |
| 37 | 24 | ||
| 38 | -``` | ||
| 39 | -git clone git://git.buildroot.net/buildroot | ||
| 40 | -``` | ||
| 41 | - | ||
| 42 | -Patch with Pi patches (requires raspberrypi/tools from above) | 25 | +If you would like to boot the Raspberry Pi with a standard build you just need to copy the FAT partition |
| 26 | +files into a subdirectory (it must have at the minimum bootcode.bin and start.elf). If you take a | ||
| 27 | +standard firmware release then this will at the very least boot the linux kernel which will then stop | ||
| 28 | +(and possibly crash!) when it looks for a filesystem. To provide a filesystem there are many options, | ||
| 29 | +you can build an initramfs into the kernel, add an initramfs to the boot directory or provide some | ||
| 30 | +other interface to the filesystem. | ||
| 43 | 31 | ||
| 44 | ``` | 32 | ``` |
| 45 | -cd buildroot | ||
| 46 | -patch -p1 < ../tools/usbboot/buildroot.patch | ||
| 47 | -make raspberrypi_defconfig | ||
| 48 | -make | 33 | +$ sudo rpiboot -d boot |
| 49 | ``` | 34 | ``` |
| 50 | 35 | ||
| 51 | -Note: you'll need superuser password to finish the build and create the image | ||
| 52 | - | ||
| 53 | -Running | 36 | +This will serve the boot directory to the Raspberry Pi Device. |
| 54 | 37 | ||
| 55 | -``` | ||
| 56 | -sudo rpiboot -b buildroot/output/images/fatimage | ||
| 57 | -``` |