kumquat-buildroot/board/raspberrypi
Peter Seiderer 689b9ac439 package/rpi-firmware: rework boot/config file handling
Try to be less smart (focused on the one target/one use-case),
instead reduce the rpi-firmware package to a selectable list
of (verbatim) installed firmware files.

- change rpi-firmware config handling from rpi-variant/rpi-flavour
  choices to bootcode.bin, pi-default/-extended/-cut-down and
  pi4-/default/-extended/-cut-down selection

- add BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE option to select installable
  config.txt file

- remove config.txt modify code/handling from raspberry post-image.sh
  script

- add different customized config.txt files to the raspberry board
  section

- change dtoverlay krnbt from 'dtoverlay=miniuart-bt,krnbt=on' to extra line
  with explanation comment

- change raspberry defconfigs to select appropiate rpi-firmware
  and config.txt files

- change genimage-raspberrypi4.cfg/genimage-raspberrypi4-64.cfg to
  use start4.elf and fixup4.dat

- update board/raspberrypi/readme.txt (add optional files fixup4.dat,
  start4.elf and zImage)

With this changes a better support for custom use-cases should
be possible, specially multi-target SD cards as suggested by
Stefan Agner ([1]).

[1] http://lists.busybox.net/pipermail/buildroot/2021-February/303318.html

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
[yann.morin.1998@free.fr: fix case of no config.txt provided]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-17 22:11:41 +02:00
..
config_0w.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_3_64bit.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_3_qt5we.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_3.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_4_64bit.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_4.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_cm4io_64bit.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_cm4io.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
config_default.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
genimage-raspberrypi0.cfg configs/raspberrypi0: use dedicated rpi0 dts file 2019-09-15 14:54:29 +02:00
genimage-raspberrypi0w.cfg configs/raspberrypi0w: fix dts file name after kernel bump 2019-09-15 14:54:14 +02:00
genimage-raspberrypi2.cfg
genimage-raspberrypi3-64.cfg Fix rasberry Pi 64bit firmware overlay inclusion 2019-04-14 00:09:56 +02:00
genimage-raspberrypi3.cfg board/raspberrypi: add support for rpi3 b+ 2018-04-06 21:49:18 +02:00
genimage-raspberrypi4-64.cfg package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
genimage-raspberrypi4.cfg package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
genimage-raspberrypi.cfg
genimage-raspberrypicm4io-64.cfg package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
genimage-raspberrypicm4io.cfg package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
post-build.sh
post-image.sh package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00
readme.txt package/rpi-firmware: rework boot/config file handling 2021-10-17 22:11:41 +02:00

Raspberry Pi

Intro
=====

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)
  - the model B3 (aka Raspberry Pi 3).
  - the model B4 (aka Raspberry Pi 4).
  - the model CM4 (aka Raspberry Pi Compute Module 4 and IO Board).

How to build it
===============

Configure Buildroot
-------------------

There are two RaspberryPi defconfig files in Buildroot, one for each
major variant, which you should base your work on:

For models A, B, A+ or B+:

  $ make raspberrypi_defconfig

For model Zero (model A+ in smaller form factor):

  $ make raspberrypi0_defconfig

For model 2 B:

  $ make raspberrypi2_defconfig

For model 3 B and B+:

  $ make raspberrypi3_defconfig

or for model 3 B and B+ (64 bit):

  $ make raspberrypi3_64_defconfig

For model 4 B:

  $ make raspberrypi4_defconfig

or for model 4 B (64 bit):

  $ make raspberrypi4_64_defconfig

For model CM4 (on IO Board):

  $ make raspberrypicm4io_defconfig

or for CM4 (on IO Board - 64 bit):

  $ make raspberrypicm4io_64_defconfig

Build the rootfs
----------------

Note: you will need to have access to the network, since Buildroot will
download the packages' sources.

You may now build your rootfs with:

  $ make

(This may take a while, consider getting yourself a coffee ;-) )

Result of the build
-------------------

After building, you should obtain this tree:

    output/images/
    +-- bcm2708-rpi-b.dtb           [1]
    +-- bcm2708-rpi-b-plus.dtb      [1]
    +-- bcm2709-rpi-2-b.dtb         [1]
    +-- bcm2710-rpi-3-b.dtb         [1]
    +-- bcm2710-rpi-3-b-plus.dtb    [1]
    +-- bcm2711-rpi-4-b.dtb         [1]
    +-- bcm2711-rpi-cm4.dtb         [1]
    +-- boot.vfat
    +-- rootfs.ext4
    +-- rpi-firmware/
    |   +-- bootcode.bin
    |   +-- cmdline.txt
    |   +-- config.txt
    |   +-- fixup.dat               [1]
    |   +-- fixup4.dat              [1]
    |   +-- start.elf               [1]
    |   +-- start4.elf              [1]
    |   `-- overlays/               [2]
    +-- sdcard.img
    +-- Image                       [1]
    `-- zImage                      [1]

[1] Not all of them will be present, depending on the RaspberryPi
    model you are using.

[2] Only for the Raspberry Pi 3/4 Models (overlay miniuart-bt is needed
    to enable the RPi3 serial console otherwise occupied by the bluetooth
    chip). Alternative would be to disable the serial console in cmdline.txt
    and /etc/inittab.

How to write the SD card
========================

Once the build process is finished you will have an image called "sdcard.img"
in the output/images/ directory.

Copy the bootable "sdcard.img" onto an SD card with "dd":

  $ 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 and start two consoles: one on the serial port on
the P1 header, one on the HDMI output where you can login using a USB
keyboard.

How to write to CM4 eMMC memory
===============================

For CM4 modules without eMMC memory see above for booting from SD card,
for CM4 moduels with eMMC memory proceed as following:

- fit jumper on IO Board header J2 to disable eMMC boot
- connect IO Board micro USB port (J11 USB slave) to your host linux system
- power up CM4/IO Board (lsusb command should show a '0a5c:2711 Broadcom Corp.
  BCM2711 Boot' device)
- run 'sudo ./host/bin/rpiboot', output should look like the following:
    Waiting for BCM2835/6/7/2711...
    Loading embedded: bootcode4.bin
    Sending bootcode.bin
    Successful read 4 bytes
    Waiting for BCM2835/6/7/2711...
    Loading embedded: bootcode4.bin
    Second stage boot server
    Loading embedded: start4.elf
    File read: start4.elf
    Second stage boot server done

- a USB mass storage device should show up (the CM4 eMMC memory), proceed
  as described above to copy sdcard.img to it
- power down CM4/IO Board
- remove jumper on IO Board header J2 to re-enable eMMC boot
- power up CM4/IO Board