Permalink
Browse files

Personal Raspberry Pi Overlay

  • Loading branch information...
gamaral committed Jan 13, 2018
1 parent 2e6bba1 commit 213a9df5828696b16f56a5b0a6f66c9b112534f8
@@ -0,0 +1,152 @@
+#!/bin/sh
+#
+# Flash Raspberry Pi SD card [buildroot]
+#
+# Guillermo A. Amaral B. <g@maral.me>
+# Geoffrey 'Frogeye' Preud'homme <geoffrey@frogeye.fr>
+#
+
+SDCARD="${1}"
+
+usage() {
+ echo "Usage: ${0} [SDCARD]"
+ echo "Where SDCARD is your SD card device node, for example: /dev/sdx"
+ echo
+ echo "You will require *root* privileges in order to use this script."
+ echo
+}
+
+confirm() {
+ echo "You are about to totally decimate the following device node: ${SDCARD}"
+ echo
+ echo "If you are sure you want to continue? (Please write \"YES\" in all caps)"
+
+ read CONTUNUE
+
+ if [ "${CONTUNUE}" != "YES" ]; then
+ echo "User didn't write \"YES\"... ABORTING!"
+ exit 1
+ fi
+}
+
+section() {
+ echo "*****************************************************************************************"
+ echo "> ${*}"
+ echo "*****************************************************************************************"
+ sleep 1
+}
+
+# environment overrides
+
+PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+OUTPUT_PREFIX=""
+
+# check parameters
+
+if [ -z "${SDCARD}" ] || [ "${SDCARD}" = "-h" ] || [ "${SDCARD}" = "--help" ]; then
+ usage
+ exit 0
+fi
+
+# check if node is a block device
+
+if [ ! -b "${SDCARD}" ]; then
+ echo "${SDCARD} is not a block device!"
+ exit 1
+fi
+
+# root privilege check
+
+USERID=`id -u`
+if [ ${USERID} -ne 0 ]; then
+ echo "${0} requires root privileges in order to work."
+ exit 0
+fi
+
+# dependencies
+
+CP=`which cp`
+DD=`which dd`
+FDISK=`which fdisk`
+GREP=`which grep`
+CUT=`which cut`
+SED=`which sed`
+PARTED=`which parted`
+RESIZE2FS=`which resize2fs`
+SYNC=`which sync`
+
+if [ -z "${CP}" ] ||
+ [ -z "${DD}" ] ||
+ [ -z "${FDISK}" ] ||
+ [ -z "${GREP}" ] ||
+ [ -z "${CUT}" ] ||
+ [ -z "${SED}" ] ||
+ [ -z "${PARTED}" ] ||
+ [ -z "${RESIZE2FS}" ]; then
+ echo "Missing dependencies:\n"
+ echo "CP=${CP}"
+ echo "DD=${DD}"
+ echo "FDISK=${FDISK}"
+ echo "GREP=${GREP}"
+ echo "CUT=${CUT}"
+ echo "SED=${SED}"
+ echo "PARTED=${PARTED}"
+ echo "RESIZE2FS=${RESIZE2FS}"
+ exit 1
+fi
+
+# sanity check
+
+if [ ! -d "images" ] || [ ! -f "images/sdcard.img" ]; then
+ if [ -d "output/images" ] && [ -f "output/images/sdcard.img" ]; then
+ OUTPUT_PREFIX="output/"
+ else
+ echo "Didn't find sdcard.img! ABORT."
+ exit 1
+ fi
+fi
+
+# warn user
+
+confirm
+
+# figure out partition pattern
+
+SDCARDP="$(fdisk -l ${SDCARD} | grep ${SDCARD} | tail -1 | cut -d ' ' -f 1 | sed 's/[0-9]\+$//')"
+
+# unmount eventually mounted partitions
+
+umount ${SDCARDP}1 &> /dev/null
+umount ${SDCARDP}2 &> /dev/null
+
+# write image
+
+section "Writing to SD card..."
+
+${DD} status=progress if=${OUTPUT_PREFIX}images/sdcard.img of=${SDCARD}
+
+# resize root partition
+
+section "Resizing root partition..."
+
+${PARTED} ${SDCARD} <<END
+print
+resizepart 2
+100%
+print
+quit
+END
+
+sleep 1
+
+# resize root filesystem
+
+section "Resizing root filesystem..."
+
+${RESIZE2FS} ${SDCARDP}2
+
+${SYNC}
+
+section "Finished!"
+
+exit 0
@@ -5,7 +5,6 @@ image boot.vfat {
"bcm2708-rpi-b-plus.dtb",
"bcm2708-rpi-cm.dtb",
"rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
"rpi-firmware/config.txt",
"rpi-firmware/fixup.dat",
"rpi-firmware/start.elf",
@@ -4,7 +4,6 @@ image boot.vfat {
"bcm2708-rpi-b-plus.dtb",
"bcm2708-rpi-0-w.dtb",
"rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
"rpi-firmware/config.txt",
"rpi-firmware/fixup.dat",
"rpi-firmware/start.elf",
@@ -3,7 +3,6 @@ image boot.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",
@@ -4,7 +4,6 @@ image boot.vfat {
"bcm2710-rpi-3-b.dtb",
"bcm2710-rpi-cm3.dtb",
"rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
"rpi-firmware/config.txt",
"rpi-firmware/fixup.dat",
"rpi-firmware/start.elf",
@@ -0,0 +1,10 @@
+# /etc/fstab: static file system information.
+#
+# <file system> <mount pt> <type> <options> <dump> <pass>
+/dev/root / ext4 rw,noauto 0 1
+proc /proc proc defaults 0 0
+devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
+tmpfs /dev/shm tmpfs mode=0777 0 0
+tmpfs /tmp tmpfs mode=1777 0 0
+tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
+sysfs /sys sysfs defaults 0 0
@@ -0,0 +1,7 @@
+┌──────────────────────────────────────────────┐
+│░█▀▄░█▀█░█▀▀░█▀█░█▀▄░█▀▀░█▀▄░█▀▄░█░█░░░█▀█░▀█▀│
+│░█▀▄░█▀█░▀▀█░█▀▀░█▀▄░█▀▀░█▀▄░█▀▄░░█░░░░█▀▀░░█░│
+│░▀░▀░▀░▀░▀▀▀░▀░░░▀▀░░▀▀▀░▀░▀░▀░▀░░▀░░░░▀░░░▀▀▀│
+└──────────────────────────────────────────────┘
+
+Your slice of Raspberry Pi is now ready!
@@ -1,17 +1,25 @@
BR2_arm=y
BR2_arm1176jzf_s=y
BR2_ARM_EABIHF=y
-
-# Linux headers same as kernel, a 4.9 series
-BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
+BR2_ARM_FPU_VFPV2=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_ROOTFS_OVERLAY="board/raspberrypi/overlay"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+BR2_TARGET_GENERIC_HOSTNAME="rpi"
+BR2_TARGET_GENERIC_ISSUE=""
+
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="4.9.41"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
+
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dc3bd00d62130ef7f09759a8c0ec9d65f58c987"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="raspberrypi-kernel_1.20170811-1"
BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi"
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
# Build the DTBs for A/B from the kernel sources: the zero is the same
# as the A+ model, just in a different form-factor
@@ -20,6 +28,7 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-b-plus bcm2708-rpi-0-w"
BR2_PACKAGE_RPI_FIRMWARE=y
# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
+BR2_PACKAGE_RPI_USERLAND=y
# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -29,6 +38,7 @@ BR2_PACKAGE_HOST_MTOOLS=y
# Filesystem / image
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="80M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi0/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi0/post-image.sh"
@@ -7,21 +7,29 @@ BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_SYSTEM_DHCP="eth0"
-# Linux headers same as kernel, a 4.9 series
+BR2_ROOTFS_OVERLAY="board/raspberrypi/overlay"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+BR2_TARGET_GENERIC_HOSTNAME="rpi"
+BR2_TARGET_GENERIC_ISSUE=""
+
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="4.9.41"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dc3bd00d62130ef7f09759a8c0ec9d65f58c987"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="raspberrypi-kernel_1.20170811-1"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2709"
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
# Build the DTB from the kernel sources
BR2_LINUX_KERNEL_DTS_SUPPORT=y
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
+BR2_PACKAGE_RPI_USERLAND=y
# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -31,6 +39,7 @@ BR2_PACKAGE_HOST_MTOOLS=y
# Filesystem / image
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="80M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi2/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi2/post-image.sh"
@@ -6,21 +6,29 @@ BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_SYSTEM_DHCP="eth0"
-# Linux headers same as kernel, a 4.9 series
+BR2_ROOTFS_OVERLAY="board/raspberrypi/overlay"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+BR2_TARGET_GENERIC_HOSTNAME="rpi"
+BR2_TARGET_GENERIC_ISSUE=""
+
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="4.9.41"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dc3bd00d62130ef7f09759a8c0ec9d65f58c987"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="raspberrypi-kernel_1.20170811-1"
BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi3"
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
# Build the DTB from the kernel sources
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2710-rpi-3-b broadcom/bcm2837-rpi-3-b"
BR2_PACKAGE_RPI_FIRMWARE=y
# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
+BR2_PACKAGE_RPI_USERLAND=y
# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -6,20 +6,29 @@ BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_SYSTEM_DHCP="eth0"
-# Linux headers same as kernel, a 4.9 series
+BR2_ROOTFS_OVERLAY="board/raspberrypi/overlay"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+BR2_TARGET_GENERIC_HOSTNAME="rpi"
+BR2_TARGET_GENERIC_ISSUE=""
+
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="4.9.41"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dc3bd00d62130ef7f09759a8c0ec9d65f58c987"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="raspberrypi-kernel_1.20170811-1"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2709"
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
# Build the DTB from the kernel sources
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b bcm2710-rpi-cm3"
BR2_PACKAGE_RPI_FIRMWARE=y
+# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
+BR2_PACKAGE_RPI_USERLAND=y
# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -29,6 +38,7 @@ BR2_PACKAGE_HOST_MTOOLS=y
# Filesystem / image
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="80M"
# 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"
Oops, something went wrong.

0 comments on commit 213a9df

Please sign in to comment.