2018-10-11 22:09:25 +02:00
|
|
|
# This file is part of PrawnOS (http://www.prawnos.com)
|
|
|
|
# Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
|
|
|
|
|
|
|
|
# PrawnOS is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License version 2
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
# PrawnOS is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2020-04-03 13:53:08 +02:00
|
|
|
KVER=5.4.29
|
2020-01-11 21:56:45 +01:00
|
|
|
ifeq ($(DEBIAN_SUITE),)
|
|
|
|
DEBIAN_SUITE=buster
|
|
|
|
endif
|
2019-06-07 19:05:58 +02:00
|
|
|
ifeq ($(PRAWNOS_SUITE),)
|
2020-01-11 21:56:45 +01:00
|
|
|
PRAWNOS_SUITE=Shiba
|
2019-06-07 19:05:58 +02:00
|
|
|
endif
|
2020-01-11 21:56:45 +01:00
|
|
|
OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-c201.img
|
2019-02-27 20:20:11 +01:00
|
|
|
BASE=$(OUTNAME)-BASE
|
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
|
|
|
|
PRAWNOS_ROOT := $(shell pwd)
|
|
|
|
PBUILDER_CHROOT=$(PRAWNOS_ROOT)/build/prawnos-pbuilder-armhf-base.tgz
|
|
|
|
PBUILDER_RC=$(PRAWNOS_ROOT)/resources/BuildResources/pbuilder/prawnos-pbuilder.rc
|
|
|
|
|
2020-05-25 01:49:52 +02:00
|
|
|
# Otherwise errors are ignored when output is piped to tee:
|
|
|
|
SHELL=/bin/bash -o pipefail
|
2019-02-27 20:20:11 +01:00
|
|
|
|
|
|
|
#Usage:
|
|
|
|
#run make image
|
|
|
|
#this will generate two images named OUTNAME and OUTNAME-BASE
|
|
|
|
#-BASE is only the filesystem with no kernel.
|
|
|
|
|
|
|
|
|
|
|
|
#if you make any changes to the kernel or kernel config with make kernel_config
|
|
|
|
#run kernel_inject
|
|
|
|
|
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: cleaning ::::::::::::::::::::::::::::::
|
2018-09-07 18:56:22 +02:00
|
|
|
.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"
|
2019-02-27 20:20:11 +01:00
|
|
|
@echo " clean_img - which deletes the built PrawnOS image, this is ran when make image is ran"
|
2019-10-15 16:27:47 +02:00
|
|
|
@echo " clean_basefs - which deletes the built PrawnOS base image"
|
|
|
|
@echo " clean_initramfs - which deletes the built PrawnOS initramfs image that gets injected into the kernel"
|
2018-09-07 18:56:22 +02:00
|
|
|
@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
|
|
|
|
clean_kernel:
|
2019-09-19 23:57:09 +02:00
|
|
|
rm -rf build/linux-$(KVER)
|
2018-09-07 18:56:22 +02:00
|
|
|
|
|
|
|
.PHONY: clean_ath
|
|
|
|
clean_ath:
|
|
|
|
rm -rf build/open-ath9k-htc-firmware
|
2018-09-07 01:55:46 +02:00
|
|
|
|
2018-09-07 18:56:22 +02:00
|
|
|
.PHONY: clean_img
|
|
|
|
clean_img:
|
2019-02-27 20:20:11 +01:00
|
|
|
rm -f $(OUTNAME)
|
|
|
|
|
2019-10-15 16:27:47 +02:00
|
|
|
.PHONY: clean_basefs
|
|
|
|
clean_basefs:
|
2019-02-27 20:20:11 +01:00
|
|
|
rm -r $(BASE)
|
2018-09-07 18:56:22 +02:00
|
|
|
|
2019-10-15 16:27:47 +02:00
|
|
|
.PHONY: clean_initramfs
|
|
|
|
clean_initramfs:
|
|
|
|
rm -r build/PrawnOS-initramfs.cpio.gz
|
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
.PHONY: clean_pbuilder
|
|
|
|
clean_initramfs:
|
|
|
|
rm -r build/prawnos-pbuilder-armhf-base.tgz
|
|
|
|
|
2018-09-07 18:56:22 +02:00
|
|
|
.PHONY: clean_all
|
|
|
|
clean_all:
|
2020-05-10 10:01:52 +02:00
|
|
|
$(MAKE) clean_kernel
|
|
|
|
$(MAKE) clean_ath
|
|
|
|
$(MAKE) clean_img
|
|
|
|
$(MAKE) clean_basefs
|
|
|
|
$(MAKE) clean_initramfs
|
2020-05-27 01:02:03 +02:00
|
|
|
$(MAKE) clean_pbuilder
|
2018-09-07 01:55:46 +02:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: premake prep ::::::::::::::::::::::::::::::
|
2020-04-01 00:13:37 +02:00
|
|
|
.PHONY: build_dirs
|
|
|
|
build_dirs:
|
|
|
|
mkdir -p build/logs/
|
2018-09-07 01:55:46 +02:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: kernel ::::::::::::::::::::::::::::::::::::
|
2018-09-07 18:56:22 +02:00
|
|
|
.PHONY: kernel
|
2018-09-07 01:55:46 +02:00
|
|
|
kernel:
|
2020-05-10 10:01:52 +02:00
|
|
|
$(MAKE) build_dirs
|
2020-04-01 00:13:37 +02:00
|
|
|
rm -rf build/logs/kernel-log.txt
|
2020-05-25 01:49:52 +02:00
|
|
|
./scripts/buildKernel.sh $(KVER) 2>&1 | tee build/logs/kernel-log.txt
|
2018-09-07 01:55:46 +02:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
.PHONY: kernel_config
|
|
|
|
kernel_config:
|
|
|
|
scripts/crossmenuconfig.sh $(KVER)
|
|
|
|
|
|
|
|
.PHONY: patch_kernel
|
|
|
|
patch_kernel:
|
|
|
|
scripts/patchKernel.sh
|
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::: initramfs :::::::::::::::::::::::::::::::::
|
2019-09-21 06:50:08 +02:00
|
|
|
.PHONY: initramfs
|
|
|
|
initramfs:
|
2020-05-10 10:01:52 +02:00
|
|
|
$(MAKE) build_dirs
|
2020-04-01 00:13:37 +02:00
|
|
|
rm -rf build/logs/kernel-log.txt
|
2020-05-25 01:49:52 +02:00
|
|
|
./scripts/buildInitramFs.sh $(BASE) 2>&1 | tee build/logs/initramfs-log.txt
|
2019-09-21 06:50:08 +02:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: filesystem ::::::::::::::::::::::::::::::::
|
|
|
|
#makes the base filesystem image without kernel. Only make a new one if the base image isnt present
|
2018-09-07 18:56:22 +02:00
|
|
|
.PHONY: filesystem
|
2018-09-07 01:55:46 +02:00
|
|
|
filesystem:
|
2020-05-10 10:01:52 +02:00
|
|
|
$(MAKE) build_dirs
|
2020-04-01 00:13:37 +02:00
|
|
|
rm -rf build/logs/kernel-log.txt
|
2020-05-25 01:49:52 +02:00
|
|
|
[ -f $(BASE) ] || ./scripts/buildFilesystem.sh $(KVER) $(DEBIAN_SUITE) $(BASE) 2>&1 | tee build/logs/fs-log.txt
|
2018-09-07 01:55:46 +02:00
|
|
|
|
2019-02-27 20:20:11 +01:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: image management ::::::::::::::::::::::::::
|
2020-02-27 21:06:23 +01:00
|
|
|
.PHONY: kernel_update
|
|
|
|
kernel_update:
|
2020-05-27 01:02:03 +02:00
|
|
|
$(MAKE) clean_img
|
2020-05-10 10:01:52 +02:00
|
|
|
$(MAKE) initramfs
|
|
|
|
$(MAKE) kernel
|
2019-06-07 19:05:58 +02:00
|
|
|
cp $(BASE) $(OUTNAME)
|
2020-05-27 01:02:03 +02:00
|
|
|
scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME)
|
2018-09-07 01:55:46 +02:00
|
|
|
|
2018-09-07 18:56:22 +02:00
|
|
|
.PHONY: image
|
2018-09-07 01:55:46 +02:00
|
|
|
image:
|
2020-05-10 10:01:52 +02:00
|
|
|
$(MAKE) clean_img
|
|
|
|
$(MAKE) filesystem
|
|
|
|
$(MAKE) initramfs
|
|
|
|
$(MAKE) kernel
|
2019-02-27 20:20:11 +01:00
|
|
|
cp $(BASE) $(OUTNAME)
|
2020-05-13 10:45:26 +02:00
|
|
|
$(MAKE) kernel_inject
|
2019-02-27 20:20:11 +01:00
|
|
|
|
2018-09-07 01:55:46 +02:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: pbuilder management :::::::::::::::::::::::
|
|
|
|
.PHONY: pbuilder-create
|
|
|
|
pbuilder-create:
|
|
|
|
pbuilder create --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)
|
2019-02-27 20:20:11 +01:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
.PHONY: pbuilder-update
|
|
|
|
pbuilder-update:
|
|
|
|
pbuilder update --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)
|