From 31d8a98f6456a7268ee89eed4797ac23a4936f2d Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 13 Mar 2023 16:21:20 -0500 Subject: [PATCH] build: Implement CONFIGDIR setting In effort to support different builds of Aimee OS using the same scripts, without necessarily having to fork this repository, the build system now supports a `CONFIGDIR` setting. When this variable is set, files defining the target environment, such as the lists of packages to install, the kernel configuration, the Portage configuration, etc. are found in the path it specifes. The reference build, for the Home Assistant Yellow board, is configured in the `yellow` directory. To build it, run: ```sh CONFIGDIR=yellow ./vm-build.sh ``` --- .gitignore | 5 +--- Makefile | 24 +++++++++++-------- build-grub.sh | 2 +- build-host-tools.sh | 4 ++-- build-kernel.sh | 6 ++--- build-rootfs.sh | 16 +++++++------ build-squashfs.sh | 4 ++-- build-update.sh | 2 +- build.sh | 8 +++---- genimage.sh | 2 +- ocivm.sh | 2 +- post-build.sh | 2 +- prepare.sh | 8 +++---- rebuild-pkg.sh | 4 ++-- .../aimee-os/metadata/layout.conf | 0 .../aimee-os/profiles/repo_name | 0 .../sec-policy/selinux-aimee-os/Manifest | 0 .../selinux-aimee-os/files/aimee-os.fc | 0 .../selinux-aimee-os/files/aimee-os.if | 0 .../selinux-aimee-os/files/aimee-os.te | 0 .../selinux-aimee-os-2.20221101-r3.ebuild | 0 .../aimee-os/sys-boot/u-boot/Manifest | 0 ...cm283x-don-t-explicitly-disable-init.patch | 0 ...FIG_OF_BOARD-instead-of-CONFIG_EMBED.patch | 0 ...cm283x-allow-to-spawn-any-PL011-UART.patch | 0 .../0002-rpi-add-NVMe-to-boot-order.patch | 0 ...ect-the-prps-per-page-calculation-me.patch | 0 ...ke-driver-compatible-with-downstream.patch | 0 ...prove-readability-of-nvme_setup_prps.patch | 0 ...se-pointer-for-CPU-addressed-buffers.patch | 0 ...irtual-addresses-into-the-bus-s-addr.patch | 0 .../sys-boot/u-boot/u-boot-2023.01.ebuild | 0 .../x-portage/metadata/layout.conf | 0 .../x-portage/profiles/repo_name | 0 setup-local-repo.sh | 18 +++++++------- start-container.sh | 2 +- yellow/.gitignore | 3 +++ build.packages => yellow/build.packages | 0 busybox.symlinks => yellow/busybox.symlinks | 0 config => yellow/config | 0 .../host-tools.packages | 0 install.packages => yellow/install.packages | 0 .../installonly.packages | 0 linux.config => yellow/linux.config | 0 .../portage}/host/etc/portage/env/nobuildpkg | 0 .../etc/portage/make.conf/15-keywords.conf | 0 .../etc/portage/make.conf/20-binpkgs.conf | 0 .../host/etc/portage/make.conf/80-quiet.conf | 0 yellow/portage/host/etc/portage/make.profile | 1 + .../portage/package.accept_keywords/kernel | 0 .../host/etc/portage/package.env/kernel | 0 .../host/etc/portage/package.use/btrfs-progs | 0 .../portage}/host/etc/portage/package.use/git | 0 .../host/etc/portage/package.use/grub | 0 .../host/etc/portage/package.use/kernel | 0 .../host/etc/portage/package.use/selinux | 0 .../etc/portage/package.use/squashfs-tools | 0 .../host/etc/portage/package.use/systemd | 0 ...Add-device-tree-for-Home-Assistant-Y.patch | 0 ...dd-device-tree-for-Home-Assistant-Y.patch2 | 0 ...x-add-compatible-picked-up-by-U-Boot.patch | 0 ...yellow-Mux-UART4-for-SiLabs-radio-mo.patch | 0 ...M-dts-bcm2711-yellow-Mux-debug-UART5.patch | 0 ...cm2711-yellow-Enable-I2C6-by-default.patch | 0 ...s-bcm2711-yellow-add-I2S-audio-codec.patch | 0 ...-dts-bcm2711-yellow-enable-GPIO-keys.patch | 0 ...-ARM-dts-bcm2711-yellow-add-user-LED.patch | 0 ...bcm2711-yellow-add-NXP-PCF85063A-RTC.patch | 0 ...yellow-enable-USB-host-mode-by-defau.patch | 0 ...yellow-use-generic-activity-trigger-.patch | 0 ...1-yellow-use-USB-OTG-mode-by-default.patch | 0 ...dts-bcm2711-yellow-Add-LED-overrides.patch | 0 .../target/etc/portage/env/nobuildpkg | 0 .../etc/portage/make.conf/10-common.conf | 0 .../etc/portage/make.conf/10-crossdev.conf | 22 +++++++++++++++++ .../etc/portage/make.conf/20-binpkgs.conf | 0 .../etc/portage/make.conf/30-default-use.conf | 0 .../target/etc/portage/make.conf/40-lang.conf | 0 .../etc/portage/make.conf/60-selinux.conf | 0 .../etc/portage/make.conf/80-quiet.conf | 0 .../portage/target/etc/portage/make.profile | 1 + .../etc/portage/package.env/linux-firmware | 0 .../etc/portage/package.license/firmware | 0 .../target/etc/portage/package.use/awk | 0 .../target/etc/portage/package.use/busybox | 0 .../target/etc/portage/package.use/firmware | 0 .../target/etc/portage/package.use/grub | 0 .../target/etc/portage/package.use/python | 0 .../target/etc/portage/package.use/u-boot | 0 .../patches/sec-policy/selinux-base-policy | 0 ...1-systemd-Fixes-for-systemd-resolved.patch | 0 .../0002-mount-Allow-mounting-on-etc_t.patch | 0 ...Mark-unlabeled_t-as-mount-point-type.patch | 0 ...emd-journald-list-cgroup-directories.patch | 0 ...-Allow-systemd-to-create-directories.patch | 0 .../etc/portage/profile/package.provided | 0 .../etc/portage/savedconfig/sys-apps/busybox | 0 .../etc/portage/savedconfig/sys-boot/u-boot | 0 .../savedconfig/sys-kernel/linux-firmware | 0 squashfs.exclude => yellow/squashfs.exclude | 0 100 files changed, 83 insertions(+), 53 deletions(-) rename {portage/repos => repos}/aimee-os/metadata/layout.conf (100%) rename {portage/repos => repos}/aimee-os/profiles/repo_name (100%) rename {portage/repos => repos}/aimee-os/sec-policy/selinux-aimee-os/Manifest (100%) rename {portage/repos => repos}/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.fc (100%) rename {portage/repos => repos}/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.if (100%) rename {portage/repos => repos}/aimee-os/sec-policy/selinux-aimee-os/files/aimee-os.te (100%) rename {portage/repos => repos}/aimee-os/sec-policy/selinux-aimee-os/selinux-aimee-os-2.20221101-r3.ebuild (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/Manifest (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0001-rpi-Use-CONFIG_OF_BOARD-instead-of-CONFIG_EMBED.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0002-rpi-add-NVMe-to-boot-order.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0005-nvme-improve-readability-of-nvme_setup_prps.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/files/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch (100%) rename {portage/repos => repos}/aimee-os/sys-boot/u-boot/u-boot-2023.01.ebuild (100%) rename {portage/repos => repos}/x-portage/metadata/layout.conf (100%) rename {portage/repos => repos}/x-portage/profiles/repo_name (100%) create mode 100644 yellow/.gitignore rename build.packages => yellow/build.packages (100%) rename busybox.symlinks => yellow/busybox.symlinks (100%) rename config => yellow/config (100%) rename host-tools.packages => yellow/host-tools.packages (100%) rename install.packages => yellow/install.packages (100%) rename installonly.packages => yellow/installonly.packages (100%) rename linux.config => yellow/linux.config (100%) rename {portage/config => yellow/portage}/host/etc/portage/env/nobuildpkg (100%) rename {portage/config => yellow/portage}/host/etc/portage/make.conf/15-keywords.conf (100%) rename {portage/config => yellow/portage}/host/etc/portage/make.conf/20-binpkgs.conf (100%) rename {portage/config => yellow/portage}/host/etc/portage/make.conf/80-quiet.conf (100%) create mode 120000 yellow/portage/host/etc/portage/make.profile rename {portage/config => yellow/portage}/host/etc/portage/package.accept_keywords/kernel (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.env/kernel (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.use/btrfs-progs (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.use/git (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.use/grub (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.use/kernel (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.use/selinux (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.use/squashfs-tools (100%) rename {portage/config => yellow/portage}/host/etc/portage/package.use/systemd (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0001-ARM-dts-bcm2711-Add-device-tree-for-Home-Assistant-Y.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0001-ARM-dts-bcm2711-Add-device-tree-for-Home-Assistant-Y.patch2 (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0001-ARM-dts-bcm283x-add-compatible-picked-up-by-U-Boot.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0002-ARM-dts-bcm2711-yellow-Mux-UART4-for-SiLabs-radio-mo.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0003-ARM-dts-bcm2711-yellow-Mux-debug-UART5.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0004-ARM-dts-bcm2711-yellow-Enable-I2C6-by-default.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0005-ARM-dts-bcm2711-yellow-add-I2S-audio-codec.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0006-ARM-dts-bcm2711-yellow-enable-GPIO-keys.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0007-ARM-dts-bcm2711-yellow-add-user-LED.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0008-ARM-dts-bcm2711-yellow-add-NXP-PCF85063A-RTC.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0009-ARM-dts-bcm2711-yellow-enable-USB-host-mode-by-defau.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0010-ARM-dts-bcm2711-yellow-use-generic-activity-trigger-.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0011-ARM-dts-bcm2711-yellow-use-USB-OTG-mode-by-default.patch (100%) rename {portage/config => yellow/portage}/host/etc/portage/patches/sys-kernel/raspberrypi-sources/0012-ARM-dts-bcm2711-yellow-Add-LED-overrides.patch (100%) rename {portage/config => yellow/portage}/target/etc/portage/env/nobuildpkg (100%) rename {portage/config => yellow/portage}/target/etc/portage/make.conf/10-common.conf (100%) create mode 100644 yellow/portage/target/etc/portage/make.conf/10-crossdev.conf rename {portage/config => yellow/portage}/target/etc/portage/make.conf/20-binpkgs.conf (100%) rename {portage/config => yellow/portage}/target/etc/portage/make.conf/30-default-use.conf (100%) rename {portage/config => yellow/portage}/target/etc/portage/make.conf/40-lang.conf (100%) rename {portage/config => yellow/portage}/target/etc/portage/make.conf/60-selinux.conf (100%) rename {portage/config => yellow/portage}/target/etc/portage/make.conf/80-quiet.conf (100%) create mode 120000 yellow/portage/target/etc/portage/make.profile rename {portage/config => yellow/portage}/target/etc/portage/package.env/linux-firmware (100%) rename {portage/config => yellow/portage}/target/etc/portage/package.license/firmware (100%) rename {portage/config => yellow/portage}/target/etc/portage/package.use/awk (100%) rename {portage/config => yellow/portage}/target/etc/portage/package.use/busybox (100%) rename {portage/config => yellow/portage}/target/etc/portage/package.use/firmware (100%) rename {portage/config => yellow/portage}/target/etc/portage/package.use/grub (100%) rename {portage/config => yellow/portage}/target/etc/portage/package.use/python (100%) rename {portage/config => yellow/portage}/target/etc/portage/package.use/u-boot (100%) rename {portage/config => yellow/portage}/target/etc/portage/patches/sec-policy/selinux-base-policy (100%) rename {portage/config => yellow/portage}/target/etc/portage/patches/sec-policy/selinux-base/0001-systemd-Fixes-for-systemd-resolved.patch (100%) rename {portage/config => yellow/portage}/target/etc/portage/patches/sec-policy/selinux-base/0002-mount-Allow-mounting-on-etc_t.patch (100%) rename {portage/config => yellow/portage}/target/etc/portage/patches/sec-policy/selinux-base/0003-kernel-Mark-unlabeled_t-as-mount-point-type.patch (100%) rename {portage/config => yellow/portage}/target/etc/portage/patches/sec-policy/selinux-base/0004-Allow-systemd-journald-list-cgroup-directories.patch (100%) rename {portage/config => yellow/portage}/target/etc/portage/patches/sec-policy/selinux-base/0005-Allow-systemd-to-create-directories.patch (100%) rename {portage/config => yellow/portage}/target/etc/portage/profile/package.provided (100%) rename {portage/config => yellow/portage}/target/etc/portage/savedconfig/sys-apps/busybox (100%) rename {portage/config => yellow/portage}/target/etc/portage/savedconfig/sys-boot/u-boot (100%) rename {portage/config => yellow/portage}/target/etc/portage/savedconfig/sys-kernel/linux-firmware (100%) rename squashfs.exclude => yellow/squashfs.exclude (100%) 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 <