raspberrypi3: fix serial console (load pi3-miniuart-bt overlay)
authorPeter Seiderer <ps.report@gmx.net>
Mon, 2 May 2016 20:25:44 +0000 (22:25 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 18 Sep 2016 17:21:18 +0000 (19:21 +0200)
- enable BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS in raspberrypi3_defconfig
- add copy of rpi-firmware/overlays directory to boot partition in genimage-raspberrypi3.cfg
- enhance post-image.sh script to add 'dtoverlay=pi3-miniuart-bt' on request
- add BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay" in raspberrypi3_defconfig

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
board/raspberrypi/genimage-raspberrypi3.cfg
board/raspberrypi/post-image.sh
board/raspberrypi/readme.txt
configs/raspberrypi3_defconfig

index 7ba89c5548d284e4b2e0fd4e9617959d48600a27..baab0c4cc1082aa746017b5247a24f44c2d2b727 100644 (file)
@@ -7,6 +7,7 @@ image boot.vfat {
       "rpi-firmware/config.txt",
       "rpi-firmware/fixup.dat",
       "rpi-firmware/start.elf",
+      "rpi-firmware/overlays",
       "kernel-marked/zImage"
     }
   }
index 73ffd658e7cacda938e4d55c794d582c6d56e6fa..c00975288c6fbc58f96c0e65a2736657d32908b4 100755 (executable)
@@ -5,6 +5,19 @@ BOARD_NAME="$(basename ${BOARD_DIR})"
 GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
 GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
 
+case "${2}" in
+       --add-pi3-miniuart-bt-overlay)
+       if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+               echo "Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console)."
+               cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# fixes rpi3 ttyAMA0 serial console
+dtoverlay=pi3-miniuart-bt
+__EOF__
+       fi
+       ;;
+esac
+
 # Mark the kernel as DT-enabled
 mkdir -p "${BINARIES_DIR}/kernel-marked"
 ${HOST_DIR}/usr/bin/mkknlimg "${BINARIES_DIR}/zImage" \
index a170f8f91c53b863d8177d27876293e0d6b03cdb..03178ff95fa4dcfe383d79f74a2d8be3dfcf4c25 100644 (file)
@@ -60,7 +60,8 @@ After building, you should obtain this tree:
     |   +-- cmdline.txt
     |   +-- config.txt
     |   +-- fixup.dat
-    |   `-- start.elf
+    |   +-- start.elf
+    |   `-- overlays/               [3]
     +-- sdcard.img
     `-- zImage
 
@@ -69,6 +70,11 @@ After building, you should obtain this tree:
 
 [2] This is the mkknlimg DT-marked kernel.
 
+[3] Only for the Raspberry Pi 3 Model (overlay pi3-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
 ========================
 
index 4eb5333fa96ba2422cb849d1fb8c243a3e10c776..8600cd8c3608c0fe713d9c215af98fb799489972 100644 (file)
@@ -21,7 +21,7 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
 BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b"
 
 BR2_PACKAGE_RPI_FIRMWARE=y
-# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
+BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS=y
 
 # Required tools to create the SD image
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -34,3 +34,4 @@ BR2_TARGET_ROOTFS_EXT2_4=y
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay"