PrawnOS-nonfree/buildKernel.sh

45 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/sh -xe
#Build kenerl, wifi firmware
KVER=4.17.8
# build Linux-libre, with ath9k_htc, dwc2 from Chrome OS and without many useless drivers
[ ! -f linux-libre-$KVER-gnu.tar.lz ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz
[ ! -d linux-$KVER ] && tar --lzip -xvf linux-libre-$KVER-gnu.tar.lz
cd linux-$KVER
make clean
make mrproper
#Apply the usb patch
git apply ../chromeos-dwc2-glue.patch
git apply ../rockchip-dwc2-usb-partial-power-down.patch
#Apply all of the rockMyy patches that make sense
git apply ../patches/kernel/*
git apply ../patches/DTS/*
# reset the minor version number, so out-of-tree drivers continue to work after
# a kernel upgrade
sed s/'SUBLEVEL = .*'/'SUBLEVEL = 0'/ -i Makefile
cp ../config .config
make -j `grep ^processor /proc/cpuinfo | wc -l` CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs
[ ! -h kernel.its ] && ln -s ../kernel.its .
mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
dd if=/dev/zero of=bootloader.bin bs=512 count=1
vbutil_kernel --pack vmlinux.kpart \
--version 1 \
--vmlinuz vmlinux.uimg \
--arch arm \
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--config ../cmdline \
--bootloader bootloader.bin
cd ..
# build AR9271 firmware
[ ! -d open-ath9k-htc-firmware ] && git clone --depth 1 https://github.com/qca/open-ath9k-htc-firmware.git
cd open-ath9k-htc-firmware
make toolchain
make -C target_firmware
cd ..