Files
common-raspberrypi/board/raspberrypi/post-build.sh

37 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# post_build.sh - Common post-build script for Raspberry Pi
#
# Called by Buildroot after assembling the target rootfs.
# Arguments:
# $1 = path to the target rootfs directory (e.g., output/target)
#
# Environment:
# BR2_EXTERNAL_RPI_COMMON_PATH = path to this external tree
#
# Use this script for:
# - Fixing file permissions
# - Creating symlinks
# - Generating config files that depend on build-time variables
# - Stripping unnecessary files from the rootfs
#
# Do NOT use this for:
# - Installing packages (use rootfs overlay or a package .mk instead)
# - Modifying files outside $1
# Add usb_modeswitch mdev rule
grep -q "usb_modeswitch" "$TARGET_DIR/etc/mdev.conf" || \
echo '$PRODUCT=bda/1a2b.* root:root 0660 */lib/mdev/rtl8821cu_usb_modeswitch.sh' >> "$TARGET_DIR/etc/mdev.conf"
# Add wlan_setup mdev rule
grep -q "wlan_setup" "$TARGET_DIR/etc/mdev.conf" || \
echo '$PRODUCT=bda/c820.* root:root 0660 */lib/mdev/wlan_setup.sh' >> "$TARGET_DIR/etc/mdev.conf"
# Add wlan0 configuration
grep -q "iface wlan0" "$TARGET_DIR/etc/network/interfaces" || \
cat >> "$TARGET_DIR/etc/network/interfaces" << 'EOF'
auto wlan0
iface wlan0 inet dhcp
pre-up ip link set wlan0 up
pre-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
EOF