forked from showmewebcam/showmewebcam
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-showmewebcam-usbboot.sh
executable file
·45 lines (36 loc) · 1.54 KB
/
build-showmewebcam-usbboot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# Allow to overwrite default buildroot location
BUILDROOT_DIR=${BUILDROOT_DIR:-buildroot}
if [ ! -d "$BUILDROOT_DIR" ]; then
echo "Please provide a valid buildroot directory, either by using BUILDROOT_DIR or by renaming it to \"buildroot\""
exit 1
fi
# Set default board to raspberrypi0. For the W you only also need bcm2708-rpi-zero-w.dtb in the boot dir.
export BOARDNAME=${1:-raspberrypi0}
case "$BOARDNAME" in
raspberrypi0)
;;
raspberrypi0w)
;;
*)
echo "usage: BUILDROOT_DIR=buildroot $0 (boardname)"
echo "boardname: raspberrypi0, raspberrypi0w"
exit 1
;;
esac
# Merge custom buildroot configurations
CONFIG_="BR2" KCONFIG_CONFIG="configs/${BOARDNAME}_defconfig" "$BUILDROOT_DIR/support/kconfig/merge_config.sh" -m -r configs/config "configs/$BOARDNAME"
sed "1i ### DO NOT EDIT, this file was automatically generated\n" -i "configs/${BOARDNAME}_defconfig"
# Merge kernel configurations
if [ -f "board/linux-${BOARDNAME}.config" ]; then
KCONFIG_CONFIG="board/linux.config" "$BUILDROOT_DIR/support/kconfig/merge_config.sh" -m -r board/linux-base.config "board/linux-${BOARDNAME}.config"
else
cp board/linux-base.config board/linux.config
fi
sed "1i ### DO NOT EDIT, this file was automatically generated\n" -i board/linux.config
# Create full buildroot configuration
BR2_EXTERNAL="$(pwd)" make O="$(pwd)/output/$BOARDNAME" -C "$BUILDROOT_DIR" "${BOARDNAME}_defconfig"
# Build
make -C "output/$BOARDNAME" all
# Move firmware blobs to create bootable dir
mv output/$BOARDNAME/images/rpi-firmware/* output/$BOARDNAME/images/