buildKernel.sh 1.6 KB

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