2020-06-15 23:27:21 +02:00
|
|
|
# This file is part of PrawnOS (https://www.prawnos.com)
|
2018-10-11 22:09:25 +02:00
|
|
|
# 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-06-21 09:28:45 +02:00
|
|
|
.DEFAULT_GOAL := image
|
2020-06-13 03:23:04 +02:00
|
|
|
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
|
2020-06-21 01:44:09 +02:00
|
|
|
include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
|
2020-06-21 09:28:45 +02:00
|
|
|
include $(PRAWNOS_ROOT)/initramfs/makefile
|
|
|
|
include $(PRAWNOS_ROOT)/kernel/makefile
|
2019-02-27 20:20:11 +01:00
|
|
|
|
|
|
|
#Usage:
|
|
|
|
#run make image
|
2020-06-21 09:28:45 +02:00
|
|
|
#this will generate two images named PRAWNOS_IMAGE and PRAWNOS_IMAGE-BASE
|
2019-02-27 20:20:11 +01:00
|
|
|
#-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:"
|
2020-06-21 09:28:45 +02:00
|
|
|
#TODO
|
|
|
|
|
|
|
|
.PHONY: clean_image
|
2018-09-07 18:56:22 +02:00
|
|
|
clean_img:
|
2020-06-21 09:28:45 +02:00
|
|
|
rm -f $(PRAWNOS_IMAGE)
|
2019-02-27 20:20:11 +01:00
|
|
|
|
2019-10-15 16:27:47 +02:00
|
|
|
.PHONY: clean_basefs
|
|
|
|
clean_basefs:
|
2020-06-21 09:28:45 +02:00
|
|
|
rm -f $(PRAWNOS_IMAGE_BASE)
|
2020-06-14 21:07:29 +02:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
.PHONY: clean_pbuilder
|
2020-05-28 02:46:37 +02:00
|
|
|
clean_pbuilder:
|
2020-05-27 01:02:03 +02:00
|
|
|
rm -r build/prawnos-pbuilder-armhf-base.tgz
|
|
|
|
|
2018-09-07 18:56:22 +02:00
|
|
|
.PHONY: clean_all
|
2020-06-21 09:28:45 +02:00
|
|
|
clean_all: clean_kernel clean_initramfs clean_ath9k clean_image clean_basefs 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
|
2020-06-21 09:28:45 +02:00
|
|
|
build_dirs: $(PRAWNOS_BUILD)
|
2018-09-07 01:55:46 +02:00
|
|
|
|
|
|
|
|
2020-06-21 09:28:45 +02:00
|
|
|
#:::::::::::::::::::::::::::::: kernel ::::::::::::::::::::::::::::::::::::
|
|
|
|
#included from kernel/makefile
|
2020-05-27 01:02:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::: initramfs :::::::::::::::::::::::::::::::::
|
2020-06-21 09:28:45 +02:00
|
|
|
#included from initramfs/makefile
|
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-05-27 08:13:18 +02:00
|
|
|
rm -rf build/logs/fs-log.txt
|
2020-05-28 20:00:38 +02:00
|
|
|
$(MAKE) pbuilder_create
|
2020-06-21 09:28:45 +02:00
|
|
|
$(MAKE) filesystem_packages
|
|
|
|
[ -f $(PRAWNOS_IMAGE_BASE) ] || $(PRAWNOS_FILESYSTEM_SCRIPTS_BUILD) $(KVER) $(DEBIAN_SUITE) $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_ROOT) $(PRAWNOS_SHARED_SCRIPTS) 2>&1 | tee build/logs/fs-log.txt
|
2019-02-27 20:20:11 +01:00
|
|
|
|
2020-06-13 03:23:04 +02:00
|
|
|
#:::::::::::::::::::::::::::::: packages ::::::::::::::::::::::::::::::::
|
2020-06-21 09:28:45 +02:00
|
|
|
.PHONY: filesystem_packages
|
|
|
|
filesystem_packages:
|
|
|
|
$(MAKE) filesystem_packages -C packages
|
2020-06-13 03:23:04 +02:00
|
|
|
|
2020-06-21 09:28:45 +02:00
|
|
|
.PHONY: filesystem_packages_install
|
|
|
|
filesystem_packages_install:
|
2020-06-17 08:51:39 +02:00
|
|
|
ifndef INSTALL_TARGET
|
|
|
|
$(error INSTALL_TARGET is not set)
|
|
|
|
endif
|
2020-06-21 09:28:45 +02:00
|
|
|
$(MAKE) filesystem_packages_install INSTALL_TARGET=$(INSTALL_TARGET) -C filesystem
|
2020-06-17 08:51:39 +02:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: image management ::::::::::::::::::::::::::
|
2020-05-28 02:46:37 +02:00
|
|
|
|
2020-06-21 01:44:09 +02:00
|
|
|
.PHONY: kernel_install
|
2020-05-28 02:46:37 +02:00
|
|
|
kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
|
2020-06-21 09:28:45 +02:00
|
|
|
$(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(PRAWNOS_IMAGE)
|
2020-05-28 02:46:37 +02:00
|
|
|
|
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
|
2020-06-21 09:28:45 +02:00
|
|
|
cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE)
|
2020-06-21 01:44:09 +02:00
|
|
|
$(MAKE) kernel_install
|
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
|
2020-06-21 09:28:45 +02:00
|
|
|
cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE)
|
2020-06-21 01:44:09 +02:00
|
|
|
$(MAKE) kernel_install
|
2019-02-27 20:20:11 +01:00
|
|
|
|
2020-05-27 01:02:03 +02:00
|
|
|
#:::::::::::::::::::::::::::::: pbuilder management :::::::::::::::::::::::
|
2020-05-28 19:06:52 +02:00
|
|
|
.PHONY: pbuilder_create
|
2020-05-28 23:58:19 +02:00
|
|
|
pbuilder_create:
|
2020-05-28 19:06:52 +02:00
|
|
|
$(MAKE) $(PBUILDER_CHROOT)
|
|
|
|
|
2020-06-13 03:23:04 +02:00
|
|
|
$(PBUILDER_CHROOT):
|
2020-05-27 01:02:03 +02:00
|
|
|
pbuilder create --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)
|
2019-02-27 20:20:11 +01:00
|
|
|
|
2020-05-28 19:06:52 +02:00
|
|
|
#TODO: should only update if not updated for a day
|
|
|
|
.PHONY: pbuilder_update
|
2020-05-28 23:58:19 +02:00
|
|
|
pbuilder_update:
|
2020-05-27 01:02:03 +02:00
|
|
|
pbuilder update --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)
|