From 5965d0e6ccfa39c4e66858198a805a45af2e891d Mon Sep 17 00:00:00 2001 From: SolidHal Date: Fri, 7 Sep 2018 11:56:22 -0500 Subject: [PATCH] Converted to using the make build system, updated scripts --- makefile | 87 +++++++++++++------------- resources/BuildResources/blank_kernel | Bin 0 -> 65535 bytes scripts/buildNewKernelIntoFS.sh | 30 +++++---- scripts/crossmenuconfig.sh | 10 ++- 4 files changed, 63 insertions(+), 64 deletions(-) create mode 100644 resources/BuildResources/blank_kernel diff --git a/makefile b/makefile index 8973d67..e14c013 100644 --- a/makefile +++ b/makefile @@ -1,57 +1,54 @@ - - - -.PHONY kernel -kernel: - scripts/buildKernel.sh - -.PHONY filesystem -filesystem: - clean_img - scripts/buildDebianFs.sh - -.PHONY kernel_inject -kernel_inject: #Targets an already build .img and swaps the old kernel with the newly compiled kernel - scripts/buildNewKernelIntoFS.sh - -.PHONY image -image: - clean_img - scripts/buildKernel.sh - scripts/buildDebianFs.sh - -.PHONY live_image -live_image: - echo "TODO" - -.PHONY kernel_config -kernel_config: - scripts/crossmenuconfig.sh - - -.PHONY clean +.PHONY: clean clean: - echo "Enter one of:" - echo " clean_kernel - which deletes the untar'd kernel folder from build" - echo " clean_ath - which deletes the untar'd ath9k driver folder from build" - echo " clean_img - which deletes the built PrawnOS images, this is ran when make image is ran" - echo " clean_all - which does all of the above" - echo " in most cases none of these need ot be used manually as most cleanup steaps are handled automatically" + @echo "Enter one of:" + @echo " clean_kernel - which deletes the untar'd kernel folder from build" + @echo " clean_ath - which deletes the untar'd ath9k driver folder from build" + @echo " clean_img - which deletes the built PrawnOS images, this is ran when make image is ran" + @echo " clean_all - which does all of the above" + @echo " in most cases none of these need to be used manually as most cleanup steps are handled automatically" -.PHONY clean_kernel +.PHONY: clean_kernel clean_kernel: rm -rf build/linux-4.* -.PHONY clean_ath +.PHONY: clean_ath clean_ath: rm -rf build/open-ath9k-htc-firmware -.PHONY clean_img +.PHONY: clean_img clean_img: rm PrawnOS-*-c201-libre-*GB.img -.PHONY clean_all +.PHONY: clean_all clean_all: - clean_kernel - clean_ath - clean_img + make clean_kernel + make clean_ath + make clean_img + + +.PHONY: kernel +kernel: + scripts/buildKernel.sh + +.PHONY: filesystem +filesystem: + make clean_img + scripts/buildDebianFs.sh + +.PHONY: kernel_inject +kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel + scripts/buildNewKernelIntoFS.sh + +.PHONY: image +image: + make clean_img + scripts/buildKernel.sh + scripts/buildDebianFs.sh + +.PHONY: live_image +live_image: + echo "TODO" + +.PHONY: kernel_config +kernel_config: + scripts/crossmenuconfig.sh diff --git a/resources/BuildResources/blank_kernel b/resources/BuildResources/blank_kernel new file mode 100644 index 0000000000000000000000000000000000000000..5dfddf075bed03499414ae453f0d6f30fe79da3d GIT binary patch literal 65535 zcmeIufdBvi0Dz$VsTV1P3IhfV7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ t0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFwg)F00961 literal 0 HcmV?d00001 diff --git a/scripts/buildNewKernelIntoFS.sh b/scripts/buildNewKernelIntoFS.sh index 16f953c..396296e 100755 --- a/scripts/buildNewKernelIntoFS.sh +++ b/scripts/buildNewKernelIntoFS.sh @@ -6,40 +6,38 @@ KVER=4.17.2 outmnt=$(mktemp -d -p `pwd`) outdev=/dev/loop7 +build_resources=resources/BuildResources + #A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted. -#Without this, a reboot is required to properly clean the loop devices and ensure a clean build -cleanuptwice() { - cleanup - cleanup - -} - +#Without this, a reboot is sometimes required to properly clean the loop devices and ensure a clean build cleanup() { set +e - #umount -l $inmnt > /dev/null 2>&1 - #rmdir $inmnt > /dev/null 2>&1 - #losetup -d $indev > /dev/null 2>&1 + umount -l $outmnt > /dev/null 2>&1 + rmdir $outmnt > /dev/null 2>&1 + losetup -d $outdev > /dev/null 2>&1 + + set +e umount -l $outmnt > /dev/null 2>&1 rmdir $outmnt > /dev/null 2>&1 losetup -d $outdev > /dev/null 2>&1 } -trap cleanuptwice INT TERM EXIT +trap cleanup INT TERM EXIT #Mount the build filesystem image -losetup -P $outdev librean-stretch-c201-libre-2GB* +losetup -P $outdev PrawnOS-*-c201-libre-2GB* mount -o noatime ${outdev}p2 $outmnt # put the kernel in the kernel partition, modules in /lib/modules and AR9271 # firmware in /lib/firmware -dd if=blank_kernel of=${outdev}p1 conv=notrunc -dd if=linux-$KVER/vmlinux.kpart of=${outdev}p1 conv=notrunc -make -C linux-$KVER ARCH=arm INSTALL_MOD_PATH=$outmnt modules_install +dd if=$resources/blank_kernel of=${outdev}p1 conv=notrunc +dd if=build/linux-$KVER/vmlinux.kpart of=${outdev}p1 conv=notrunc +make -C build/linux-$KVER ARCH=arm INSTALL_MOD_PATH=$outmnt modules_install rm -f $outmnt/lib/modules/3.14.0/{build,source} -install -D -m 644 open-ath9k-htc-firmware/target_firmware/htc_9271.fw $outmnt/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw +install -D -m 644 build/open-ath9k-htc-firmware/target_firmware/htc_9271.fw $outmnt/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw echo "DONE!" cleanup diff --git a/scripts/crossmenuconfig.sh b/scripts/crossmenuconfig.sh index 5959843..d1fff95 100755 --- a/scripts/crossmenuconfig.sh +++ b/scripts/crossmenuconfig.sh @@ -1,13 +1,17 @@ #!/bin/sh -xe #Runs Make menuconfig with the proper enviroment vars for cross compiling arm -#Grabs the file named config in the same directory as this script, and updates it +#Grabs the file named config in resources/BuildResources directory, and updates it KVER=4.17.2 +ROOT_DIR=`pwd` +RESOURCES=$ROOT_DIR/resources/BuildResources +[ ! -d build ] && mkdir build +cd build [ ! -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 -cp ../config .config +cp $RESOURCES/config .config make menuconfig ARCH=arm CROSS_COMPILE=arm-none-eabi- .config -cp .config ../config +cp .config $RESOURCES/config