diff --git a/filesystem/makefile b/filesystem/makefile
new file mode 100644
index 0000000..d91f6ba
--- /dev/null
+++ b/filesystem/makefile
@@ -0,0 +1,8 @@
+filesystem_packages:
+ $(MAKE) -C packages all
+
+filesystem_packages_clean:
+ $(MAKE) -C packages clean
+
+filesystem_packages_install:
+ $(MAKE) -C packages INSTALL_TARGET=$(INSTALL_TARGET) install
diff --git a/packages/filesystem/flashmap/.gitignore b/filesystem/packages/flashmap/.gitignore
similarity index 100%
rename from packages/filesystem/flashmap/.gitignore
rename to filesystem/packages/flashmap/.gitignore
diff --git a/packages/filesystem/flashmap/flashmap_0.3.orig.tar.gz b/filesystem/packages/flashmap/flashmap_0.3.orig.tar.gz
similarity index 100%
rename from packages/filesystem/flashmap/flashmap_0.3.orig.tar.gz
rename to filesystem/packages/flashmap/flashmap_0.3.orig.tar.gz
diff --git a/packages/filesystem/flashmap/makefile b/filesystem/packages/flashmap/makefile
similarity index 100%
rename from packages/filesystem/flashmap/makefile
rename to filesystem/packages/flashmap/makefile
diff --git a/packages/filesystem/flashmap/src/debian/changelog b/filesystem/packages/flashmap/src/debian/changelog
similarity index 100%
rename from packages/filesystem/flashmap/src/debian/changelog
rename to filesystem/packages/flashmap/src/debian/changelog
diff --git a/packages/filesystem/flashmap/src/debian/compat b/filesystem/packages/flashmap/src/debian/compat
similarity index 100%
rename from packages/filesystem/flashmap/src/debian/compat
rename to filesystem/packages/flashmap/src/debian/compat
diff --git a/packages/filesystem/flashmap/src/debian/control b/filesystem/packages/flashmap/src/debian/control
similarity index 100%
rename from packages/filesystem/flashmap/src/debian/control
rename to filesystem/packages/flashmap/src/debian/control
diff --git a/packages/filesystem/flashmap/src/debian/copyright b/filesystem/packages/flashmap/src/debian/copyright
similarity index 100%
rename from packages/filesystem/flashmap/src/debian/copyright
rename to filesystem/packages/flashmap/src/debian/copyright
diff --git a/packages/filesystem/flashmap/src/debian/rules b/filesystem/packages/flashmap/src/debian/rules
similarity index 100%
rename from packages/filesystem/flashmap/src/debian/rules
rename to filesystem/packages/flashmap/src/debian/rules
diff --git a/packages/filesystem/font-source-code-pro/.gitignore b/filesystem/packages/font-source-code-pro/.gitignore
similarity index 100%
rename from packages/filesystem/font-source-code-pro/.gitignore
rename to filesystem/packages/font-source-code-pro/.gitignore
diff --git a/packages/filesystem/font-source-code-pro/font-source-code-pro_1.010.orig.tar.gz b/filesystem/packages/font-source-code-pro/font-source-code-pro_1.010.orig.tar.gz
similarity index 100%
rename from packages/filesystem/font-source-code-pro/font-source-code-pro_1.010.orig.tar.gz
rename to filesystem/packages/font-source-code-pro/font-source-code-pro_1.010.orig.tar.gz
diff --git a/packages/filesystem/font-source-code-pro/makefile b/filesystem/packages/font-source-code-pro/makefile
similarity index 100%
rename from packages/filesystem/font-source-code-pro/makefile
rename to filesystem/packages/font-source-code-pro/makefile
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-Black.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-Black.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-Black.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-Black.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-BlackIt.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-BlackIt.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-BlackIt.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-BlackIt.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-Bold.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-Bold.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-Bold.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-Bold.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-BoldIt.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-BoldIt.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-BoldIt.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-BoldIt.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-ExtraLight.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-ExtraLight.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-ExtraLight.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-ExtraLight.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-ExtraLightIt.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-ExtraLightIt.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-ExtraLightIt.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-ExtraLightIt.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-It.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-It.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-It.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-It.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-Light.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-Light.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-Light.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-Light.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-LightIt.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-LightIt.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-LightIt.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-LightIt.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-Medium.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-Medium.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-Medium.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-Medium.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-MediumIt.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-MediumIt.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-MediumIt.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-MediumIt.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-Regular.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-Regular.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-Regular.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-Regular.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-Semibold.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-Semibold.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-Semibold.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-Semibold.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/SourceCodePro-SemiboldIt.ttf b/filesystem/packages/font-source-code-pro/src/SourceCodePro-SemiboldIt.ttf
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/SourceCodePro-SemiboldIt.ttf
rename to filesystem/packages/font-source-code-pro/src/SourceCodePro-SemiboldIt.ttf
diff --git a/packages/filesystem/font-source-code-pro/src/debian/changelog b/filesystem/packages/font-source-code-pro/src/debian/changelog
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/debian/changelog
rename to filesystem/packages/font-source-code-pro/src/debian/changelog
diff --git a/packages/filesystem/font-source-code-pro/src/debian/compat b/filesystem/packages/font-source-code-pro/src/debian/compat
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/debian/compat
rename to filesystem/packages/font-source-code-pro/src/debian/compat
diff --git a/packages/filesystem/font-source-code-pro/src/debian/control b/filesystem/packages/font-source-code-pro/src/debian/control
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/debian/control
rename to filesystem/packages/font-source-code-pro/src/debian/control
diff --git a/packages/filesystem/font-source-code-pro/src/debian/rules b/filesystem/packages/font-source-code-pro/src/debian/rules
similarity index 100%
rename from packages/filesystem/font-source-code-pro/src/debian/rules
rename to filesystem/packages/font-source-code-pro/src/debian/rules
diff --git a/packages/filesystem/makefile b/filesystem/packages/makefile
similarity index 100%
rename from packages/filesystem/makefile
rename to filesystem/packages/makefile
diff --git a/packages/filesystem/mosys/.gitignore b/filesystem/packages/mosys/.gitignore
similarity index 100%
rename from packages/filesystem/mosys/.gitignore
rename to filesystem/packages/mosys/.gitignore
diff --git a/packages/filesystem/mosys/makefile b/filesystem/packages/mosys/makefile
similarity index 100%
rename from packages/filesystem/mosys/makefile
rename to filesystem/packages/mosys/makefile
diff --git a/packages/filesystem/mosys/mosys_69.10895.orig.tar.gz b/filesystem/packages/mosys/mosys_69.10895.orig.tar.gz
similarity index 100%
rename from packages/filesystem/mosys/mosys_69.10895.orig.tar.gz
rename to filesystem/packages/mosys/mosys_69.10895.orig.tar.gz
diff --git a/packages/filesystem/mosys/src/debian/changelog b/filesystem/packages/mosys/src/debian/changelog
similarity index 100%
rename from packages/filesystem/mosys/src/debian/changelog
rename to filesystem/packages/mosys/src/debian/changelog
diff --git a/packages/filesystem/mosys/src/debian/compat b/filesystem/packages/mosys/src/debian/compat
similarity index 100%
rename from packages/filesystem/mosys/src/debian/compat
rename to filesystem/packages/mosys/src/debian/compat
diff --git a/packages/filesystem/mosys/src/debian/control b/filesystem/packages/mosys/src/debian/control
similarity index 100%
rename from packages/filesystem/mosys/src/debian/control
rename to filesystem/packages/mosys/src/debian/control
diff --git a/packages/filesystem/mosys/src/debian/copyright b/filesystem/packages/mosys/src/debian/copyright
similarity index 100%
rename from packages/filesystem/mosys/src/debian/copyright
rename to filesystem/packages/mosys/src/debian/copyright
diff --git a/packages/filesystem/mosys/src/debian/rules b/filesystem/packages/mosys/src/debian/rules
similarity index 100%
rename from packages/filesystem/mosys/src/debian/rules
rename to filesystem/packages/mosys/src/debian/rules
diff --git a/packages/filesystem/xsecurelock/.gitignore b/filesystem/packages/xsecurelock/.gitignore
similarity index 100%
rename from packages/filesystem/xsecurelock/.gitignore
rename to filesystem/packages/xsecurelock/.gitignore
diff --git a/packages/filesystem/xsecurelock/makefile b/filesystem/packages/xsecurelock/makefile
similarity index 100%
rename from packages/filesystem/xsecurelock/makefile
rename to filesystem/packages/xsecurelock/makefile
diff --git a/packages/filesystem/xsecurelock/src/debian/changelog b/filesystem/packages/xsecurelock/src/debian/changelog
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/changelog
rename to filesystem/packages/xsecurelock/src/debian/changelog
diff --git a/packages/filesystem/xsecurelock/src/debian/compat b/filesystem/packages/xsecurelock/src/debian/compat
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/compat
rename to filesystem/packages/xsecurelock/src/debian/compat
diff --git a/packages/filesystem/xsecurelock/src/debian/control b/filesystem/packages/xsecurelock/src/debian/control
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/control
rename to filesystem/packages/xsecurelock/src/debian/control
diff --git a/packages/filesystem/xsecurelock/src/debian/copyright b/filesystem/packages/xsecurelock/src/debian/copyright
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/copyright
rename to filesystem/packages/xsecurelock/src/debian/copyright
diff --git a/packages/filesystem/xsecurelock/src/debian/docs b/filesystem/packages/xsecurelock/src/debian/docs
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/docs
rename to filesystem/packages/xsecurelock/src/debian/docs
diff --git a/packages/filesystem/xsecurelock/src/debian/rules b/filesystem/packages/xsecurelock/src/debian/rules
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/rules
rename to filesystem/packages/xsecurelock/src/debian/rules
diff --git a/packages/filesystem/xsecurelock/src/debian/source/format b/filesystem/packages/xsecurelock/src/debian/source/format
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/source/format
rename to filesystem/packages/xsecurelock/src/debian/source/format
diff --git a/packages/filesystem/xsecurelock/src/debian/watch b/filesystem/packages/xsecurelock/src/debian/watch
similarity index 100%
rename from packages/filesystem/xsecurelock/src/debian/watch
rename to filesystem/packages/xsecurelock/src/debian/watch
diff --git a/packages/filesystem/xsecurelock/xsecurelock_1.5.1.orig.tar.gz b/filesystem/packages/xsecurelock/xsecurelock_1.5.1.orig.tar.gz
similarity index 100%
rename from packages/filesystem/xsecurelock/xsecurelock_1.5.1.orig.tar.gz
rename to filesystem/packages/xsecurelock/xsecurelock_1.5.1.orig.tar.gz
diff --git a/initramfs/makefile b/initramfs/makefile
new file mode 100644
index 0000000..aa8f365
--- /dev/null
+++ b/initramfs/makefile
@@ -0,0 +1,20 @@
+ifndef INITRAMFS_MK
+INITRAMFS_MK := 1
+ifndef PRAWNOS_ROOT
+PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
+endif
+include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
+
+INITRAMFS_RESOURCES := $(PRAWNOS_PACKAGE_INITRAMFS)/resources
+
+.PHONY: initramfs initramfs_clean
+
+initramfs: $(PRAWNOS_INITRAMFS)
+
+initramfs_clean:
+ rm -f $(PRAWNOS_INITRAMFS)
+
+$(PRAWNOS_INITRAMFS):
+ $(PRAWNOS_INITRAMFS_SCRIPTS_BUILD) $(PRAWNOS_IMAGE_BASE) $(INITRAMFS_RESOURCES) $(PRAWNOS_BUILD)
+
+endif
diff --git a/resources/BuildResources/initramfs-init b/initramfs/resources/initramfs-init
similarity index 100%
rename from resources/BuildResources/initramfs-init
rename to initramfs/resources/initramfs-init
diff --git a/kernel/makefile b/kernel/makefile
new file mode 100644
index 0000000..2bbe37c
--- /dev/null
+++ b/kernel/makefile
@@ -0,0 +1,90 @@
+ifndef KERNEL_MK
+KERNEL_MK := 1
+ifndef PRAWNOS_ROOT
+PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
+endif
+include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
+
+KERNEL_PATCHED := $(PRAWNOS_KERNEL_BUILD)/.kernel_patched
+KERNEL_EXTRACTED := $(PRAWNOS_KERNEL_BUILD)/.kernel_extracted
+ATH9K_EXTRACTED := $(PRAWNOS_ATH9K_BUILD)/.ath9k_extracted
+
+KERNEL_RESOURCES := $(PRAWNOS_KERNEL)/resources
+KERNEL_SOURCES := $(PRAWNOS_KERNEL)/sources
+KERNEL_PATCHES := $(PRAWNOS_KERNEL)/patches
+
+KERNEL_TAR := $(KERNEL_SOURCES)/linux-libre-$(KVER)-gnu.tar.lz
+KERNEL_TAR_SIGNATURE := $(KERNEL_TAR).sign
+
+KERNEL_BUILT := $(PRAWNOS_KERNEL_BUILD)/vmlinux.kpart
+
+ATH9K_TAR := $(KERNEL_SOURCES)/open-ath9k-htc-firmware.tar.gz
+ATH9K := open-ath9k-htc-firmware
+
+### PHONY TARGETS
+.PHONY: kernel
+kernel: $(KERNEL_BUILT)
+
+.PHONY: ath9k
+ath9k: extract_ath9k
+ $(PRAWNOS_KERNEL_SCRIPTS_BUILD_ATH9K) $(PRAWNOS_ATH9K_BUILD)
+
+.PHONY: patch_kernel
+patch_kernel: $(KERNEL_PATCHED)
+
+.PHONY: extract_kernel
+extract_kernel: $(KERNEL_EXTRACTED)
+
+.PHONY: extract_ath9k
+extract_ath9k: $(ATH9K_EXTRACTED)
+
+.PHONY: package_kernel
+packages: kernel
+ @echo TODO
+
+### CLEAN TARGETS
+
+.PHONY: clean_kernel
+clean_kernel:
+ rm -rf $(PRAWNOS_KERNEL_BUILD)
+
+.PHONY: clean_ath9k
+clean_ath9k:
+ rm -rf $(PRAWNOS_ATH9K_BUILD)
+
+### DEVELOPER TARGETS
+
+.PHONY: update_ath9k_tar
+update_ath9k_tar:
+ mkdir -p tmp/$(ATH9K)
+ git clone --depth 1 https://github.com/qca/open-ath9k-htc-firmware.git tmp/$(ATH9K)
+ cd tmp && tar czvf $(ATH9K_SOURCE) $(ATH9K)
+ rm -rf tmp/
+
+.PHONY: update_kernel_tar
+update_kernel_tar:
+ wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$(KVER)-gnu/linux-libre-$(KVER)-gnu.tar.lz -O $(KERNEL_TAR)
+ wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$(KVER)-gnu.tar.lz.sign -O $(KERNEL_TAR_SIGNATURE)
+
+### REAL TARGETS
+
+$(KERNEL_EXTRACTED): $(PRAWNOS_BUILD)
+ gpg --import $(KERNEL_RESOURCES)/linux-libre-signing-key.gpg
+ gpg --verify $(KERNEL_TAR_SIGNATURE) $(KERNEL_TAR)
+ tar --lzip -xvf $(KERNEL_TAR) -C $(PRAWNOS_BUILD)
+ touch $(KERNEL_EXTRACTED)
+
+$(ATH9K_EXTRACTED): $(PRAWNOS_BUILD)
+ tar -xvf $(ATH9K_TAR) -C $(PRAWNOS_BUILD)
+ touch $(ATH9K_EXTRACTED)
+
+$(KERNEL_PATCHED): $(KERNEL_EXTRACTED)
+ @echo $(PRAWNOS_KERNEL_BUILD)
+ $(PRAWNOS_KERNEL_SCRIPTS_PATCH) $(KVER) $(KERNEL_PATCHES) $(PRAWNOS_KERNEL_BUILD)
+ touch $(KERNEL_PATCHED)
+
+$(KERNEL_BUILT): $(KERNEL_EXTRACTED) $(KERNEL_PATCHED) ath9k
+ make -C $(PRAWNOS_INITRAMFS)
+ $(PRAWNOS_KERNEL_SCRIPTS_BUILD) $(KVER) $(KERNEL_RESOURCES) $(PRAWNOS_KERNEL_BUILD) $(PRAWNOS_INITRAMFS_IMAGE)
+
+endif
diff --git a/resources/BuildResources/patches-tested/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch b/kernel/patches/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch
rename to kernel/patches/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch
diff --git a/resources/BuildResources/patches-tested/kernel/0001-Fix-ath9k-dwc2-init-frame-overruns.patch b/kernel/patches/kernel/0001-Fix-ath9k-dwc2-init-frame-overruns.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/0001-Fix-ath9k-dwc2-init-frame-overruns.patch
rename to kernel/patches/kernel/0001-Fix-ath9k-dwc2-init-frame-overruns.patch
diff --git a/resources/BuildResources/patches-tested/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch b/kernel/patches/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch
rename to kernel/patches/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch
diff --git a/resources/BuildResources/patches-tested/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch b/kernel/patches/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch
rename to kernel/patches/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch
diff --git a/resources/BuildResources/patches-tested/kernel/0100-arm-errata-workaround-errata-A12-857271-and-A17-857272.patch b/kernel/patches/kernel/0100-arm-errata-workaround-errata-A12-857271-and-A17-857272.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/0100-arm-errata-workaround-errata-A12-857271-and-A17-857272.patch
rename to kernel/patches/kernel/0100-arm-errata-workaround-errata-A12-857271-and-A17-857272.patch
diff --git a/resources/BuildResources/patches-tested/kernel/5.x-dwc2/0008-usb-dwc2-Add-dwc2_gadget_dec_frame_num_by_one-functi.patch b/kernel/patches/kernel/5.x-dwc2/0008-usb-dwc2-Add-dwc2_gadget_dec_frame_num_by_one-functi.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/5.x-dwc2/0008-usb-dwc2-Add-dwc2_gadget_dec_frame_num_by_one-functi.patch
rename to kernel/patches/kernel/5.x-dwc2/0008-usb-dwc2-Add-dwc2_gadget_dec_frame_num_by_one-functi.patch
diff --git a/resources/BuildResources/patches-tested/kernel/5.x-dwc2/0014-usb-dwc2-gadget-Add-handler-for-WkupAlert-interrupt.patch b/kernel/patches/kernel/5.x-dwc2/0014-usb-dwc2-gadget-Add-handler-for-WkupAlert-interrupt.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/5.x-dwc2/0014-usb-dwc2-gadget-Add-handler-for-WkupAlert-interrupt.patch
rename to kernel/patches/kernel/5.x-dwc2/0014-usb-dwc2-gadget-Add-handler-for-WkupAlert-interrupt.patch
diff --git a/resources/BuildResources/patches-tested/kernel/Added-a-second-reset-when-having-an-issue-reading-th.patch b/kernel/patches/kernel/Added-a-second-reset-when-having-an-issue-reading-th.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/Added-a-second-reset-when-having-an-issue-reading-th.patch
rename to kernel/patches/kernel/Added-a-second-reset-when-having-an-issue-reading-th.patch
diff --git a/resources/BuildResources/patches-tested/kernel/Don-t-try-to-flush-cache-on-reset.patch b/kernel/patches/kernel/Don-t-try-to-flush-cache-on-reset.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/Don-t-try-to-flush-cache-on-reset.patch
rename to kernel/patches/kernel/Don-t-try-to-flush-cache-on-reset.patch
diff --git a/resources/BuildResources/patches-tested/kernel/silence_vop_spam.patch b/kernel/patches/kernel/silence_vop_spam.patch
similarity index 100%
rename from resources/BuildResources/patches-tested/kernel/silence_vop_spam.patch
rename to kernel/patches/kernel/silence_vop_spam.patch
diff --git a/resources/BuildResources/cmdline b/kernel/resources/cmdline
similarity index 100%
rename from resources/BuildResources/cmdline
rename to kernel/resources/cmdline
diff --git a/resources/BuildResources/config b/kernel/resources/config
similarity index 100%
rename from resources/BuildResources/config
rename to kernel/resources/config
diff --git a/resources/BuildResources/kernel.its b/kernel/resources/kernel.its
similarity index 100%
rename from resources/BuildResources/kernel.its
rename to kernel/resources/kernel.its
diff --git a/kernel/sources/open-ath9k-htc-firmware.tar.gz b/kernel/sources/open-ath9k-htc-firmware.tar.gz
new file mode 100644
index 0000000..c1f5df2
Binary files /dev/null and b/kernel/sources/open-ath9k-htc-firmware.tar.gz differ
diff --git a/makefile b/makefile
index 711d164..840cc27 100644
--- a/makefile
+++ b/makefile
@@ -13,23 +13,15 @@
# You should have received a copy of the GNU General Public License
# along with PrawnOS. If not, see .
-KVER=5.4.29
-ifeq ($(DEBIAN_SUITE),)
-DEBIAN_SUITE=buster
-endif
-ifeq ($(PRAWNOS_SUITE),)
-PRAWNOS_SUITE=Shiba
-endif
-OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-c201.img
-BASE=$(OUTNAME)-BASE
-
+.DEFAULT_GOAL := image
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
-
+include $(PRAWNOS_ROOT)/initramfs/makefile
+include $(PRAWNOS_ROOT)/kernel/makefile
#Usage:
#run make image
-#this will generate two images named OUTNAME and OUTNAME-BASE
+#this will generate two images named PRAWNOS_IMAGE and PRAWNOS_IMAGE-BASE
#-BASE is only the filesystem with no kernel.
@@ -41,79 +33,34 @@ include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
.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"
- @echo " clean_img - which deletes the built PrawnOS image, this is ran when make image is ran"
- @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"
- @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"
+#TODO
-.PHONY: clean_kernel
-clean_kernel:
- rm -rf build/linux-$(KVER)
-
-.PHONY: clean_ath
-clean_ath:
- rm -rf build/open-ath9k-htc-firmware
-
-.PHONY: clean_img
+.PHONY: clean_image
clean_img:
- rm -f $(OUTNAME)
+ rm -f $(PRAWNOS_IMAGE)
.PHONY: clean_basefs
clean_basefs:
- rm -r $(BASE)
-
-.PHONY: clean_initramfs
-clean_initramfs:
- rm -r build/PrawnOS-initramfs.cpio.gz
-
-.PHONY: clean_packages
-clean_packages:
- cd packages && $(MAKE) clean
+ rm -f $(PRAWNOS_IMAGE_BASE)
.PHONY: clean_pbuilder
clean_pbuilder:
rm -r build/prawnos-pbuilder-armhf-base.tgz
.PHONY: clean_all
-clean_all:
- $(MAKE) clean_kernel
- $(MAKE) clean_ath
- $(MAKE) clean_img
- $(MAKE) clean_basefs
- $(MAKE) clean_initramfs
- $(MAKE) clean_pbuilder
- $(MAKE) clean_packages
+clean_all: clean_kernel clean_initramfs clean_ath9k clean_image clean_basefs clean_pbuilder
#:::::::::::::::::::::::::::::: premake prep ::::::::::::::::::::::::::::::
.PHONY: build_dirs
-build_dirs:
- mkdir -p build/logs/
- mkdir -p build/apt-cache/
+build_dirs: $(PRAWNOS_BUILD)
+
#:::::::::::::::::::::::::::::: kernel ::::::::::::::::::::::::::::::::::::
-.PHONY: kernel
-kernel:
- $(MAKE) build_dirs
- rm -rf build/logs/kernel-log.txt
- $(PRAWNOS_KERNEL_SCRIPTS_BUILD) $(KVER) 2>&1 | tee build/logs/kernel-log.txt
+#included from kernel/makefile
-.PHONY: kernel_config
-kernel_config:
- $(PRAWNOS_KERNEL_SCRIPTS_MENUCONFIG) $(KVER)
-
-.PHONY: patch_kernel
-patch_kernel:
- $(PRAWNOS_KERNEL_SCRIPTS_PATCH)
#:::::::::::::::::::::::::::::: initramfs :::::::::::::::::::::::::::::::::
-.PHONY: initramfs
-initramfs:
- $(MAKE) build_dirs
- rm -rf build/logs/initramfs-log.txt
- $(PRAWNOS_INITRAMFS_SCRIPTS_BUILD) $(BASE) 2>&1 | tee build/logs/initramfs-log.txt
+#included from initramfs/makefile
#:::::::::::::::::::::::::::::: filesystem ::::::::::::::::::::::::::::::::
#makes the base filesystem image without kernel. Only make a new one if the base image isnt present
@@ -122,33 +69,33 @@ filesystem:
$(MAKE) build_dirs
rm -rf build/logs/fs-log.txt
$(MAKE) pbuilder_create
- $(MAKE) packages
- [ -f $(BASE) ] || $(PRAWNOS_FILESYSTEM_SCRIPTS_BUILD) $(KVER) $(DEBIAN_SUITE) $(BASE) $(PRAWNOS_ROOT) $(PRAWNOS_SHARED_SCRIPTS) 2>&1 | tee build/logs/fs-log.txt
+ $(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
#:::::::::::::::::::::::::::::: packages ::::::::::::::::::::::::::::::::
-.PHONY: packages
-packages:
- cd packages && $(MAKE)
+.PHONY: filesystem_packages
+filesystem_packages:
+ $(MAKE) filesystem_packages -C packages
-.PHONY: packages_install
-packages_install:
+.PHONY: filesystem_packages_install
+filesystem_packages_install:
ifndef INSTALL_TARGET
$(error INSTALL_TARGET is not set)
endif
- cd packages && $(MAKE) install INSTALL_TARGET=$(INSTALL_TARGET)
+ $(MAKE) filesystem_packages_install INSTALL_TARGET=$(INSTALL_TARGET) -C filesystem
#:::::::::::::::::::::::::::::: image management ::::::::::::::::::::::::::
.PHONY: kernel_install
kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
- $(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(OUTNAME)
+ $(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(PRAWNOS_IMAGE)
.PHONY: kernel_update
kernel_update:
$(MAKE) clean_img
$(MAKE) initramfs
$(MAKE) kernel
- cp $(BASE) $(OUTNAME)
+ cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE)
$(MAKE) kernel_install
.PHONY: image
@@ -157,7 +104,7 @@ image:
$(MAKE) filesystem
$(MAKE) initramfs
$(MAKE) kernel
- cp $(BASE) $(OUTNAME)
+ cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE)
$(MAKE) kernel_install
#:::::::::::::::::::::::::::::: pbuilder management :::::::::::::::::::::::
diff --git a/packages/initramfs/makefile b/packages/initramfs/makefile
deleted file mode 100644
index f8817f6..0000000
--- a/packages/initramfs/makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
-include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
-
-all:
- @echo TODO
-
-
-clean:
- @echo TODO
-
-
-install:
- @echo TODO
diff --git a/packages/kernel/makefile b/packages/kernel/makefile
deleted file mode 100644
index d9937ce..0000000
--- a/packages/kernel/makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
-include $(PRAWNOS_ROOT)/scripts/common.mk
-
-all:
- @echo TODO
-
-
-clean:
- @echo TODO
-
-
-install:
- @echo TODO
diff --git a/packages/makefile b/packages/makefile
deleted file mode 100644
index 8313b3d..0000000
--- a/packages/makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
-include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
-
-SUBDIRS = $(shell ls -d */)
-
-all:
- for dir in $(SUBDIRS) ; do \
- make -C $$dir ; \
- done
-
-
-clean:
- for dir in $(SUBDIRS) ; do \
- make clean -C $$dir ; \
- done
-
-
-install:
- $(info packages install target is $(INSTALL_TARGET))
- for dir in $(SUBDIRS) ; do \
- make install INSTALL_TARGET=$(INSTALL_TARGET) -C $$dir ; \
- done
diff --git a/packages/packaging-readme.md b/packages/packaging-readme.md
deleted file mode 100644
index bf60179..0000000
--- a/packages/packaging-readme.md
+++ /dev/null
@@ -1,56 +0,0 @@
-## PrawnOS Packaging
-
-All programs, themes, etc that are not part of upstream debian are built as packages
-this allows PrawnOS the following benefits:
-- the PrawnOS apt repo is not a build dependency
-- test builds don't require any special steps-- just make the change locally and rebuild the filesystem
-- a user doesn't have to trust the PrawnOS apt repo to build their own image
-- the PrawnOS apt repo requires less bandwidth, as only package updates will be gotten from it
-
-Note that some packages that are available upstream, but only in unstable or testing repos or have
-fixes only in the unstable or testing repos are packaged as part of PrawnOS
-
-### Updating Packages
-By using packages for all parts of PrawnOS, updates are more straightforward.
-When an existing PrawnOS install has out of date packages, the user can then either
-build the new version themselves or get the update from the repo using the standard "apt upgrade"
-
-### Package folder structure
-Packages are stored under component of the final PrawnOS image they belong to
-Inside the package folder there are the following items:
-- `makefile`
-- source folder called `src`
-- a `.orig.tar.gz*` containing the package source.
-- a `.gitignore` to avoid commiting build artifacts, or unnecessary source files
-
-The contents of the `src` are the following:
-- a `debian` folder
-- the source files if the package is not packages upstream (by debian)
-- the patched source files if there are any PrawnOS specific patches. This is to keep the changes tracked by git.
-
-If the source is from an upstream package, and no PrawnOS specific patches are carried then only the `debian` folder is in the `src` folder
-
-### Building packages
-Most packages are built in a host architecture agnostic fashion using pbuilder.
-The only notable exceptions to this are font packages, which are not architecture dependent and
-the kernel package, which handles cross compilation manually without a chroot.
-
-To build any package, navigate to that packages folder and run
-```
-make clean
-make
-```
-the resulting .deb will be in that same folder when the build is complete
-
-All packages can be built by running
-```
-make
-```
-from the packages directory
-
-### Uploading packages
-New packages, and package updates can upload to `deb.prawnos.com` by maintainers
-first by building and then running
-```
-make upload
-```
diff --git a/resources/BuildResources/linux-libre-signing-key.gpg b/resources/BuildResources/linux-libre-signing-key.gpg
deleted file mode 100644
index 83faab1..0000000
--- a/resources/BuildResources/linux-libre-signing-key.gpg
+++ /dev/null
@@ -1,142 +0,0 @@
------BEGIN PGP PUBLIC KEY BLOCK-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WKQt6jqtJ5J9RcL8XUXzb5a2gIb7QbHcL5vAro3GqtgGdjHAi4JaRday7
-Q+gRQxj0nGBp7HL9/Hnf+OP8X6ILa8TzMp4nSSGzW+KiHG6l5DY4mAnQaElZaySt
-laDVNkDQdMzMoug7059rq31dQQ1jTpc6dQXeoxWNnRhGd3PcFmpsOM0bXulGU7g3
-VUIKOGDVjLu/MdSpvlmPEdnjt7YY6SorHiSpcWt4A7/oOCpMiYyPZtaAzkva8yZt
-m7J8Vja/NYZZXK8tZjIxVOGRvBdD0HcuBXOhr5aKXYVWYx7tdSzs6lnZV1ssgiY8
-l5NgA0LRHhFXO7NUPDOBzHMf39VtjMp2zysvS+0hzQ5pBBFwRxReYoxFEyNtyGND
-RfqXpWkREQEREBERAREQEREBERAREQFyqwXUc7WgkmNwAHHRdUQfNQe3U7C2Onks
-TfWMrxNVVrXZZS+MnUAtyr6hQccOXEIiRcBgPiVz1nbu63xZtkzafHYX7Vmq65lO
-C1tnScuXasjqypq37KnYRf8ALqe/gtlDgwaRJVWc69wwG4+vP971lj4/tXc/0zUF
-DJXy+0VBOyv/AIuodS+gaA1oa0AACwA4Ii2ZiIiAuNXTNq6d0Tja+oNr2K7Ig+co
-53Uc7qecFovrf5T9lWXnEsO9sAexwbK0W13EKVBWS0bzBOwkNNrcQss8N8xeOWuK
-711dJBUBkeWwFzcb1+x4rER7xjmnq1C40QNbizZCDlac+nADd42ViTDaOR13QNBt
-bo3b5Ls8c1ye12kUL2yY217PhcXEf4SvoVkpsNp6WZ0sYJcd2Y3y9i1rSIEREBER
-AREQEREBERAREQEREBERAREQFzlginAEsbX2Nxcbl0RB5jjjibljY1gvezRZekRA
-REQEREBERAXOenhqW5Zow8cL7x9V0RByp6WGlaRDGGhxudb3XVEQEREBERAREQER
-EBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBER
-AREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQf/2YhgBBMR
-AgAgBQJMCX7tAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvLfPh359R6dA
-rgCgm6oaTjZw81cHYJCDbRqmgvPnVwUAmgORBOiTA8uJEZjLnW4nCuwr5hPiiEYE
-EBECAAYFAkwJf6IACgkQUjSEXfK5IPUN9ACeIxFILNIr1mgEVvssa9hPiS4rytMA
-oMCEApLI1XtbOqg/CkaB1lj/Fqq0iF4EEBEIAAYFAkwJhYAACgkQIr13u1gr1/DP
-NwD/fBDFJ9RDH/0OnfX7TQtMajowS07v8ZhMZGS8RiG0wxUBAMpk4sBenTzlKVG3
-7+1hts8o+2910W8DnrfsUKZTMKP6
-=JkKR
------END PGP PUBLIC KEY BLOCK-----
diff --git a/scripts/BuildScripts/BuildCommon.mk b/scripts/BuildScripts/BuildCommon.mk
index c22c910..4ccbaf7 100644
--- a/scripts/BuildScripts/BuildCommon.mk
+++ b/scripts/BuildScripts/BuildCommon.mk
@@ -3,10 +3,38 @@ BUILD_COMMON_MK := 1
#Place all shared make vars below
#=========================================================================================
+### MISC GLOBALS
+KVER=5.4.29
+# Otherwise errors are ignored when output is piped to tee:
+SHELL := /bin/bash -o pipefail
+
+### PRAWNOS CORE DIRECTORIES
PRAWNOS_BUILD := $(PRAWNOS_ROOT)/build
PRAWNOS_SCRIPTS := $(PRAWNOS_ROOT)/scripts
+PRAWNOS_KERNEL := $(PRAWNOS_ROOT)/kernel
+
+PRAWNOS_INITRAMFS := $(PRAWNOS_ROOT)/initramfs
+
+PRAWNOS_FILESYSTEM := $(PRAWNOS_ROOT)/filesystem
+
+### BUILD DIRS
+
+PRAWNOS_BUILD_LOGS := $(PRAWNOS_BUILD)/logs
+PRAWNOS_BUILD_APT_CACHE := $(PRAWNOS_BUILD)/apt-cache
+
+### PRAWNOS IMAGES
+ifeq ($(DEBIAN_SUITE),)
+DEBIAN_SUITE := buster
+endif
+ifeq ($(PRAWNOS_SUITE),)
+PRAWNOS_SUITE := Shiba
+endif
+
+PRAWNOS_IMAGE := PrawnOS-$(PRAWNOS_SUITE)-c201.img
+PRAWNOS_IMAGE_BASE := $(OUTNAME)-BASE
+
### BUILD SCRIPTS
PRAWNOS_BUILD_SCRIPTS := $(PRAWNOS_SCRIPTS)/BuildScripts
@@ -17,6 +45,7 @@ PRAWNOS_KERNEL_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/KernelScripts
PRAWNOS_KERNEL_SCRIPTS_BUILD := $(PRAWNOS_KERNEL_SCRIPTS)/buildKernel.sh
PRAWNOS_KERNEL_SCRIPTS_MENUCONFIG := $(PRAWNOS_KERNEL_SCRIPTS)/crossMenuConfig.sh
PRAWNOS_KERNEL_SCRIPTS_PATCH := $(PRAWNOS_KERNEL_SCRIPTS)/patchKernel.sh
+PRAWNOS_KERNEL_SCRIPTS_BUILD_ATH9K := $(PRAWNOS_KERNEL_SCRIPTS)/buildAth9k.sh
PRAWNOS_IMAGE_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/ImageScripts
PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL := $(PRAWNOS_IMAGE_SCRIPTS)/installKernelToFs.sh
@@ -29,11 +58,9 @@ PRAWNOS_PACKAGE_SCRIPTS_INSTALL := $(PRAWNOS_PACKAGE_SCRIPTS)/installPackage.sh
PRAWNOS_PACKAGE_SCRIPTS_PBUILD := $(PRAWNOS_PACKAGE_SCRIPTS)/pbuildPackage.sh
PRAWNOS_PACKAGE_SCRIPTS_UPLOAD := $(PRAWNOS_PACKAGE_SCRIPTS)/uploadPackage.sh
-
### INSTALL SCRIPTS
PRAWNOS_INSTALL_SCRIPTS := $(PRAWNOS_SCRIPTS)/InstallScripts
-
### SHARED SCRIPTS
PRAWNOS_SHARED_SCRIPTS := $(PRAWNOS_SCRIPTS)/Shared
@@ -47,16 +74,34 @@ PBUILDER_HOOKS := $(PBUILDER_DIR)/hooks
PBUILDER_VARS := $(PBUILDER_CHROOT) $(PBUILDER_RC) $(PBUILDER_HOOKS)
-
### LOCAL APT RESOURCES
PRAWNOS_LOCAL_APT_REPO := $(PRAWNOS_BUILD)/prawnos-local-apt-repo
PRAWNOS_LOCAL_APT_SOURCE := "deb [trusted=yes] file://$(PRAWNOS_LOCAL_APT_REPO) ./"
PRAWNOS_LOCAL_APT_VARS := $(PRAWNOS_LOCAL_APT_REPO) $(PRAWNOS_LOCAL_APT_SOURCE)
-### MISC GLOBALS
-# Otherwise errors are ignored when output is piped to tee:
-SHELL := /bin/bash -o pipefail
+### KERNEL
+PRAWNOS_KERNEL_BUILD := $(PRAWNOS_BUILD)/linux-$(KVER)
+
+### INITRAMFS
+PRAWNOS_INITRAMFS_IMAGE := $(PRAWNOS_BUILD)/PrawnOS-initramfs.cpio.gz
+
+### ATH9K
+PRAWNOS_ATH9K_BUILD := $(PRAWNOS_BUILD)/open-ath9k-htc-firmware
#=========================================================================================
+
+
+#Place all shared make rules below
+#=========================================================================================
+$(PRAWNOS_BUILD): $(PRAWNOS_BUILD_LOGS) $(PRAWNOS_BUILD_APT_CACHE)
+
+$(PRAWNOS_BUILD_LOGS):
+ mkdir -p $(PRAWNOS_BUILD_LOGS)
+
+$(PRAWNOS_BUILD_APT_CACHE):
+ mkdir -p $(PRAWNOS_BUILD_APT_CACHE)
+
+#=========================================================================================
+
endif # BUILD_COMMON_MK
diff --git a/scripts/BuildScripts/InitramfsScripts/buildInitramFs.sh b/scripts/BuildScripts/InitramfsScripts/buildInitramFs.sh
index 474428e..fdd5195 100755
--- a/scripts/BuildScripts/InitramfsScripts/buildInitramFs.sh
+++ b/scripts/BuildScripts/InitramfsScripts/buildInitramFs.sh
@@ -22,18 +22,29 @@ set -e
# along with PrawnOS. If not, see .
-outmnt=$(mktemp -d -p "$(pwd)")
-outdev=/dev/loop7
if [ -z "$1" ]
then
- echo "No base file system image filename supplied"
+ echo "No base file system image supplied"
+ exit 1
+fi
+if [ -z "$2" ]
+then
+ echo "No initramfs resources dir supplied"
+ exit 1
+fi
+if [ -z "$3" ]
+then
+ echo "No output location supplied"
exit 1
fi
BASE=$1
-ROOT_DIR="$(pwd)"
-build_resources=$ROOT_DIR/resources/BuildResources
+RESOURCES=$2
+OUT_DIR=$3
-if [ ! -f $ROOT_DIR/$BASE ]
+outmnt=$(mktemp -d -p "$(pwd)")
+outdev=/dev/loop7
+
+if [ ! -f $BASE ]
then
echo "No base filesystem, run 'make filesystem' first"
exit 1
@@ -59,7 +70,7 @@ trap cleanup INT TERM EXIT
[ ! -d build ] && mkdir build
-losetup -P $outdev $ROOT_DIR/$BASE
+losetup -P $outdev $$BASE
#mount the root filesystem
mount -o noatime ${outdev}p2 $outmnt
@@ -113,7 +124,7 @@ cp $outmnt/lib/arm-linux-gnueabihf/libpthread.so.0 $initramfs_src/lib/arm-linux-
cp $outmnt/lib/arm-linux-gnueabihf/libpcre.so.3 $initramfs_src/lib/arm-linux-gnueabihf/libpcre.so.3
cp $outmnt/lib/arm-linux-gnueabihf/libgcc_s.so.1 $initramfs_src/lib/arm-linux-gnueabihf/libgcc_s.so.1
#add the init script
-cp $build_resources/initramfs-init $initramfs_src/init
+cp $RESOURCES/initramfs-init $initramfs_src/init
chmod +x $initramfs_src/init
cp $initramfs_src/init $initramfs_src/sbin/init
@@ -127,5 +138,5 @@ ln -s busybox bin/switch_root
ln -s busybox bin/umount
# store for kernel building
-find . -print0 | cpio --null --create --verbose --format=newc | gzip --best > $ROOT_DIR/build/PrawnOS-initramfs.cpio.gz
+find . -print0 | cpio --null --create --verbose --format=newc | gzip --best > $OUT_DIR/PrawnOS-initramfs.cpio.gz
diff --git a/scripts/BuildScripts/KernelScripts/buildAth9k.sh b/scripts/BuildScripts/KernelScripts/buildAth9k.sh
new file mode 100755
index 0000000..4a176a3
--- /dev/null
+++ b/scripts/BuildScripts/KernelScripts/buildAth9k.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -x
+set -e
+
+# build AR9271 firmware
+
+# This file is part of PrawnOS (https://www.prawnos.com)
+# Copyright (c) 2020 Hal Emmerich
+
+# 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 .
+
+
+if [ -z "$1" ]
+then
+ echo "No build directory supplied"
+ exit 1
+fi
+
+BUILD_DIR=$1
+
+cd $BUILD_DIR
+make toolchain
+make -C target_firmware
diff --git a/scripts/BuildScripts/KernelScripts/buildKernel.sh b/scripts/BuildScripts/KernelScripts/buildKernel.sh
index dcf205b..45f2e26 100755
--- a/scripts/BuildScripts/KernelScripts/buildKernel.sh
+++ b/scripts/BuildScripts/KernelScripts/buildKernel.sh
@@ -3,11 +3,11 @@
set -x
set -e
-#Build kernel, wifi firmware
+# build Linux-libre, with ath9k_htc firmware and initramfs built in
# This file is part of PrawnOS (https://www.prawnos.com)
-# Copyright (c) 2018 Hal Emmerich
+# Copyright (c) 2018-2020 Hal Emmerich
# PrawnOS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
@@ -26,48 +26,35 @@ then
echo "No kernel version supplied"
exit 1
fi
-
-KVER=$1
-ROOT_DIR="$(pwd)"
-RESOURCES=$ROOT_DIR/resources/BuildResources
-
-[ ! -d build ] && mkdir build
-cd build
-if [ ! -f PrawnOS-initramfs.cpio.gz ]
+if [ -z "$2" ]
then
- echo "No initramfs image, run 'make initramfs' first"
- cd $ROOT_DIR
+ echo "No resources directory"
+ exit 1
+fi
+if [ -z "$3" ]
+then
+ echo "No build directory supplied"
+ exit 1
+fi
+if [ -z "$4" ]
+then
+ echo "No PrawnOS initramfs supplied"
exit 1
fi
-# build AR9271 firmware
-[ ! -d open-ath9k-htc-firmware ] && git clone --depth 1 https://github.com/qca/open-ath9k-htc-firmware.git
-cd open-ath9k-htc-firmware
-make toolchain
-make -C target_firmware
-cd ..
-# build Linux-libre, with ath9k_htc
-[ ! -f linux-libre-$KVER-gnu.tar.lz ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz
-[ ! -f linux-libre-$KVER-gnu.tar.lz.sign ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz.sign
+KVER=$1
+RESOURCES=$2
+BUILD_DIR=$3
+INITRAMFS=$4
-#verify the signature
-gpg --import $RESOURCES/linux-libre-signing-key.gpg
-gpg --verify linux-libre-$KVER-gnu.tar.lz.sign linux-libre-$KVER-gnu.tar.lz
-
-[ ! -d linux-$KVER ] && tar --lzip -xvf linux-libre-$KVER-gnu.tar.lz && FRESH=true
-cd linux-$KVER
-make clean
+cd $BUILD_DIR
make mrproper
-#Apply the usb and mmc patches if unapplied
-[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/kernel/5.x-dwc2/*.patch; do echo $i; patch -p1 < $i; done
-[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/DTS/*.patch; do echo $i; patch -p1 < $i; done
-[ "$FRESH" = true ] && for i in "$RESOURCES"/patches-tested/kernel/*.patch; do echo $i; patch -p1 < $i; done
-#copy in the initramfs and kernel config
-cp $ROOT_DIR/build/PrawnOS-initramfs.cpio.gz .
+#copy in the resources, initramfs
+cp $INITRAMFS .
cp $RESOURCES/config .config
+cp $RESOURCES/kernel.its .
make -j $(($(nproc) +1)) CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs
-[ ! -h kernel.its ] && ln -s $RESOURCES/kernel.its .
mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
dd if=/dev/zero of=bootloader.bin bs=512 count=1
vbutil_kernel --pack vmlinux.kpart \
@@ -78,5 +65,8 @@ vbutil_kernel --pack vmlinux.kpart \
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--config $RESOURCES/cmdline \
--bootloader bootloader.bin
-cd ..
-cd $ROOT_DIR
+
+RESULT=$?
+if [ ! $RESULT -eq 0 ]; then
+ rm -f vmlinux.kpart
+fi
diff --git a/scripts/BuildScripts/KernelScripts/patchKernel.sh b/scripts/BuildScripts/KernelScripts/patchKernel.sh
index 1ce09ce..cad1441 100755
--- a/scripts/BuildScripts/KernelScripts/patchKernel.sh
+++ b/scripts/BuildScripts/KernelScripts/patchKernel.sh
@@ -8,20 +8,22 @@ then
echo "No kernel version supplied"
exit 1
fi
+if [ -z "$2" ]
+then
+ echo "No patches directory"
+ exit 1
+fi
+if [ -z "$3" ]
+then
+ echo "No build directory supplied"
+ exit 1
+fi
KVER=$1
+PATCHES=$2
+BUILD_DIR=$3
-ROOT_DIR="$(pwd)"
-RESOURCES=$ROOT_DIR/resources/BuildResources
-
-
-[ ! -d build ] && mkdir build
-cd build
-# build Linux-libre, with ath9k_htc
-cd linux-$KVER
-make clean
+cd $BUILD_DIR
make mrproper
-#Apply the usb and mmc patches if unapplied
-for i in "$RESOURCES"/patches-tested/DTS/*.patch; do patch -p1 < $i; done
-for i in "$RESOURCES"/patches-tested/kernel/*.patch; do patch -p1 < $i; done
-
-cd $ROOT_DIR
+#Apply the usb and mmc patches
+for i in "$PATCHES"/DTS/*.patch; do echo $i; patch -p1 < $i; done
+for i in "$PATCHES"/kernel/*.patch; do echo $i; patch -p1 < $i; done