forked from remusmp/rpi-rt-kernel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·35 lines (27 loc) · 1.53 KB
/
build.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
#!/bin/sh
RASPIOS=$(ls *.img -1 | sed -e 's/\.img$//')
mount -t ext4 -o loop,offset=$((532480*512)) ${RASPIOS}.img /raspios/mnt/disk
mount -t vfat -o loop,offset=$((8192*512)),sizelimit=$((524288*512)) ${RASPIOS}.img /raspios/mnt/boot
cd /rpi-kernel/linux/
make INSTALL_MOD_PATH=/raspios/mnt/disk modules_install
make INSTALL_DTBS_PATH=/raspios/mnt/boot dtbs_install
cd -
if [ "$ARCH" = "arm64" ]; then
cp /rpi-kernel/linux/arch/arm64/boot/dts/broadcom/*.dtb /raspios/mnt/boot/
cp /rpi-kernel/linux/arch/arm64/boot/dts/overlays/*.dtb* /raspios/mnt/boot/overlays/
cp /rpi-kernel/linux/arch/arm64/boot/dts/overlays/README /raspios/mnt/boot/overlays/
cp /rpi-kernel/linux/arch/arm64/boot/Image /raspios/mnt/boot/$KERNEL\_rt.img
elif [ "$ARCH" = "arm" ]; then
cp /rpi-kernel/linux/arch/arm/boot/dts/*.dtb /raspios/mnt/boot/
cp /rpi-kernel/linux/arch/arm/boot/dts/overlays/*.dtb* /raspios/mnt/boot/overlays/
cp /rpi-kernel/linux/arch/arm/boot/dts/overlays/README /raspios/mnt/boot/overlays/
cp /rpi-kernel/linux/arch/arm/boot/zImage /raspios/mnt/boot/$KERNEL\_rt.img
fi
cp /raspios/config.txt /raspios/mnt/boot/
touch /raspios/mnt/boot/ssh
# Uncomment this line to fix the USB issue on Pi Zero 2 directly in the generated image by appending the needed boot options to cmdline.txt.
# sed '$ s/$/ dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0/' /raspios/mnt/boot/cmdline.txt > newcmdline && mv newcmdline /raspios/mnt/boot/cmdline.txt
umount /raspios/mnt/disk
umount /raspios/mnt/boot
mkdir build
zip build/${RASPIOS}.zip ${RASPIOS}.img