2015-02-24 23:42:22 +01:00
|
|
|
Raspberry Pi
|
2013-03-25 14:27:56 +01:00
|
|
|
|
|
|
|
Intro
|
|
|
|
=====
|
|
|
|
|
2015-02-24 23:42:22 +01:00
|
|
|
These instructions apply to all models of the Raspberry Pi:
|
|
|
|
- the original models A and B,
|
|
|
|
- the "enhanced" models A+ and B+,
|
|
|
|
- the model B2 (aka Raspberry Pi 2).
|
|
|
|
|
|
|
|
To be able to use your Raspberry Pi board with the images generated by
|
2013-11-06 00:28:18 +01:00
|
|
|
Buildroot, you have to choose whether you will use:
|
|
|
|
|
|
|
|
* Volatile rootfs in RAM (the rootfs is an initramfs) or
|
|
|
|
* Persistent rootfs on the SDCard
|
2013-03-25 14:27:56 +01:00
|
|
|
|
|
|
|
Also, a good source of information is http://elinux.org/R-Pi_Hub
|
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
How to build it
|
2013-03-25 14:27:56 +01:00
|
|
|
===============
|
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Configure Buildroot
|
|
|
|
-------------------
|
|
|
|
|
2013-11-10 13:16:22 +01:00
|
|
|
The raspberrypi_defconfig configuration is a minimal configuration with
|
|
|
|
all that is required to bring the Raspberry Pi. You should base your
|
|
|
|
work on this defconfig:
|
2013-11-06 00:28:18 +01:00
|
|
|
|
2013-11-10 13:16:22 +01:00
|
|
|
$ make raspberrypi_defconfig
|
2013-11-06 00:28:18 +01:00
|
|
|
|
2015-01-10 14:14:58 +01:00
|
|
|
Alternatively, if you want to test support for the Device Tree:
|
|
|
|
|
|
|
|
$ make raspberrypi_dt_defconfig
|
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
If you want to use a persistent rootfs, skip to "Build the rootfs", below.
|
|
|
|
|
|
|
|
For a volatile rootfs, you have to slightly adjust the configuration:
|
|
|
|
|
|
|
|
$ make menuconfig
|
|
|
|
* Select "Filesystem images"
|
|
|
|
* Select "initial RAM filesystem linked into linux kernel"
|
|
|
|
|
|
|
|
You may also deselect "tar the root filesystem".
|
|
|
|
|
|
|
|
Build the rootfs
|
|
|
|
----------------
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Note: you will need to have access to the network, since Buildroot will
|
|
|
|
download the packages' sources.
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
You may now build your rootfs with:
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
$ make
|
|
|
|
|
|
|
|
(This may take a while; consider getting yourself a coffee ;-) )
|
|
|
|
|
|
|
|
Result of the build
|
|
|
|
-------------------
|
2013-03-25 14:27:56 +01:00
|
|
|
|
|
|
|
After building, you should obtain this tree:
|
|
|
|
|
|
|
|
output/images/
|
2015-01-10 14:14:58 +01:00
|
|
|
+-- rootfs.tar [0]
|
|
|
|
+-- rpi-firmware/
|
2015-03-08 16:22:53 +01:00
|
|
|
| +-- bcm2708-rpi-b.dtb
|
|
|
|
| +-- bcm2708-rpi-b-plus.dtb
|
|
|
|
| +-- bcm2709-rpi-2-b.dtb
|
2013-11-06 00:28:18 +01:00
|
|
|
| +-- bootcode.bin
|
|
|
|
| +-- config.txt
|
|
|
|
| +-- fixup.dat
|
|
|
|
| `-- start.elf
|
2013-03-25 14:27:56 +01:00
|
|
|
`-- zImage
|
|
|
|
|
2015-01-10 14:14:58 +01:00
|
|
|
[0] Note for Volatile: rootfs.tar will only be there if you kept
|
|
|
|
"tar the root filesystem" option selected in "Filesystem images".
|
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Prepare you SDCard
|
|
|
|
==================
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
For more information, visit
|
|
|
|
http://elinux.org/RPi_Advanced_Setup#Advanced_SD_card_setup
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
In summary, your SDCard must have first partition in fat32 and marked bootable.
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Create the required partitions:
|
|
|
|
- for a persistent rootfs, 10MiB is enough memory for the boot fat32
|
|
|
|
partition, and a second partition is required for the root filesystem
|
|
|
|
- for a volatile rootfs, 50MiB is required for the boot fat32 partition
|
2013-03-25 14:27:56 +01:00
|
|
|
|
|
|
|
Note: You can create any number of partitions you desire, the only requirement
|
2013-11-06 00:28:18 +01:00
|
|
|
is that the first partition must be using fat32 and be bootable.
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Mount the partitions (adjust 'sdX' to match your SDcard device):
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
$ sudo mount /dev/sdX1 /mnt/mountpointboot
|
|
|
|
$ sudo mount /dev/sdX2 /mnt/mountpointroot (only for persistent rootfs)
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Install the binaries to the SDCard
|
|
|
|
----------------------------------
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2015-02-24 23:42:22 +01:00
|
|
|
At the root of the boot partition, the Raspberry Pi must find the following
|
2013-11-06 00:28:18 +01:00
|
|
|
files:
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2015-03-08 16:22:53 +01:00
|
|
|
* bcm2708-rpi-b.dtb [1]
|
2015-01-10 14:14:58 +01:00
|
|
|
* bcm2708-rpi-b-plus.dtb [2]
|
2015-03-08 16:22:53 +01:00
|
|
|
* bcm2709-rpi-2-b.dtb [3]
|
2013-11-06 00:28:18 +01:00
|
|
|
* bootcode.bin
|
|
|
|
* config.txt
|
|
|
|
* fixup.dat
|
|
|
|
* start.elf
|
|
|
|
* zImage
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2015-03-08 16:22:53 +01:00
|
|
|
[1] For models A and B
|
|
|
|
[2] For models A+ and B+
|
|
|
|
[3] For model 2
|
2015-01-10 14:14:58 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
For example:
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
$ cp output/images/rpi-firmware/* /mnt/mountpointboot
|
2015-01-10 14:14:58 +01:00
|
|
|
|
|
|
|
If your kernel does *not* have support for the Device Tree, then install
|
|
|
|
it with:
|
|
|
|
|
2014-01-15 10:19:22 +01:00
|
|
|
$ cp output/images/zImage /mnt/mountpointboot
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2015-01-10 14:14:58 +01:00
|
|
|
If your kernel *does* have support for the Device Tree, then install it
|
|
|
|
with:
|
|
|
|
|
|
|
|
$ ./output/host/usr/bin/mkknlimg output/images/zImage /mnt/mountpointboot/zImage
|
|
|
|
|
2014-01-15 10:19:22 +01:00
|
|
|
Note: The kernel image file name is defined in config.txt like this:
|
2013-11-06 00:28:18 +01:00
|
|
|
kernel=zImage
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
If you use a volatile rootfs, Skip to "Finish", below. For a persistent
|
|
|
|
rootfs, there are further steps to do.
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Extract (as root!) the contents of the rootfs.tar archive into the second
|
|
|
|
partition you created above:
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2015-01-23 22:05:08 +01:00
|
|
|
$ sudo tar xf ./output/images/rootfs.tar -C /mnt/mountpointroot
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Finish
|
|
|
|
======
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Unmount all the partitions:
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
$ sudo umount /mnt/mountpointboot
|
|
|
|
$ sudo umount /mnt/mountpointroot (only for persistent rootfs)
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
And eject your SDcard from your computer SDcard reader.
|
2013-03-25 14:27:56 +01:00
|
|
|
|
2013-11-06 00:28:18 +01:00
|
|
|
Insert the SDcard into your Raspberry Pi, and power it up. Your new system
|
|
|
|
should come up, now.
|