buildKernel.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh -xe
  2. #Build kenerl, wifi firmware
  3. KVER=4.17.2
  4. # build Linux-libre, with ath9k_htc, dwc2 from Chrome OS and without many useless drivers
  5. [ ! -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
  6. [ ! -d linux-$KVER ] && tar --lzip -xvf linux-libre-$KVER-gnu.tar.lz && FRESH=true
  7. cd linux-$KVER
  8. make clean
  9. make mrproper
  10. [ "$FRESH" = true ] && git apply ../patches-tested/*
  11. #Apply the usb patch, quietly so
  12. # git apply ../chromeos-dwc2-glue.patch
  13. # git apply ../rockchip-dwc2-usb-partial-power-down.patch
  14. #Apply all of the rockMyy patches that make sense
  15. # git apply ../patches/kernel/*
  16. # git apply ../patches/DTS/*
  17. # reset the minor version number, so out-of-tree drivers continue to work after
  18. # a kernel upgrade
  19. sed s/'SUBLEVEL = .*'/'SUBLEVEL = 0'/ -i Makefile
  20. cp ../config .config
  21. make -j `grep ^processor /proc/cpuinfo | wc -l` CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs
  22. [ ! -h kernel.its ] && ln -s ../kernel.its .
  23. mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
  24. dd if=/dev/zero of=bootloader.bin bs=512 count=1
  25. vbutil_kernel --pack vmlinux.kpart \
  26. --version 1 \
  27. --vmlinuz vmlinux.uimg \
  28. --arch arm \
  29. --keyblock /usr/share/vboot/devkeys/kernel.keyblock \
  30. --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
  31. --config ../cmdline \
  32. --bootloader bootloader.bin
  33. cd ..
  34. # build AR9271 firmware
  35. [ ! -d open-ath9k-htc-firmware ] && git clone --depth 1 https://github.com/qca/open-ath9k-htc-firmware.git
  36. cd open-ath9k-htc-firmware
  37. make toolchain
  38. make -C target_firmware
  39. cd ..