diff --git a/kernel/makefile b/kernel/makefile index 75529177a..0e5e38784 100644 --- a/kernel/makefile +++ b/kernel/makefile @@ -53,8 +53,12 @@ extract_ath9k: $(ATH9K_EXTRACTED) .PHONY: kernel_image_package kernel_image_package: $(PRAWNOS_KERNEL_BUILT) $(MAKE) -C $(PRAWNOS_KERNEL_PACKAGE_IMAGE) + +.PHONY: kernel_image_package_install +kernel_image_package_install: kernel_image_package $(MAKE) -C $(PRAWNOS_KERNEL_PACKAGE_IMAGE) install INSTALL_TARGET=$(PRAWNOS_BUILD) + .PHONY: kernel_config kernel_config: $(KERNEL_PATCHED) $(PRAWNOS_KERNEL_SCRIPTS_MENUCONFIG) $(KERNEL_RESOURCES) $(PRAWNOS_KERNEL_BUILD) $(TARGET) diff --git a/kernel/packages/prawnos-linux-image-arm64/.gitignore b/kernel/packages/prawnos-linux-image-arm64/.gitignore index fe2248441..4afb1ca5d 100644 --- a/kernel/packages/prawnos-linux-image-arm64/.gitignore +++ b/kernel/packages/prawnos-linux-image-arm64/.gitignore @@ -23,6 +23,4 @@ debhelper-build-stamp *.upload #kernel image specific ignores -prawnos-linux-image-arm64_*.orig.tar.gz -prawnos-linux-image-arm64_*.debian.tar.xz -orig/prawnos-linux-image-arm64_* \ No newline at end of file +prawnos-linux-image-arm64_*.debian.tar.xz \ No newline at end of file diff --git a/kernel/packages/prawnos-linux-image-arm64/makefile b/kernel/packages/prawnos-linux-image-arm64/makefile index 30f6651c1..36a53c967 100644 --- a/kernel/packages/prawnos-linux-image-arm64/makefile +++ b/kernel/packages/prawnos-linux-image-arm64/makefile @@ -8,17 +8,18 @@ $(error Cant build armhf kernel package with arm64 target) endif #package specific vars -VERSION := $(PRAWNOS_KERNEL_IMAGE_CAT_VER) +DEB_VERSION := $(PRAWNOS_KERNEL_IMAGE_CAT_DEB_VER) +PRAWNOS_VERSION := $(PRAWNOS_KERNEL_IMAGE_CAT_PRAWNOS_VER) PACKAGE := prawnos-linux-image-arm64 PACKAGE_ARCH := arm64 #uses the full debian version for the package name -PACKAGE_NAME := $(PACKAGE)_$(VERSION)_$(PACKAGE_ARCH) +PACKAGE_NAME := $(PACKAGE)_$(DEB_VERSION)_$(PACKAGE_ARCH) PACKAGE_NAME_DEB := $(PACKAGE_NAME).deb #uses only the upstream kernel version for the orig tar -PACKAGE_NAME_ORIG := $(PACKAGE)_$(KVER)-$(PRAWNOS_KERNEL_VER) -PACKAGE_NAME_ORIG_TAR := $(PACKAGE_NAME_ORIG).orig.tar.gz -PACKAGE_NAME_ORIG_DIR := $(PACKAGE)_$(KVER)-$(PRAWNOS_KERNEL_VER)-orig +PACKAGE_NAME_ORIG := $(PACKAGE)_$(PRAWNOS_VERSION) +PACKAGE_NAME_ORIG_TAR = $(PACKAGE_NAME_ORIG).orig.tar.gz +PACKAGE_NAME_ORIG_DIR = $(PACKAGE)_$(KVER)-$(PRAWNOS_KERNEL_VER)-orig ORIG := $(PRAWNOS_BUILD)/$(PACKAGE_NAME_ORIG_DIR) @@ -27,9 +28,8 @@ default: $(PACKAGE_NAME_DEB) $(PACKAGE_NAME_DEB): $(PACKAGE_NAME_ORIG_TAR) @echo Building $@ -# keep the /debian files up to date with the current kernel version - $(PRAWNOS_KERNEL_SCRIPTS_UPDATE_DEB_FILES) $(PRAWNOS_KERNEL_PACKAGE_IMAGE)/src $(VERSION) - + $(MAKE) clean + $(PRAWNOS_KERNEL_SCRIPTS_UPDATE_DEB_FILES) $(PRAWNOS_KERNEL_PACKAGE_IMAGE)/src $(DEB_VERSION) $(PRAWNOS_VERSION) $(PRAWNOS_KERNEL_PACKAGE_IMAGE) $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \ $(PBUILDER_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \ @@ -37,11 +37,14 @@ $(PACKAGE_NAME_DEB): $(PACKAGE_NAME_ORIG_TAR) $(PACKAGE_NAME_ORIG_TAR): make -f $(PRAWNOS_KERNEL)/makefile kernel + rm -rf $(ORIG) + rm -f $(PACKAGE)_*-*.orig.tar.gz mkdir $(ORIG) cp $(PRAWNOS_KERNEL_BUILT) $(ORIG)/$(PACKAGE_NAME_ORIG) cp $(PRAWNOS_KERNEL_RESOURCES_SHARED)/FlashKernelPartition.sh $(ORIG)/ tar -czf $(PACKAGE_NAME_ORIG_TAR) -C $(ORIG)/ . + .PHONY: clean_all clean_all: clean clean_orig @@ -59,8 +62,7 @@ clean: rm -rf src/debian/$(PACKAGE)* rm -f src/debian/files rm -rf src/debian/.debhelper -# kernel package specific - rm -f orig/$(PACKAGE)_*-* + rm -rf $(ORIG) #when just changing the debian package version, if we remake the orig as well then reprepro will complain on upload. So we might not always want to remove the orig. .PHONY: clean_orig @@ -70,6 +72,7 @@ clean_orig: .PHONY: install install: $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) + $(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(PRAWNOS_IMAGE) $(TARGET) $(PRAWNOS_KERNEL_BUILD) $(PRAWNOS_BUILD) $(PACKAGE) $(PACKAGE_NAME_DEB) .PHONY: upload upload: diff --git a/kernel/packages/prawnos-linux-image-arm64/prawnos-linux-image-arm64_5.9.12-1.orig.tar.gz b/kernel/packages/prawnos-linux-image-arm64/prawnos-linux-image-arm64_5.9.12-1.orig.tar.gz new file mode 100644 index 000000000..a952892c1 Binary files /dev/null and b/kernel/packages/prawnos-linux-image-arm64/prawnos-linux-image-arm64_5.9.12-1.orig.tar.gz differ diff --git a/kernel/packages/prawnos-linux-image-armhf/.gitignore b/kernel/packages/prawnos-linux-image-armhf/.gitignore index f09287a57..0741a1ad8 100644 --- a/kernel/packages/prawnos-linux-image-armhf/.gitignore +++ b/kernel/packages/prawnos-linux-image-armhf/.gitignore @@ -23,6 +23,4 @@ debhelper-build-stamp *.upload #kernel image specific ignores -prawnos-linux-image-armhf_*.orig.tar.gz -prawnos-linux-image-armhf_*.debian.tar.xz -orig/prawnos-linux-image-armhf_* \ No newline at end of file +prawnos-linux-image-armhf_*.debian.tar.xz \ No newline at end of file diff --git a/kernel/packages/prawnos-linux-image-armhf/makefile b/kernel/packages/prawnos-linux-image-armhf/makefile index 6ea4e86de..a10fee6dd 100644 --- a/kernel/packages/prawnos-linux-image-armhf/makefile +++ b/kernel/packages/prawnos-linux-image-armhf/makefile @@ -8,17 +8,18 @@ $(error Cant build armhf kernel package with arm64 target) endif #package specific vars -VERSION := $(PRAWNOS_KERNEL_IMAGE_CAT_VER) +DEB_VERSION := $(PRAWNOS_KERNEL_IMAGE_CAT_VER) +PRAWNOS_VERSION := $(PRAWNOS_KERNEL_IMAGE_CAT_PRAWNOS_VER) PACKAGE := prawnos-linux-image-armhf PACKAGE_ARCH := armhf #uses the full debian version for the package name -PACKAGE_NAME := $(PACKAGE)_$(VERSION)_$(PACKAGE_ARCH) +PACKAGE_NAME := $(PACKAGE)_$(DEB_VERSION)_$(PACKAGE_ARCH) PACKAGE_NAME_DEB := $(PACKAGE_NAME).deb #uses only the upstream kernel version for the orig tar -PACKAGE_NAME_ORIG := $(PACKAGE)_$(KVER)-$(PRAWNOS_KERNEL_VER) -PACKAGE_NAME_ORIG_TAR := $(PACKAGE_NAME_ORIG).orig.tar.gz -PACKAGE_NAME_ORIG_DIR := $(PACKAGE)_$(KVER)-$(PRAWNOS_KERNEL_VER)-orig +PACKAGE_NAME_ORIG := $(PACKAGE)_$(PRAWNOS_VERSION) +PACKAGE_NAME_ORIG_TAR = $(PACKAGE_NAME_ORIG).orig.tar.gz +PACKAGE_NAME_ORIG_DIR = $(PACKAGE)_$(KVER)-$(PRAWNOS_KERNEL_VER)-orig ORIG := $(PRAWNOS_BUILD)/$(PACKAGE_NAME_ORIG_DIR) @@ -27,9 +28,8 @@ default: $(PACKAGE_NAME_DEB) $(PACKAGE_NAME_DEB): $(PACKAGE_NAME_ORIG_TAR) @echo Building $@ -# keep the /debian files up to date with the current kernel version - $(PRAWNOS_KERNEL_SCRIPTS_UPDATE_DEB_FILES) $(PRAWNOS_KERNEL_PACKAGE_IMAGE)/src $(VERSION) - + $(MAKE) clean + $(PRAWNOS_KERNEL_SCRIPTS_UPDATE_DEB_FILES) $(PRAWNOS_KERNEL_PACKAGE_IMAGE)/src $(DEB_VERSION) $(PRAWNOS_VERSION) $(PRAWNOS_KERNEL_PACKAGE_IMAGE) $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \ $(PBUILDER_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \ @@ -37,11 +37,14 @@ $(PACKAGE_NAME_DEB): $(PACKAGE_NAME_ORIG_TAR) $(PACKAGE_NAME_ORIG_TAR): make -f $(PRAWNOS_KERNEL)/makefile kernel + rm -rf $(ORIG) + rm -f $(PACKAGE)_*-*.orig.tar.gz mkdir $(ORIG) cp $(PRAWNOS_KERNEL_BUILT) $(ORIG)/$(PACKAGE_NAME_ORIG) cp $(PRAWNOS_KERNEL_RESOURCES_SHARED)/FlashKernelPartition.sh $(ORIG)/ tar -czf $(PACKAGE_NAME_ORIG_TAR) -C $(ORIG)/ . + .PHONY: clean_all clean_all: clean clean_orig @@ -59,8 +62,7 @@ clean: rm -rf src/debian/$(PACKAGE)* rm -f src/debian/files rm -rf src/debian/.debhelper -# kernel package specific - rm -f $(ORIG) + rm -rf $(ORIG) #when just changing the debian package version, if we remake the orig as well then reprepro will complain on upload. So we might not always want to remove the orig. .PHONY: clean_orig @@ -70,6 +72,7 @@ clean_orig: .PHONY: install install: $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) + $(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(PRAWNOS_IMAGE) $(TARGET) $(PRAWNOS_KERNEL_BUILD) $(PRAWNOS_BUILD) $(PACKAGE) $(PACKAGE_NAME_DEB) .PHONY: upload upload: diff --git a/kernel/resources/shared/FlashKernelPartition.sh b/kernel/resources/shared/FlashKernelPartition.sh index 186e7b27e..716214f77 100755 --- a/kernel/resources/shared/FlashKernelPartition.sh +++ b/kernel/resources/shared/FlashKernelPartition.sh @@ -126,6 +126,7 @@ kimg=$1 rootfs=$(get_root_partition) devname=$(lsblk -no pkname $rootfs | head -n 1) +model=$(get_device) devtype= kpart= @@ -163,7 +164,7 @@ echo " ---------------------------- This will flash a new kernel image onto the running device's kernel partition: $kpart The detected running boot device is: $devtype. -The device you are running is: $devname. +The model you are running is: $model. DO NOT shutdown or reboot before completing the process! " diff --git a/makefile b/makefile index 5d591b776..7a836d6c3 100644 --- a/makefile +++ b/makefile @@ -80,28 +80,25 @@ clean_all: clean_most clean_ath9k clean_pbuilder #:::::::::::::::::::::::::::::: image management :::::::::::::::::::::::::: .PHONY: kernel_install -kernel_install: #Targets an already built .img and swaps the old kernel with the newly compiled kernel -#TODO: uncomment when we have an arm64 bit kernel image -# $(MAKE) kernel_image_package - $(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(PRAWNOS_IMAGE) $(TARGET) $(PRAWNOS_BUILD) prawnos-linux-image-$(TARGET)*.deb +kernel_install: #Targets the PrawnOS image and installs a kernel + $(MAKE) kernel_image_package_install .PHONY: kernel_update kernel_update: $(MAKE) clean_image $(MAKE) clean_kernel $(MAKE) initramfs - $(MAKE) kernel cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE) - $(MAKE) kernel_install + $(MAKE) kernel_image_package_install .PHONY: image image: $(MAKE) clean_image $(MAKE) filesystem $(MAKE) initramfs - $(MAKE) kernel cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE) - $(MAKE) kernel_install + $(MAKE) kernel_image_package_install + # $PDEV should be passed like PDEV=/dev/sdb .PHONY: write_image diff --git a/scripts/BuildScripts/BuildCommon.mk b/scripts/BuildScripts/BuildCommon.mk index 553bcd943..9d34ee95d 100644 --- a/scripts/BuildScripts/BuildCommon.mk +++ b/scripts/BuildScripts/BuildCommon.mk @@ -66,8 +66,10 @@ PRAWNOS_KERNEL_IMAGE_DEBVER := 1 PRAWNOS_KERNEL_HEADERS_DEBVER := 1 endif -PRAWNOS_KERNEL_IMAGE_CAT_VER=$(KVER)-$(PRAWNOS_KERNEL_VER)-$(PRAWNOS_KERNEL_IMAGE_DEBVER) -PRAWNOS_KERNEL_HEADERS_CAT_VER=$(KVER)-$(PRAWNOS_KERNEL_VER)-$(PRAWNOS_KERNEL_HEADERS_DEBVER) +PRAWNOS_KERNEL_IMAGE_CAT_PRAWNOS_VER=$(KVER)-$(PRAWNOS_KERNEL_VER) +PRAWNOS_KERNEL_IMAGE_CAT_DEB_VER=$(KVER)-$(PRAWNOS_KERNEL_VER)-$(PRAWNOS_KERNEL_IMAGE_DEBVER) +PRAWNOS_KERNEL_HEADERS_CAT_PRAWNOS_VER=$(KVER)-$(PRAWNOS_KERNEL_VER) +PRAWNOS_KERNEL_HEADERS_CAT_DEB_VER=$(KVER)-$(PRAWNOS_KERNEL_VER)-$(PRAWNOS_KERNEL_HEADERS_DEBVER) # Otherwise errors are ignored when output is piped to tee: SHELL := /bin/bash -o pipefail diff --git a/scripts/BuildScripts/ImageScripts/installKernelToFs.sh b/scripts/BuildScripts/ImageScripts/installKernelToFs.sh index 181d52ed2..0de856cb2 100755 --- a/scripts/BuildScripts/ImageScripts/installKernelToFs.sh +++ b/scripts/BuildScripts/ImageScripts/installKernelToFs.sh @@ -32,8 +32,10 @@ fi KVER=$1 OUTNAME=$2 TARGET=$3 -KERNEL_PACKAGE_PATH=$4 -KERNEL_PACKAGE=$5 +KERNEL_BUILD=$4 +KERNEL_PACKAGE_PATH=$5 +KERNEL_PACKAGE_NAME=$6 +KERNEL_PACKAGE_DEB=$7 @@ -85,21 +87,21 @@ kernel_size=65536 #this is very very important, not doing this or using the incorrect kernel size can lead to very strange and difficult to debug issues dd if=/dev/zero of=${outdev}p1 conv=notrunc bs=512 count=$kernel_size #now write the new kernel -dd if=build/$TARGET/linux-$KVER/vmlinux.kpart of=${outdev}p1 +dd if=$KERNEL_BUILD/vmlinux.kpart of=${outdev}p1 #install the kernel image package to the chroot so it can be updated by apt later #need to do funky things to avoid running the postinst script that dds the kernel to the kernel partition #maybe it would make more sense to run this on install, but then a usb booting device couldn't upgrade its kernel -#TODO uncomment and test once arm64 is done -# cp $KERNEL_PACKAGE_PATH $outmnt/ -# chroot $outmnt dpkg --unpack $KERNEL_PACKAGE -# chroot $outmnt rm /var/lib/dpkg/info/$KERNEL_PACKAGE.postinst -f -# chroot $outmnt dpkg --configure $KERNEL_PACKAGE +cp $KERNEL_PACKAGE_PATH/$KERNEL_PACKAGE_DEB $outmnt/ +chroot $outmnt dpkg --unpack /$KERNEL_PACKAGE_DEB +chroot $outmnt rm /var/lib/dpkg/info/$KERNEL_PACKAGE_NAME.postinst +chroot $outmnt dpkg --configure $KERNEL_PACKAGE_NAME +chroot $outmnt rm /$KERNEL_PACKAGE_DEB #install the kernel modules and headers #we dont make any modules yet # make -C build/$TARGET/linux-$KVER ARCH=$KERNEL_ARCH INSTALL_MOD_PATH=$outmnt modules_install -make -C build/$TARGET/linux-$KVER ARCH=$KERNEL_ARCH INSTALL_HDR_PATH=$outmnt/usr/src/linux-$KVER-gnu headers_install +make -C $KERNEL_BUILD ARCH=$KERNEL_ARCH INSTALL_HDR_PATH=$outmnt/usr/src/linux-$KVER-gnu headers_install # the ath9k firmware is built into the kernel image, so nothing else must be done umount -l $outmnt > /dev/null 2>&1 diff --git a/scripts/BuildScripts/KernelScripts/updateKernelDebfiles.sh b/scripts/BuildScripts/KernelScripts/updateKernelDebfiles.sh index 6f58d5ddb..e24325c2e 100755 --- a/scripts/BuildScripts/KernelScripts/updateKernelDebfiles.sh +++ b/scripts/BuildScripts/KernelScripts/updateKernelDebfiles.sh @@ -28,13 +28,25 @@ then fi if [ -z "$2" ] then - echo "No kernel version supplied" + echo "No deb kernel version supplied" + exit 1 +fi +if [ -z "$3" ] +then + echo "No prawnos kernel version supplied" + exit 1 +fi +if [ -z "$4" ] +then + echo "No prawnos kernel image package path supplied" exit 1 fi DEBSRC=$1 DEBKVER=$2 +PRAWNOSKVER=$3 +PACKAGEPATH=$4 cd $DEBSRC # check the supplied kver against the current kver