diff --git a/tools-image/Dockerfile b/tools-image/Dockerfile index e86389c..afcd2f2 100644 --- a/tools-image/Dockerfile +++ b/tools-image/Dockerfile @@ -4,30 +4,58 @@ ARG LUET_VERSION=0.32.5 FROM quay.io/kairos/packages:elemental-cli-system-0.20220921 AS elemental FROM quay.io/luet/base:$LUET_VERSION AS luet +### TODO: Replace those naked Dockerfiles copies with luet install so we can keep track of all versioning with 1 repository tag +### 1) Add the kairos repository with a reference +### 2) populate folders accordingly + ## amd64 Live CD artifacts -FROM quay.io/kairos/packages:grub2-livecd-0.0.4 AS grub2 +FROM quay.io/kairos/packages:grub2-livecd-0.0.4 AS grub2 FROM quay.io/kairos/packages:grub2-efi-image-livecd-0.0.4 AS efi +## RPI64 +FROM quay.io/kairos/packages-arm64:u-boot-rpi64-firmware-2021.01-5.1 AS rpi-u-boot +FROM quay.io/kairos/packages-arm64:raspberrypi-firmware-firmware-2021.03.10-2.1 AS rpi-firmware +FROM quay.io/kairos/packages-arm64:raspberrypi-firmware-config-firmware-2021.03.10-2.1 AS rpi-firmware-config +FROM quay.io/kairos/packages-arm64:raspberrypi-firmware-dt-firmware-2021.03.15-2.1 AS rpi-firmware-dt +FROM quay.io/kairos/packages-arm64:grub-efi-static-0.1 AS grub-efi +FROM quay.io/kairos/packages-arm64:grub-config-static-0.1 AS grub-config +FROM quay.io/kairos/packages-arm64:grub-artifacts-static-0.1 AS grub-artifacts + + FROM opensuse/leap:$LEAP_VERSION COPY --from=elemental /usr/bin/elemental /usr/bin/elemental COPY --from=luet /usr/bin/luet /usr/bin/luet +# x86_64 ISOs COPY --from=grub2 / /grub2 COPY --from=efi / /efi +# RPI64 +COPY --from=rpi-u-boot / /rpi/u-boot +COPY --from=rpi-firmware / /rpi/rpi-firmware +COPY --from=rpi-firmware-config / /rpi/rpi-firmware-config +COPY --from=rpi-firmware-dt / /rpi/rpi-firmware-dt +COPY --from=grub-efi / /rpi64/grub/efi +COPY --from=grub-config / /rpi64/grub/config +COPY --from=grub-artifacts / /rpi64/grub/artifacts + RUN zypper ref && zypper dup -y + +## ISO Build depedencies RUN zypper ref && zypper in -y xfsprogs parted util-linux-systemd e2fsprogs curl util-linux udev rsync grub2 dosfstools grub2-x86_64-efi squashfs mtools xorriso lvm2 RUN mkdir /config + # Arm image build deps RUN zypper in -y jq docker git curl gptfdisk kpartx sudo # Netboot RUN zypper in -y cdrtools -# ISO build + +# ISO build config COPY ./config.yaml /config/manifest.yaml COPY ./entrypoint.sh /entrypoint.sh COPY ./add-cloud-init.sh /add-cloud-init.sh -# ARM +# ARM helpers COPY ./build-arm-image.sh /build-arm-image.sh COPY ./arm /arm diff --git a/tools-image/arm/boards/rpi64.sh b/tools-image/arm/boards/rpi64.sh index 1d159a5..035d1c0 100755 --- a/tools-image/arm/boards/rpi64.sh +++ b/tools-image/arm/boards/rpi64.sh @@ -11,18 +11,14 @@ if [ -z "$image" ]; then exit 1 fi -if [ ! -e "$WORKDIR/luet.yaml" ]; then - ls -liah $WORKDIR - echo "No valid config file" - cat "$WORKDIR/luet.yaml" - exit 1 -fi set -ax TEMPDIR="$(mktemp -d)" echo $TEMPDIR mount "${device}p1" "${TEMPDIR}" -sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/u-boot-rpi64 -sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/raspberrypi-firmware -sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/raspberrypi-firmware-config -sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/raspberrypi-firmware-dt + +for dir in /rpi/u-boot /rpi/rpi-firmware /rpi/rpi-firmware-config /rpi/rpi-firmware-dt +do + cp -rfv ${dir}/* $TEMPDIR +done + umount "${TEMPDIR}" diff --git a/tools-image/build-arm-image.sh b/tools-image/build-arm-image.sh index f7dd611..35fb434 100755 --- a/tools-image/build-arm-image.sh +++ b/tools-image/build-arm-image.sh @@ -100,8 +100,6 @@ usage() echo " --local: (optional) Use local repository when building" echo " --directory: (optional) A directory which will be used for active/passive/recovery system" echo " --model: (optional) The board model" - echo " --final-repo: (optional) The luet repository used to download bits required for building" - echo " --repo-type: (optional) The luet repository type used to download bits required for building" exit 1 } @@ -242,17 +240,6 @@ WORKDIR=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX) TARGET=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX) STATEDIR=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX) -# Create a luet config for grabbing packages from local and remote repositories (local with high prio) -cat << EOF > $WORKDIR/luet.yaml -repositories: - - name: cOS - enable: true - urls: - - $final_repo - type: $repo_type - priority: 90 -EOF - export WORKDIR @@ -311,22 +298,8 @@ cp -rfv ${STATEDIR}/cOS/active.img ${RECOVERY}/cOS/recovery.img tune2fs -L ${SYSTEM_LABEL} ${RECOVERY}/cOS/recovery.img # Install real grub config to recovery -if [ -z "$manifest" ]; then - luet install --config $WORKDIR/luet.yaml -y --system-target $RECOVERY system/grub2-config - luet install --config $WORKDIR/luet.yaml -y --system-target $RECOVERY/grub2 system/grub2-artifacts -else - while IFS=$'\t' read -r name target ; do - if [ "$target" == "root/grub2" ]; then - luet install --no-spinner --system-target $RECOVERY/grub2 -y "$name" - fi - if [ "$target" == "root" ]; then - luet install --no-spinner --system-target $RECOVERY -y "$name" - fi - done < <("${YQ_PACKAGES_COMMAND[@]}" | jq -r ".raw_disk.$model.packages[] | [.name, .target] | @tsv") -fi - - # Remove luet cache -rm -rf $RECOVERY/var $RECOVERY/grub2/var +cp -rfv /$model/grub/config/* $RECOVERY +cp -rfv /$model/grub/artifacts/* $RECOVERY sync @@ -338,18 +311,7 @@ if [ -z "$EFI" ]; then exit 1 fi -if [ -z "$manifest" ]; then - luet install --config $WORKDIR/luet.yaml -y --system-target $EFI system/grub2-efi-image -else - while IFS=$'\t' read -r name target ; do - if [ "$target" == "efi" ]; then - luet install --no-spinner --system-target $EFI -y "$name" - fi - done < <("${YQ_PACKAGES_COMMAND[@]}" | jq -r ".raw_disk.$model.packages[] | [.name, .target] | @tsv") -fi - - # Remove luet cache -rm -rf $EFI/var +cp -rfv /$model/grub/efi/* $EFI echo ">> Writing image and partition table" dd if=/dev/zero of="${output_image}" bs=1024000 count="${size}" || exit 1