configs/raspberrypi*: update them to use genimage
Update the raspberrypi and raspberrypi2 configs to use genimage directly to build the image. Update the documentation to reflect this, and drop the volatile rootfs option since it doesn't make much sense and it's not easily integrated with the genimage configurations. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
217171565f
commit
8dd797a054
31
board/raspberrypi/genimage-raspberrypi.cfg
Normal file
31
board/raspberrypi/genimage-raspberrypi.cfg
Normal file
@ -0,0 +1,31 @@
|
||||
image boot.vfat {
|
||||
vfat {
|
||||
files = {
|
||||
"bcm2708-rpi-b.dtb",
|
||||
"bcm2708-rpi-b-plus.dtb",
|
||||
"rpi-firmware/bootcode.bin",
|
||||
"rpi-firmware/cmdline.txt",
|
||||
"rpi-firmware/config.txt",
|
||||
"rpi-firmware/fixup.dat",
|
||||
"rpi-firmware/start.elf",
|
||||
"kernel-marked/zImage"
|
||||
}
|
||||
}
|
||||
size = 32M
|
||||
}
|
||||
|
||||
image sdcard.img {
|
||||
hdimage {
|
||||
}
|
||||
|
||||
partition boot {
|
||||
partition-type = 0xC
|
||||
bootable = "true"
|
||||
image = "boot.vfat"
|
||||
}
|
||||
|
||||
partition rootfs {
|
||||
partition-type = 0x83
|
||||
image = "rootfs.ext4"
|
||||
}
|
||||
}
|
30
board/raspberrypi/genimage-raspberrypi2.cfg
Normal file
30
board/raspberrypi/genimage-raspberrypi2.cfg
Normal file
@ -0,0 +1,30 @@
|
||||
image boot.vfat {
|
||||
vfat {
|
||||
files = {
|
||||
"bcm2709-rpi-2-b.dtb",
|
||||
"rpi-firmware/bootcode.bin",
|
||||
"rpi-firmware/cmdline.txt",
|
||||
"rpi-firmware/config.txt",
|
||||
"rpi-firmware/fixup.dat",
|
||||
"rpi-firmware/start.elf",
|
||||
"kernel-marked/zImage"
|
||||
}
|
||||
}
|
||||
size = 32M
|
||||
}
|
||||
|
||||
image sdcard.img {
|
||||
hdimage {
|
||||
}
|
||||
|
||||
partition boot {
|
||||
partition-type = 0xC
|
||||
bootable = "true"
|
||||
image = "boot.vfat"
|
||||
}
|
||||
|
||||
partition rootfs {
|
||||
partition-type = 0x83
|
||||
image = "rootfs.ext4"
|
||||
}
|
||||
}
|
22
board/raspberrypi/post-image.sh
Executable file
22
board/raspberrypi/post-image.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
BOARD_DIR="$(dirname $0)"
|
||||
BOARD_NAME="$(basename ${BOARD_DIR})"
|
||||
GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
|
||||
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
|
||||
|
||||
# Mark the kernel as DT-enabled
|
||||
mkdir -p "${BINARIES_DIR}/kernel-marked"
|
||||
${HOST_DIR}/usr/bin/mkknlimg "${BINARIES_DIR}/zImage" \
|
||||
"${BINARIES_DIR}/kernel-marked/zImage"
|
||||
|
||||
rm -rf "${GENIMAGE_TMP}"
|
||||
|
||||
genimage \
|
||||
--rootpath "${TARGET_DIR}" \
|
||||
--tmppath "${GENIMAGE_TMP}" \
|
||||
--inputpath "${BINARIES_DIR}" \
|
||||
--outputpath "${BINARIES_DIR}" \
|
||||
--config "${GENIMAGE_CFG}"
|
||||
|
||||
exit $?
|
@ -8,14 +8,6 @@ These instructions apply to all models of the Raspberry Pi:
|
||||
- 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
|
||||
Buildroot, you have to choose whether you will use:
|
||||
|
||||
* Volatile rootfs in RAM (the rootfs is an initramfs) or
|
||||
* Persistent rootfs on the SDCard
|
||||
|
||||
Also, a good source of information is http://elinux.org/R-Pi_Hub
|
||||
|
||||
How to build it
|
||||
===============
|
||||
|
||||
@ -33,16 +25,6 @@ And for model 2 B:
|
||||
|
||||
$ make raspberrypi2_defconfig
|
||||
|
||||
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
|
||||
----------------
|
||||
|
||||
@ -53,7 +35,7 @@ You may now build your rootfs with:
|
||||
|
||||
$ make
|
||||
|
||||
(This may take a while; consider getting yourself a coffee ;-) )
|
||||
(This may take a while, consider getting yourself a coffee ;-) )
|
||||
|
||||
Result of the build
|
||||
-------------------
|
||||
@ -61,93 +43,35 @@ Result of the build
|
||||
After building, you should obtain this tree:
|
||||
|
||||
output/images/
|
||||
+-- rootfs.tar [0]
|
||||
+-- rpi-firmware/
|
||||
| +-- bootcode.bin
|
||||
| +-- config.txt
|
||||
| +-- fixup.dat
|
||||
| `-- start.elf
|
||||
+-- bcm2708-rpi-b.dtb [1]
|
||||
+-- bcm2708-rpi-b-plus.dtb [1]
|
||||
+-- bcm2709-rpi-2-b.dtb [1]
|
||||
+-- boot.vfat
|
||||
+-- kernel-marked/zImage [2]
|
||||
+-- rootfs.ext4
|
||||
+-- rpi-firmware/
|
||||
| +-- bootcode.bin
|
||||
| +-- cmdline.txt
|
||||
| +-- config.txt
|
||||
| +-- fixup.dat
|
||||
| `-- start.elf
|
||||
+-- sdcard.img
|
||||
`-- zImage
|
||||
|
||||
[0] Note for Volatile: rootfs.tar will only be there if you kept
|
||||
"tar the root filesystem" option selected in "Filesystem images".
|
||||
|
||||
[1] Not all of them will be present, depending on the RaspberryPi
|
||||
model you are using.
|
||||
|
||||
Prepare you SDCard
|
||||
==================
|
||||
[2] This is the mkknlimg DT-marked kernel.
|
||||
|
||||
For more information, visit
|
||||
http://elinux.org/RPi_Advanced_Setup#Advanced_SD_card_setup
|
||||
How to write the SD card
|
||||
========================
|
||||
|
||||
In summary, your SDCard must have first partition in fat32 and marked bootable.
|
||||
Once the build process is finished you will have an image called "sdcard.img"
|
||||
in the output/images/ directory.
|
||||
|
||||
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
|
||||
Copy the bootable "sdcard.img" onto an SD card with "dd":
|
||||
|
||||
Note: You can create any number of partitions you desire, the only requirement
|
||||
is that the first partition must be using fat32 and be bootable.
|
||||
|
||||
Mount the partitions (adjust 'sdX' to match your SDcard device):
|
||||
|
||||
$ sudo mount /dev/sdX1 /mnt/mountpointboot
|
||||
$ sudo mount /dev/sdX2 /mnt/mountpointroot (only for persistent rootfs)
|
||||
|
||||
Install the binaries to the SDCard
|
||||
----------------------------------
|
||||
|
||||
At the root of the boot partition, the Raspberry Pi must find the following
|
||||
files:
|
||||
|
||||
* bcm2708-rpi-b.dtb [2]
|
||||
* bcm2708-rpi-b-plus.dtb [3]
|
||||
* bcm2709-rpi-2-b.dtb [4]
|
||||
* bootcode.bin
|
||||
* config.txt
|
||||
* fixup.dat
|
||||
* start.elf
|
||||
* zImage
|
||||
|
||||
[2] For models A and B
|
||||
[3] For models A+ and B+
|
||||
[4] For model 2
|
||||
|
||||
For example:
|
||||
|
||||
$ cp output/images/rpi-firmware/* /mnt/mountpointboot
|
||||
$ cp output/images/*.dtb /mnt/mountpointboot
|
||||
|
||||
The kernel image must be marked with a special header so that the
|
||||
bootloader of the RaspberryPi knows it supports Device Tree:
|
||||
|
||||
$ ./output/host/usr/bin/mkknlimg output/images/zImage /mnt/mountpointboot/zImage
|
||||
|
||||
Note: The kernel image file name is defined in config.txt like this:
|
||||
kernel=zImage
|
||||
|
||||
If you use a volatile rootfs, Skip to "Finish", below. For a persistent
|
||||
rootfs, there are further steps to do.
|
||||
|
||||
Extract (as root!) the contents of the rootfs.tar archive into the second
|
||||
partition you created above:
|
||||
|
||||
$ sudo tar xf ./output/images/rootfs.tar -C /mnt/mountpointroot
|
||||
|
||||
Finish
|
||||
======
|
||||
|
||||
Unmount all the partitions:
|
||||
|
||||
$ sudo umount /mnt/mountpointboot
|
||||
$ sudo umount /mnt/mountpointroot (only for persistent rootfs)
|
||||
|
||||
And eject your SDcard from your computer SDcard reader.
|
||||
$ sudo dd if=output/images/sdcard.img of=/dev/sdX
|
||||
|
||||
Insert the SDcard into your Raspberry Pi, and power it up. Your new system
|
||||
should come up, now.
|
||||
should come up now.
|
||||
|
@ -26,3 +26,14 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2709-rpi-2-b"
|
||||
|
||||
BR2_PACKAGE_RPI_FIRMWARE=y
|
||||
# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
|
||||
|
||||
# Required tools to create the SD image
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
|
||||
# Filesystem / image
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi2/post-image.sh"
|
||||
|
@ -25,3 +25,14 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-b bcm2708-rpi-b-plus"
|
||||
|
||||
BR2_PACKAGE_RPI_FIRMWARE=y
|
||||
# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
|
||||
|
||||
# Required tools to create the SD image
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
|
||||
# Filesystem / image
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi/post-image.sh"
|
||||
|
Loading…
Reference in New Issue
Block a user