Raspberrypi and Buildroot - johnosbb/Automation GitHub Wiki
Buildroot Configuration
Configuring for a specific Pi Model
make raspberrypi3_defconfig
Customizing the Configuration
Create an overlay directory
cd buildroot_pi
mkdir overlay
mkdir -p overlay/etc/network
Configure the overlay location in menuconfig. Under System Configuration select the option for overlay.
Configuring for a Static IP Address
place an interfaces file in overlay/etc/network
auto eth0
iface eth0 inet static
address 192.168.1.178
netmask 255.255.255.0
gateway 192.168.1.254
hostname $(hostname)
Flashing the Buildroot Image
IMAGE=sdcard.img
SDCARD_LOCATION=/dev/sde
IMAGE_PATH=/mnt/500GB/buildroot_pi/buildroot_2025/output/images/
#rm -rf $IMAGE_PATH/*.img
echo "Writing image $IMAGE ..."
sudo dd if=$IMAGE_PATH/$IMAGE of=$SDCARD_LOCATION bs=4M status=progress
echo "Syncing changes ..."
sync
Turning on Packages
Buildroot can be a little unpredictable about wether newly added packages are included in the rootfs, so after turning on a package we may need to force its inclusion in the rootfs, for example, to enable ssh access I had to do.
make dropbear-reinstall
make openssh-reinstall
make
Saving your Configuration
Buildroot will save our configuration in the path set by BR2_DEFCONFIG. So when we do a make savedefconfig that file will be updated.
BR2_DEFCONFIG="/mnt/500GB/buildroot_pi/buildroot_2025/configs/raspberrypi3_defconfig"
Our kernel configuration is based on
BR2_LINUX_KERNEL_USE_DEFCONFIG=y
BR2_LINUX_KERNEL_DEFCONFIG="bcm2709"
These reference a kernel configuration found in
./output/build/linux-headers-custom/arch/arm/configs/bcm2709_defconfig
./output/build/linux-custom/arch/arm/configs/bcm2709_defconfig
We can save a modified config with
make linux-update-defconfig
make linux-update-defconfig can be configured to save the linux configuration to a specified path by setting BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG. It simplifies the config file by removing default values. However, this only works with kernels starting from 2.6.33.
Flashing Images
#!/bin/bash
# Usage: sudo ./flash_pi_image.sh /path/to/SDCard.img /dev/sdX
# Example: sudo ./flash_pi_image.sh ./SDCard.img /dev/sde
set -e
IMAGE="$1"
DEVICE="$2"
# Validate arguments
if [ -z "$IMAGE" ](/johnosbb/Automation/wiki/|--z-"$DEVICE"-); then
echo "Usage: sudo $0 /path/to/SDCard.img /dev/sdX"
exit 1
fi
if [ ! -f "$IMAGE" ](/johnosbb/Automation/wiki/-!--f-"$IMAGE"-); then
echo "Error: Image file '$IMAGE' does not exist."
exit 1
fi
if [ ! -b "$DEVICE" ](/johnosbb/Automation/wiki/-!--b-"$DEVICE"-); then
echo "Error: Device '$DEVICE' is not a valid block device."
exit 1
fi
# Confirm with user
echo "⚠️ You are about to write '$IMAGE' to '$DEVICE'"
echo "This will ERASE all data on $DEVICE!"
read -rp "Are you sure? (yes/NO): " confirm
if [ "$confirm" != "yes" ](/johnosbb/Automation/wiki/-"$confirm"-!=-"yes"-); then
echo "Aborted."
exit 1
fi
echo "Unmounting any mounted partitions on $DEVICE..."
for part in $(ls ${DEVICE}?* 2>/dev/null); do
sudo umount "$part" 2>/dev/null || true
done
echo "Writing image..."
sudo dd if="$IMAGE" of="$DEVICE" bs=4M status=progress conv=fsync
echo "Syncing..."
sync
echo "Ejecting..."
sudo eject "$DEVICE"
echo "✅ Flash complete. You can now remove the SD card."
Serial Port Connection
Kernel Debugging
The vmlinux file can be found in ./output/build/linux-custom/vmlinux
.