2020-06-15 21:27:21 +00:00
# This file is part of PrawnOS (https://www.prawnos.com)
2018-10-11 20:09:25 +00: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 07:28:45 +00:00
.DEFAULT_GOAL := image
2020-06-13 01:23:04 +00:00
PRAWNOS_ROOT := $( shell git rev-parse --show-toplevel)
2020-06-20 23:44:09 +00:00
i n c l u d e $( PRAWNOS_ROOT ) / s c r i p t s / B u i l d S c r i p t s / B u i l d C o m m o n . m k
2020-06-21 07:28:45 +00:00
i n c l u d e $( PRAWNOS_ROOT ) / i n i t r a m f s / m a k e f i l e
i n c l u d e $( PRAWNOS_ROOT ) / k e r n e l / m a k e f i l e
2020-06-30 03:39:56 +00:00
i n c l u d e $( PRAWNOS_ROOT ) / f i l e s y s t e m / m a k e f i l e
2019-02-27 19:20:11 +00:00
#Usage:
#run make image
2020-06-21 07:28:45 +00:00
#this will generate two images named PRAWNOS_IMAGE and PRAWNOS_IMAGE-BASE
2019-02-27 19:20:11 +00: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-26 23:02:03 +00:00
#:::::::::::::::::::::::::::::: cleaning ::::::::::::::::::::::::::::::
2018-09-07 16:56:22 +00:00
.PHONY : clean
clean :
2020-09-13 20:48:13 +00:00
@echo "Enter one of the following:"
@echo " clean_image : removes the built PrawnOS- $( PRAWNOS_SUITE) - $( TARGET) .img "
2020-09-17 15:46:10 +00:00
@echo "clean_basefs : removes the -BASE prawnos image which contains the base filesystem"
2020-09-13 20:48:13 +00:00
@echo " clean_pbuilder : removes the pbuilder chroot used to build the prawnos packages locally located in build/ $( TARGET) /prawnos-pbuilder- $( TARGET) -base.tgz "
@echo " clean_kernel : removes the kernel build directory build/ $( TARGET) /linux-<kver> "
@echo "clean_ath9k : removes the ath9k firmware build directory build/shared/open-ath9k-htc-firmware"
@echo " clean_initramfs : removes the built initramfs image located in build/ $( TARGET) /PrawnOS-initramfs.cpio.gz "
2020-09-17 15:46:10 +00:00
@echo "clean_most : cleans kernel, initramfs, basefs, image. these are the most common items required to clean for a full rebuild."
@echo "clean_all : runs all of the above clean commands, rarely needed. Most likely want clean_most"
2020-06-21 07:28:45 +00:00
.PHONY : clean_image
2020-06-30 03:39:56 +00:00
clean_image :
2020-06-21 07:28:45 +00:00
rm -f $( PRAWNOS_IMAGE)
2019-02-27 19:20:11 +00:00
2019-10-15 14:27:47 +00:00
.PHONY : clean_basefs
clean_basefs :
2020-06-21 07:28:45 +00:00
rm -f $( PRAWNOS_IMAGE_BASE)
2020-06-14 19:07:29 +00:00
2020-05-26 23:02:03 +00:00
.PHONY : clean_pbuilder
2020-05-28 00:46:37 +00:00
clean_pbuilder :
2020-09-17 15:46:10 +00:00
rm -f $( PBUILDER_CHROOT)
.PHONY : clean_most
2020-09-23 23:13:25 +00:00
clean_most : clean_kernel clean_initramfs clean_image clean_basefs
2020-09-17 15:46:10 +00:00
@echo "cleaned kernel, initramfs, basefs, image"
2020-05-26 23:02:03 +00:00
2018-09-07 16:56:22 +00:00
.PHONY : clean_all
2020-09-17 15:46:10 +00:00
clean_all : clean_most clean_ath 9k clean_pbuilder
@echo "cleaned all"
2018-09-06 23:55:46 +00:00
2020-06-21 07:28:45 +00:00
#:::::::::::::::::::::::::::::: kernel ::::::::::::::::::::::::::::::::::::
#included from kernel/makefile
2020-05-26 23:02:03 +00:00
#:::::::::::::::::::::::::::::: initramfs :::::::::::::::::::::::::::::::::
2020-06-21 07:28:45 +00:00
#included from initramfs/makefile
2019-09-21 04:50:08 +00:00
2020-05-26 23:02:03 +00:00
#:::::::::::::::::::::::::::::: filesystem ::::::::::::::::::::::::::::::::
#makes the base filesystem image without kernel. Only make a new one if the base image isnt present
2020-06-30 03:39:56 +00:00
#included from filesystem/makefile
2019-02-27 19:20:11 +00:00
2020-06-13 01:23:04 +00:00
#:::::::::::::::::::::::::::::: packages ::::::::::::::::::::::::::::::::
2020-06-30 03:39:56 +00:00
#included from filesystem/makefile
2020-06-17 06:51:39 +00:00
2020-05-26 23:02:03 +00:00
#:::::::::::::::::::::::::::::: image management ::::::::::::::::::::::::::
2020-05-28 00:46:37 +00:00
2020-06-20 23:44:09 +00:00
.PHONY : kernel_install
2020-12-05 04:19:57 +00:00
kernel_install : #Targets the PrawnOS image and installs a kernel
$( MAKE) kernel_image_package_install
2020-05-28 00:46:37 +00:00
2020-02-27 20:06:23 +00:00
.PHONY : kernel_update
kernel_update :
2020-06-30 03:39:56 +00:00
$( MAKE) clean_image
2020-10-24 17:16:39 +00:00
$( MAKE) clean_kernel
2020-05-10 08:01:52 +00:00
$( MAKE) initramfs
2020-06-21 07:28:45 +00:00
cp $( PRAWNOS_IMAGE_BASE) $( PRAWNOS_IMAGE)
2020-12-05 04:19:57 +00:00
$( MAKE) kernel_image_package_install
2018-09-06 23:55:46 +00:00
2018-09-07 16:56:22 +00:00
.PHONY : image
2018-09-06 23:55:46 +00:00
image :
2020-06-30 03:39:56 +00:00
$( MAKE) clean_image
2020-05-10 08:01:52 +00:00
$( MAKE) filesystem
$( MAKE) initramfs
2020-06-21 07:28:45 +00:00
cp $( PRAWNOS_IMAGE_BASE) $( PRAWNOS_IMAGE)
2020-12-05 04:19:57 +00:00
$( MAKE) kernel_image_package_install
2020-07-18 07:08:54 +00:00
2020-11-11 06:15:03 +00:00
# $PDEV should be passed like PDEV=/dev/sdb
.PHONY : write_image
write_image : $( PRAWNOS_IMAGE )
$( PRAWNOS_IMAGE_SCRIPTS_WRITE_IMAGE) $( PRAWNOS_IMAGE) $( PDEV)
2021-03-28 18:57:21 +00:00
.PHONY : release
release : $( PRAWNOS_IMAGE_RELEASE_GZ )
2020-10-29 00:42:52 +00:00
$(PRAWNOS_IMAGE) :
$( MAKE) image
2021-03-28 18:57:21 +00:00
$(PRAWNOS_IMAGE_RELEASE_GZ) : $( PRAWNOS_IMAGE )
gzip -c $( PRAWNOS_IMAGE) > $( PRAWNOS_IMAGE_RELEASE_GZ)
2020-10-29 00:42:52 +00:00
2020-07-18 07:08:54 +00:00
#:::::::::::::::::::::::::::::: dependency management ::::::::::::::::::::::::::
2020-10-20 21:44:02 +00:00
# this will only do everything right on bullseye due to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=965109
# see the README for how to build on buster
2020-07-18 07:08:54 +00:00
.PHONY : install_dependencies
install_dependencies :
2020-07-18 07:17:21 +00:00
apt install --no-install-recommends --no-install-suggests $( AUTO_YES) \
2020-07-18 07:08:54 +00:00
bc binfmt-support bison build-essential bzip2 ca-certificates cgpt cmake cpio debhelper \
debootstrap device-tree-compiler devscripts file flex g++ gawk gcc gcc-aarch64-linux-gnu \
2020-11-24 09:55:57 +00:00
gcc-arm-none-eabi git gpg gpg-agent kmod libc-dev libncurses-dev libssl-dev make \
2020-10-20 19:01:24 +00:00
parted patch pbuilder qemu-user-static quilt rsync sudo texinfo u-boot-tools udev vboot-kernel-utils wget
2020-07-18 07:08:54 +00:00
2020-07-18 07:17:21 +00:00
.PHONY : install_dependencies_yes
install_dependencies_yes :
$( MAKE) AUTO_YES = "-y" install_dependencies