Flesh out the package building scripts

add pbuilder for cross compiliation
This commit is contained in:
Hal Emmerich 2020-05-26 18:02:03 -05:00
parent d863d7c3b8
commit 30770c3e4d
7 changed files with 125 additions and 46 deletions

View File

@ -55,7 +55,7 @@ These packages are required:
bc binfmt-support bison build-essential bzip2 ca-certificates cgpt cmake cpio debhelper \
debootstrap device-tree-compiler devscripts file flex g++ gawk gcc gcc-arm-none-eabi git gpg \
gpg-agent kmod libc-dev libncurses-dev libssl-dev lzip make parted patch \
qemu-user-static sudo texinfo u-boot-tools udev vboot-kernel-utils wget
pbuilder qemu-user-static sudo texinfo u-boot-tools udev vboot-kernel-utils wget
```
## Build

101
makefile
View File

@ -23,6 +23,11 @@ endif
OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-c201.img
BASE=$(OUTNAME)-BASE
PRAWNOS_ROOT := $(shell pwd)
PBUILDER_CHROOT=$(PRAWNOS_ROOT)/build/prawnos-pbuilder-armhf-base.tgz
PBUILDER_RC=$(PRAWNOS_ROOT)/resources/BuildResources/pbuilder/prawnos-pbuilder.rc
# Otherwise errors are ignored when output is piped to tee:
SHELL=/bin/bash -o pipefail
@ -36,7 +41,7 @@ SHELL=/bin/bash -o pipefail
#run kernel_inject
#:::::::::::::::::::::::::::::: cleaning ::::::::::::::::::::::::::::::
.PHONY: clean
clean:
@echo "Enter one of:"
@ -68,6 +73,10 @@ clean_basefs:
clean_initramfs:
rm -r build/PrawnOS-initramfs.cpio.gz
.PHONY: clean_pbuilder
clean_initramfs:
rm -r build/prawnos-pbuilder-armhf-base.tgz
.PHONY: clean_all
clean_all:
$(MAKE) clean_kernel
@ -75,60 +84,20 @@ clean_all:
$(MAKE) clean_img
$(MAKE) clean_basefs
$(MAKE) clean_initramfs
$(MAKE) clean_pbuilder
#:::::::::::::::::::::::::::::: premake prep ::::::::::::::::::::::::::::::
.PHONY: build_dirs
build_dirs:
mkdir -p build/logs/
#:::::::::::::::::::::::::::::: kernel ::::::::::::::::::::::::::::::::::::
.PHONY: kernel
kernel:
$(MAKE) build_dirs
rm -rf build/logs/kernel-log.txt
./scripts/buildKernel.sh $(KVER) 2>&1 | tee build/logs/kernel-log.txt
.PHONY: initramfs
initramfs:
$(MAKE) build_dirs
rm -rf build/logs/kernel-log.txt
./scripts/buildInitramFs.sh $(BASE) 2>&1 | tee build/logs/initramfs-log.txt
#makes the base filesystem image, no kernel only if the base image isnt present
.PHONY: filesystem
filesystem:
$(MAKE) build_dirs
rm -rf build/logs/kernel-log.txt
[ -f $(BASE) ] || ./scripts/buildFilesystem.sh $(KVER) $(DEBIAN_SUITE) $(BASE) 2>&1 | tee build/logs/fs-log.txt
.PHONY: kernel_inject
kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME)
.PHONY: kernel_update
kernel_update:
$(MAKE) initramfs
$(MAKE) kernel
$(MAKE) kernel_inject
.PHONY: injected_image
injected_image: #makes a copy of the base image with a new injected kernel
$(MAKE) kernel
cp $(BASE) $(OUTNAME)
$(MAKE) kernel_inject
.PHONY: image
image:
$(MAKE) clean_img
$(MAKE) filesystem
$(MAKE) initramfs
$(MAKE) kernel
#Make a new copy of the filesystem image
cp $(BASE) $(OUTNAME)
$(MAKE) kernel_inject
.PHONY: live_image
live_image:
echo "TODO"
.PHONY: kernel_config
kernel_config:
scripts/crossmenuconfig.sh $(KVER)
@ -136,3 +105,47 @@ kernel_config:
.PHONY: patch_kernel
patch_kernel:
scripts/patchKernel.sh
#:::::::::::::::::::::::::::::: initramfs :::::::::::::::::::::::::::::::::
.PHONY: initramfs
initramfs:
$(MAKE) build_dirs
rm -rf build/logs/kernel-log.txt
./scripts/buildInitramFs.sh $(BASE) 2>&1 | tee build/logs/initramfs-log.txt
#:::::::::::::::::::::::::::::: filesystem ::::::::::::::::::::::::::::::::
#makes the base filesystem image without kernel. Only make a new one if the base image isnt present
.PHONY: filesystem
filesystem:
$(MAKE) build_dirs
rm -rf build/logs/kernel-log.txt
[ -f $(BASE) ] || ./scripts/buildFilesystem.sh $(KVER) $(DEBIAN_SUITE) $(BASE) 2>&1 | tee build/logs/fs-log.txt
#:::::::::::::::::::::::::::::: image management ::::::::::::::::::::::::::
.PHONY: kernel_update
kernel_update:
$(MAKE) clean_img
$(MAKE) initramfs
$(MAKE) kernel
cp $(BASE) $(OUTNAME)
scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME)
.PHONY: image
image:
$(MAKE) clean_img
$(MAKE) filesystem
$(MAKE) initramfs
$(MAKE) kernel
cp $(BASE) $(OUTNAME)
$(MAKE) kernel_inject
#:::::::::::::::::::::::::::::: pbuilder management :::::::::::::::::::::::
.PHONY: pbuilder-create
pbuilder-create:
pbuilder create --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)
.PHONY: pbuilder-update
pbuilder-update:
pbuilder update --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)

View File

@ -0,0 +1,28 @@
#only include specific /debian files
src/debian/*
!src/debian/compat
!src/debian/changelog
!src/debian/control
!src/debian/rules
!src/debian/copyright
!src/debian/docs
!src/debian/watch
!src/debian/source/format
#since we have not changed upstream, and this is packaged don't keep the source files
src/*
#generic packaging artifacts
debhelper-build-stamp
.debhelper
*.deb
*.dsc
*.build
*.buildinfo
*.changes
*.log
*.substvars
*.diff.gz
*.upload
*.debian.tar.xz

View File

@ -0,0 +1,29 @@
SHELL := /bin/bash
PRAWNOS_ROOT := $(shell cd ../../../../; pwd)
PBUILDER_CHROOT=$(PRAWNOS_ROOT)/build/prawnos-pbuilder-armhf-base.tgz
PBUILDER_RC=$(PRAWNOS_ROOT)/resources/BuildResources/pbuilder/prawnos-pbuilder.rc
all: xsecurelock-deb
.PHONY: xsecurelock-deb
xsecurelock-deb:
cd src/; pdebuild --configfile $(PBUILDER_RC) \
--buildresult .. \
-- \
--basetgz $(PBUILDER_CHROOT) \
.PHONY: clean
clean:
rm -rf *.upload
rm -rf *.deb
rm -rf *.changes
rm -rf *.dsc
rm -rf *.build
rm -rf *.debian.tar.xz
rm -rf *.buildinfo
.PHONY: upload
upload:
dput deb.prawnos.com *.changes

View File

@ -0,0 +1,5 @@
PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt"
DISTRIBUTION=buster
ARCHITECTURE=armhf
DEBOOTSTRAP=qemu-debootstrap
DEBOOTSTRAPOPTS=( '--variant=buildd' '--arch=armhf' )

View File

@ -26,7 +26,11 @@ cd "$(dirname "$0")/.."
apt-get update
# Note: this is a copy/paste from README.md, if you add anything here, also update it!
apt-get -y install --no-install-recommends --no-install-suggests bc binfmt-support bison bzip2 ca-certificates cgpt cmake cpio debootstrap device-tree-compiler file flex g++ gawk gcc gcc-arm-none-eabi git gpg gpg-agent kmod libc-dev libncurses-dev libssl-dev lzip make parted patch qemu-user-static sudo texinfo u-boot-tools udev vboot-kernel-utils wget
apt install --no-install-recommends --no-install-suggests \
bc binfmt-support bison build-essential bzip2 ca-certificates cgpt cmake cpio debhelper \
debootstrap device-tree-compiler devscripts file flex g++ gawk gcc gcc-arm-none-eabi git gpg \
gpg-agent kmod libc-dev libncurses-dev libssl-dev lzip make parted patch \
pbuilder qemu-user-static sudo texinfo u-boot-tools udev vboot-kernel-utils wget
# Note: there's an error for /proc/modules, but at least building the image works fine: