diff --git a/.gitignore b/.gitignore index d4332c1..a8f1800 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,7 @@ /images /linux /output -/portage/config/*/etc/portage/make.profile -/portage/config/*/etc/portage/repos.conf -/portage/config/target/etc/portage/make.conf/10-crossdev.conf -/portage/repos/x-portage +/repos/x-portage /.built /.prepared /.host-tools diff --git a/Makefile b/Makefile index 9da05e3..4311687 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ O ?= . IMAGESDIR ?= $(O)/images +CONFIGDIR ?= . + +export CONFIGDIR update.tar: $(IMAGESDIR)/update.tar.zstd @@ -16,8 +19,8 @@ prepare: $(O)/.prepared $(O)/.host-tools: \ build-host-tools.sh \ - host-tools.packages \ - $(shell find portage/config/host -type f) \ + $(CONFIGDIR)/host-tools.packages \ + $(shell find $(CONFIGDIR)/portage/host -type f) \ $(O)/.prepared ./build-host-tools.sh touch $(O)/.host-tools @@ -26,9 +29,9 @@ host-tools: $(O)/.host-tools $(O)/.built: \ build.sh \ - build.packages \ - install.packages \ - $(shell find portage/config/target -type f) \ + $(CONFIGDIR)/build.packages \ + $(CONFIGDIR)/install.packages \ + $(shell find $(CONFIGDIR)/portage/target -type f) \ $(O)/.host-tools \ $(O)/.prepared ./build.sh @@ -36,11 +39,12 @@ $(O)/.built: \ $(O)/.ready: \ build-rootfs.sh \ - install.packages \ - installonly.packages \ - busybox.symlinks \ + $(CONFIGDIR)/install.packages \ + $(CONFIGDIR)/installonly.packages \ + $(CONFIGDIR)/busybox.symlinks \ $(O)/linux/arch/arm64/boot/Image.gz \ $(shell find overlay -type f) \ + $(shell find $(CONFIGDIR)/overlay -type f 2>/dev/null) \ $(O)/.host-tools \ $(O)/.built ./build-rootfs.sh @@ -48,7 +52,7 @@ $(O)/.ready: \ $(IMAGESDIR)/rootfs.squashfs: \ build-squashfs.sh \ - squashfs.exclude \ + $(CONFIGDIR)/squashfs.exclude \ $(O)/.ready ./build-squashfs.sh "$(IMAGESDIR)" @@ -56,7 +60,7 @@ squashfs: $(IMAGESDIR)/rootfs.squashfs $(O)/linux/arch/arm64/boot/Image.gz: \ build-kernel.sh \ - linux.config \ + $(CONFIGDIR)/linux.config \ $(O)/.host-tools \ $(O)/.prepared ./build-kernel.sh "$(O)" diff --git a/build-grub.sh b/build-grub.sh index ac2fe2a..2bdabf6 100755 --- a/build-grub.sh +++ b/build-grub.sh @@ -3,7 +3,7 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config O="${1}" diff --git a/build-host-tools.sh b/build-host-tools.sh index fd46498..c519952 100755 --- a/build-host-tools.sh +++ b/build-host-tools.sh @@ -1,6 +1,6 @@ #!/bin/sh # vim: set sw=4 ts=4 sts=4 et : -PORTAGE_CONFIGROOT="${PWD}"/portage/config/host \ -< host-tools.packages xargs -ro \ +PORTAGE_CONFIGROOT="${CONFIGDIR:=${PWD}}"/portage/host \ +< "${CONFIGDIR}"/host-tools.packages xargs -ro \ emerge -vnUj diff --git a/build-kernel.sh b/build-kernel.sh index e1e928d..b2ae962 100755 --- a/build-kernel.sh +++ b/build-kernel.sh @@ -5,9 +5,9 @@ set -e O="${1}" -. ./config +. "${CONFIGDIR:=${PWD}}"/config -PORTAGE_CONFIGROOT="${PWD}"/portage/config/host \ +PORTAGE_CONFIGROOT="${CONFIGDIR}"/portage/host \ emerge -vnj ${kernel_pkg} export ARCH=arm64 CROSS_COMPILE=${target}- @@ -16,7 +16,7 @@ mkdir -p "${O}"/linux /usr/src/linux/scripts/kconfig/merge_config.sh -m \ -O "${O}"/linux \ /usr/src/linux/arch/*/configs/${kernel_defconfig}_defconfig \ - linux.config + "${CONFIGDIR}"/linux.config cd "${O}"/linux make -C /usr/src/linux O=${PWD} olddefconfig make -j$(nproc) diff --git a/build-rootfs.sh b/build-rootfs.sh index 642298a..14024c1 100755 --- a/build-rootfs.sh +++ b/build-rootfs.sh @@ -3,7 +3,7 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config mkdir -p \ /mnt/gentoo/usr/bin \ @@ -20,16 +20,15 @@ mkdir -p /mnt/gentoo/etc/portage ln -snf \ /var/db/repos/gentoo/profiles/${profile} \ /mnt/gentoo/etc/portage/make.profile -cp -r portage/. /mnt/gentoo/etc/portage/ ROOT=/mnt/gentoo \ -PORTAGE_CONFIGROOT="${PWD}"/portage/config/target \ -< install.packages xargs -ro \ +PORTAGE_CONFIGROOT="${CONFIGDIR}"/portage/target \ +< "${CONFIGDIR}"/install.packages xargs -ro \ ${target}-emerge -KvnuUDj --rebuilt-binaries=y ROOT=/mnt/gentoo \ -PORTAGE_CONFIGROOT="${PWD}"/portage/config/target \ -< installonly.packages xargs -ro \ +PORTAGE_CONFIGROOT="${CONFIGDIR}"/portage/target \ +< "${CONFIGDIR}"/installonly.packages xargs -ro \ ${target}-emerge -vnuUDj ROOT=/mnt/gentoo \ @@ -51,9 +50,12 @@ while read name; do ln -snf busybox /mnt/gentoo/bin/"${name}" \ || printf 'Failed to create busybox symlink for %s\n' "${name}" fi -done < busybox.symlinks +done < "${CONFIGDIR}"/busybox.symlinks rsync -rltpDO overlay/ /mnt/gentoo/ +if [ -d "${CONFIGDIR}"/overlay ]; then + rsync -rltpDO "${CONFIGDIR}"/overlay/ /mnt/gentoo/ +fi cp -uv /usr/${target}/usr/bin/grub-editenv /mnt/gentoo/usr/bin/ diff --git a/build-squashfs.sh b/build-squashfs.sh index 863721a..3e68516 100755 --- a/build-squashfs.sh +++ b/build-squashfs.sh @@ -3,7 +3,7 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config IMAGESDIR="${1}" @@ -12,7 +12,7 @@ mksquashfs \ /mnt/gentoo \ "${IMAGESDIR}"/rootfs.squashfs \ -comp gzip \ - -ef squashfs.exclude \ + -ef "${CONFIGDIR}"/squashfs.exclude \ -no-exports \ -noappend \ -wildcards diff --git a/build-update.sh b/build-update.sh index 029c8e7..f3f53ab 100755 --- a/build-update.sh +++ b/build-update.sh @@ -3,7 +3,7 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config IMAGESDIR="$1" diff --git a/build.sh b/build.sh index 3bef4bd..c27ddfc 100755 --- a/build.sh +++ b/build.sh @@ -3,17 +3,17 @@ set -e -. ./config +. "${CONFIGDIR}"/config unset MAKEFLAGS MAKEOVERRIDES MAKELEVEL -export PORTAGE_CONFIGROOT="${PWD}"/portage/config/target +export PORTAGE_CONFIGROOT="${CONFIGDIR}"/portage/target ${target}-emerge -vuUDj sys-apps/util-linux cat \ - build.packages \ - install.packages \ + "${CONFIGDIR}"/build.packages \ + "${CONFIGDIR}"/install.packages \ | xargs -ro \ ${target}-emerge -vnuUDj ${target}-emerge -v @preserved-rebuild diff --git a/genimage.sh b/genimage.sh index 11d556a..2001d92 100755 --- a/genimage.sh +++ b/genimage.sh @@ -12,7 +12,7 @@ cleanup() { fi } -. ./config +. "${CONFIGDIR:=${PWD}}"/config O="${1}" IMAGESDIR="${2}" diff --git a/ocivm.sh b/ocivm.sh index 34fd644..422d3b0 100755 --- a/ocivm.sh +++ b/ocivm.sh @@ -2,7 +2,7 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config name=build_yellow if ! ocivm list | grep -q localhost/cross-${target}; then diff --git a/post-build.sh b/post-build.sh index 893d6e9..4b1f177 100755 --- a/post-build.sh +++ b/post-build.sh @@ -3,7 +3,7 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config cp -uv \ /usr/${target}/boot/*.bin \ diff --git a/prepare.sh b/prepare.sh index 030bd26..3406b58 100755 --- a/prepare.sh +++ b/prepare.sh @@ -3,7 +3,7 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config # Ensure we have a Portage repo if [ ! -f /var/db/repos/gentoo/metadata/timestamp ]; then @@ -35,7 +35,7 @@ if [ ! -f portage/make.conf/10-crossdev.conf ]; then -e 's: ?-pam::' \ -e '/PKGDIR=/d' \ /usr/${target}/etc/portage/make.conf \ - > portage/config/target/etc/portage/make.conf/10-crossdev.conf + > "${CONFIGDIR}"/portage/target/etc/portage/make.conf/10-crossdev.conf fi ln -snf /var/db/repos/gentoo/profiles/default/linux/${ARCH}/17.0 \ @@ -58,7 +58,7 @@ merge-usr --root=/usr/${target} # Set the Portage profile ln -snf \ /var/db/repos/gentoo/profiles/${profile} \ - portage/config/target/etc/portage/make.profile + ${CONFIGDIR}/portage/target/etc/portage/make.profile ln -snf \ $(realpath /etc/portage/make.profile) \ - portage/config/host/etc/portage/make.profile + ${CONFIGDIR}/portage/host/etc/portage/make.profile diff --git a/rebuild-pkg.sh b/rebuild-pkg.sh index 20c42b6..24415f7 100755 --- a/rebuild-pkg.sh +++ b/rebuild-pkg.sh @@ -3,10 +3,10 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config unset MAKEFLAGS MAKEOVERRIDES MAKELEVEL -export PORTAGE_CONFIGROOT="${PWD}"/portage/config/target +export PORTAGE_CONFIGROOT="${CONFIGDIR}"/portage/target ${target}-emerge -bv1j --usepkg-exclude="$*" "$@" diff --git a/portage/repos/aimee-os/metadata/layout.conf b/repos/aimee-os/metadata/layout.conf similarity index 100% rename from portage/repos/aimee-os/metadata/layout.conf rename to repos/aimee-os/metadata/layout.conf diff --git a/portage/repos/aimee-os/profiles/repo_name b/repos/aimee-os/profiles/repo_name similarity index 100% rename from portage/repos/aimee-os/profiles/repo_name rename to repos/aimee-os/profiles/repo_name diff --git a/portage/repos/aimee-os/sec-policy/selinux-aimee-os/Manifest b/repos/aimee-os/sec-policy/selinux-aimee-os/Manifest similarity index 100% rename from portage/repos/aimee-os/sec-policy/selinux-aimee-os/Manifest rename to repos/aimee-os/sec-policy/selinux-aimee-os/Manifest diff --git a/portage/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.fc b/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.fc similarity index 100% rename from portage/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.fc rename to repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.fc diff --git a/portage/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.if b/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.if similarity index 100% rename from portage/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.if rename to repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.if diff --git a/portage/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.te b/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.te similarity index 100% rename from portage/repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.te rename to repos/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.te diff --git a/portage/repos/aimee-os/sec-policy/selinux-aimee-os/selinux-aimee-os-2.20221101-r3.ebuild b/repos/aimee-os/sec-policy/selinux-aimee-os/selinux-aimee-os-2.20221101-r3.ebuild similarity index 100% rename from portage/repos/aimee-os/sec-policy/selinux-aimee-os/selinux-aimee-os-2.20221101-r3.ebuild rename to repos/aimee-os/sec-policy/selinux-aimee-os/selinux-aimee-os-2.20221101-r3.ebuild diff --git a/portage/repos/aimee-os/sys-boot/u-boot/Manifest b/repos/aimee-os/sys-boot/u-boot/Manifest similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/Manifest rename to repos/aimee-os/sys-boot/u-boot/Manifest diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch b/repos/aimee-os/sys-boot/u-boot/files/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch rename to repos/aimee-os/sys-boot/u-boot/files/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0001-rpi-Use-CONFIG_OF_BOARD-instead-of-CONFIG_EMBED.patch b/repos/aimee-os/sys-boot/u-boot/files/0001-rpi-Use-CONFIG_OF_BOARD-instead-of-CONFIG_EMBED.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0001-rpi-Use-CONFIG_OF_BOARD-instead-of-CONFIG_EMBED.patch rename to repos/aimee-os/sys-boot/u-boot/files/0001-rpi-Use-CONFIG_OF_BOARD-instead-of-CONFIG_EMBED.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch b/repos/aimee-os/sys-boot/u-boot/files/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch rename to repos/aimee-os/sys-boot/u-boot/files/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0002-rpi-add-NVMe-to-boot-order.patch b/repos/aimee-os/sys-boot/u-boot/files/0002-rpi-add-NVMe-to-boot-order.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0002-rpi-add-NVMe-to-boot-order.patch rename to repos/aimee-os/sys-boot/u-boot/files/0002-rpi-add-NVMe-to-boot-order.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch b/repos/aimee-os/sys-boot/u-boot/files/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch rename to repos/aimee-os/sys-boot/u-boot/files/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch b/repos/aimee-os/sys-boot/u-boot/files/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch rename to repos/aimee-os/sys-boot/u-boot/files/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0005-nvme-improve-readability-of-nvme_setup_prps.patch b/repos/aimee-os/sys-boot/u-boot/files/0005-nvme-improve-readability-of-nvme_setup_prps.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0005-nvme-improve-readability-of-nvme_setup_prps.patch rename to repos/aimee-os/sys-boot/u-boot/files/0005-nvme-improve-readability-of-nvme_setup_prps.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch b/repos/aimee-os/sys-boot/u-boot/files/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch rename to repos/aimee-os/sys-boot/u-boot/files/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/files/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch b/repos/aimee-os/sys-boot/u-boot/files/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/files/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch rename to repos/aimee-os/sys-boot/u-boot/files/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch diff --git a/portage/repos/aimee-os/sys-boot/u-boot/u-boot-2023.01.ebuild b/repos/aimee-os/sys-boot/u-boot/u-boot-2023.01.ebuild similarity index 100% rename from portage/repos/aimee-os/sys-boot/u-boot/u-boot-2023.01.ebuild rename to repos/aimee-os/sys-boot/u-boot/u-boot-2023.01.ebuild diff --git a/portage/repos/x-portage/metadata/layout.conf b/repos/x-portage/metadata/layout.conf similarity index 100% rename from portage/repos/x-portage/metadata/layout.conf rename to repos/x-portage/metadata/layout.conf diff --git a/portage/repos/x-portage/profiles/repo_name b/repos/x-portage/profiles/repo_name similarity index 100% rename from portage/repos/x-portage/profiles/repo_name rename to repos/x-portage/profiles/repo_name diff --git a/setup-local-repo.sh b/setup-local-repo.sh index 02b3d55..6f3cd4e 100755 --- a/setup-local-repo.sh +++ b/setup-local-repo.sh @@ -3,19 +3,19 @@ set -e -. ./config +. "${CONFIGDIR:=${PWD}}"/config -mkdir -p portage/config/target/etc/portage/repos.conf +mkdir -p "${CONFIGDIR}"/portage/target/etc/portage/repos.conf -cat > portage/config/target/etc/portage/repos.conf/aimee-os.conf < "${CONFIGDIR}"/portage/target/etc/portage/repos.conf/aimee-os.conf < portage/config/target/etc/portage/repos.conf/x-portage.conf < "${CONFIGDIR}"/portage/target/etc/portage/repos.conf/x-portage.conf <