From c6ed639e56d56a803a17a64b133b7614921c4431 Mon Sep 17 00:00:00 2001 From: Bjordis Collaku Date: Thu, 16 Oct 2025 16:22:42 -0700 Subject: [PATCH 1/6] Remove user prompt to reboot from kernel deb postinst logic Signed-off-by: Bjordis Collaku --- kernel/scripts/build-kernel-deb.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/kernel/scripts/build-kernel-deb.sh b/kernel/scripts/build-kernel-deb.sh index b37c390..f8fc1ca 100755 --- a/kernel/scripts/build-kernel-deb.sh +++ b/kernel/scripts/build-kernel-deb.sh @@ -216,14 +216,6 @@ echo "Linux kernel package version \$kernel_version installed successfully." # Suggest rebooting the system echo "To apply the new kernel, a system reboot is required." -echo "Would you like to reboot now? (yes/no)" -read answer -if [ "\$answer" = "yes" ]; then - echo "Rebooting the system..." - reboot -else - echo "Please remember to reboot your system later to apply the new kernel." -fi EOF # Make postinst script executable From b82b8022ca6a802ccaf6b5c20f2686cf46978958 Mon Sep 17 00:00:00 2001 From: Bjordis Collaku Date: Thu, 16 Oct 2025 16:32:41 -0700 Subject: [PATCH 2/6] Update qcom-next kernel build to merge qcom.config into defconfig Signed-off-by: Bjordis Collaku --- kernel/scripts/build_kernel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/scripts/build_kernel.sh b/kernel/scripts/build_kernel.sh index 90d59c6..77d0561 100755 --- a/kernel/scripts/build_kernel.sh +++ b/kernel/scripts/build_kernel.sh @@ -23,7 +23,7 @@ rm -rf $BUILD_TOP/out/*; # Make config cd $BUILD_TOP/qcom-next/ -make ARCH=arm64 defconfig +make ARCH=arm64 defconfig qcom.config # Deploy boot config to out/ cp $BUILD_TOP/qcom-next/.config $BUILD_TOP/out/ From 2cea24fa824f965c9b444f22ec37b3b29f0b347d Mon Sep 17 00:00:00 2001 From: Bjordis Collaku Date: Mon, 20 Oct 2025 16:53:08 -0700 Subject: [PATCH 3/6] feat(iot): switch image preprocessing to ISO + squashfs extraction - Stop treating IMG_URL as a preinstalled disk image - Download ISO via wget and extract with 7z - Prefer casper/minimal.squashfs (fallback to filesystem.squashfs) - Unsquash into squashfs-root and copy to $ROOTFS_DIR - Silently ensure 7z (p7zip-full) is installed on Ubuntu - Add robust checks, clearer logs, and safe defaults Rationale: This aligns with the new distribution format where IMG_URL always points to an ISO and avoids loop/partition logic that no longer applies. Impact: - Ubuntu Server supported Signed-off-by: Bjordis Collaku --- rootfs/scripts/build-ubuntu-rootfs.sh | 140 +++++++++++++++++--------- 1 file changed, 90 insertions(+), 50 deletions(-) diff --git a/rootfs/scripts/build-ubuntu-rootfs.sh b/rootfs/scripts/build-ubuntu-rootfs.sh index 3df92d6..d5d2632 100755 --- a/rootfs/scripts/build-ubuntu-rootfs.sh +++ b/rootfs/scripts/build-ubuntu-rootfs.sh @@ -150,43 +150,98 @@ parse_configuration() { # Distro-specific handling is done via an inner case. # ============================================================================== image_preproccessing_iot() { - case "$(echo "$DISTRO" | tr '[:upper:]' '[:lower:]')" in - ubuntu|ubuntu-server) - local LOOP_DEV PART_DEV - echo "[INFO][iot][ubuntu] Downloading base image..." - if ! wget -c "$IMG_URL" -O "$IMG_XZ_NAME"; then - echo "[ERROR] Failed to download image from: $IMG_URL" - exit 1 - fi + case "$(echo "$DISTRO" | tr '[:upper:]' '[:lower:]')" in + ubuntu|ubuntu-server) + echo "[INFO][iot][ubuntu] Preparing environment..." + + # --- Silent ensure of 7z (p7zip-full) --- + if ! command -v 7z >/dev/null 2>&1; then + echo "[INFO][iot][ubuntu] '7z' not found. Installing p7zip-full silently..." + export DEBIAN_FRONTEND=noninteractive + # Use -qq for quiet and redirect all output to /dev/null + apt-get -qq update >/dev/null 2>&1 || true + apt-get -qq install -y p7zip-full >/dev/null 2>&1 || { + echo "[ERROR] Failed to install 'p7zip-full' required for 7z." + exit 1 + } + fi + + # Check unsquashfs (required). Keep explicit to avoid unexpected installs. + if ! command -v unsquashfs >/dev/null 2>&1; then + echo "[ERROR] 'unsquashfs' not found. Please install 'squashfs-tools'." + echo " e.g., apt-get install -y squashfs-tools" + exit 1 + fi - echo "[INFO][iot][ubuntu] Extracting preinstalled image..." - 7z x "$IMG_XZ_NAME" + echo "[INFO][iot][ubuntu] Downloading ISO..." - echo "[INFO][iot][ubuntu] Setting up loop device..." - LOOP_DEV=$(losetup --show --partscan --find "$IMG_NAME") - PART_DEV="${LOOP_DEV}p1" + # Derive a sane ISO_NAME if not provided + if [[ -z "$ISO_NAME" ]]; then + ISO_NAME=$(basename "${IMG_URL%%\?*}") + [[ -z "$ISO_NAME" || "$ISO_NAME" == "/" ]] && ISO_NAME="image.iso" + fi - if [[ ! -b "$PART_DEV" ]]; then - losetup -d "$LOOP_DEV" - echo "[ERROR] Partition not found: $PART_DEV" - exit 1 - fi + # Working dirs + ISO_EXTRACT_DIR="${ISO_EXTRACT_DIR:-isoImage}" + SQUASHFS_WORK_DIR="${SQUASHFS_WORK_DIR:-squashfs-root}" + MNT_DIR="${MNT_DIR:-/mnt/iot-iso-tmp}" # kept for compatibility with other logic + + # Fetch ISO + if ! wget -q -c "$IMG_URL" -O "$ISO_NAME"; then + echo "[ERROR] Failed to download ISO from: $IMG_URL" + exit 1 + fi - mkdir -p "$MNT_DIR" "$ROOTFS_DIR" - mount "$PART_DEV" "$MNT_DIR" - cp -rap "$MNT_DIR/"* "$ROOTFS_DIR/" - umount -l "$MNT_DIR" - losetup -d "$LOOP_DEV" - ;; - debian) - echo "[ERROR][iot][debian] Not implemented yet." + echo "[INFO][iot][ubuntu] Extracting ISO with 7z..." + rm -rf "$ISO_EXTRACT_DIR" "$SQUASHFS_WORK_DIR" + mkdir -p "$ISO_EXTRACT_DIR" "$ROOTFS_DIR" + + if ! 7z x "$ISO_NAME" -o"$ISO_EXTRACT_DIR" -y >/dev/null; then + echo "[ERROR] Failed to extract ISO: $ISO_NAME" + exit 1 + fi + + # Prefer minimal.squashfs; fallback to filesystem.squashfs + SQUASHFS_PATH="" + if [[ -f "$ISO_EXTRACT_DIR/casper/minimal.squashfs" ]]; then + SQUASHFS_PATH="$ISO_EXTRACT_DIR/casper/minimal.squashfs" + elif [[ -f "$ISO_EXTRACT_DIR/casper/filesystem.squashfs" ]]; then + SQUASHFS_PATH="$ISO_EXTRACT_DIR/casper/filesystem.squashfs" + echo "[WARN][iot][ubuntu] 'minimal.squashfs' not found, using 'filesystem.squashfs'." + else + echo "[ERROR] Neither 'casper/minimal.squashfs' nor 'casper/filesystem.squashfs' found in ISO." + echo " Looked under: $ISO_EXTRACT_DIR/casper/" exit 1 - ;; - *) - echo "[ERROR][iot] Unsupported distro: $DISTRO" + fi + + echo "[INFO][iot][ubuntu] Unsquashing rootfs from: $SQUASHFS_PATH" + if ! unsquashfs -d "$SQUASHFS_WORK_DIR" "$SQUASHFS_PATH" >/dev/null; then + echo "[ERROR] Failed to unsquash: $SQUASHFS_PATH" + exit 1 + fi + + echo "[INFO][iot][ubuntu] Copying rootfs into: $ROOTFS_DIR" + mkdir -p "$ROOTFS_DIR" + if ! cp -rap "${SQUASHFS_WORK_DIR}/"* "$ROOTFS_DIR/"; then + echo "[ERROR] Failed to copy rootfs into: $ROOTFS_DIR" exit 1 - ;; - esac + fi + + echo "[INFO][iot][ubuntu] Rootfs prepared at: $ROOTFS_DIR" + # Optional cleanup: + # rm -rf "$ISO_EXTRACT_DIR" "$SQUASHFS_WORK_DIR" + ;; + + debian) + echo "[ERROR][iot][debian] Not implemented yet." + exit 1 + ;; + + *) + echo "[ERROR][iot] Unsupported distro: $DISTRO" + exit 1 + ;; + esac } # Empty stubs for future targets @@ -207,9 +262,7 @@ else CFG["CODENAME"]="questing" CFG["ARCH"]="arm64" CFG["VARIANT"]="server" - CFG["CHANNEL"]="daily-preinstalled" - CFG["STREAM"]="current" - CFG["FLAVOR"]="ubuntu-server" + CFG["BASE_IMAGE_URL"]="https://cdimage.ubuntu.com/releases/questing/release/ubuntu-25.10-live-server-arm64.iso" fi TARGET_PLATFORM="${CFG[QCOM_TARGET_PLATFORM]:-iot}" @@ -217,25 +270,15 @@ DISTRO="${CFG[DISTRO]:-ubuntu}" CODENAME="${CFG[CODENAME]:-questing}" ARCH="${CFG[ARCH]:-arm64}" VARIANT="${CFG[VARIANT]:-server}" -CHANNEL="${CFG[CHANNEL]:-daily-preinstalled}" -STREAM="${CFG[STREAM]:-current}" -FLAVOR="${CFG[FLAVOR]:-ubuntu-server}" +BASE_IMAGE_URL="${CFG[BASE_IMAGE_URL]:-"https://cdimage.ubuntu.com/releases/questing/release/ubuntu-25.10-live-server-arm64.iso"}" # Derive image parameters for Ubuntu (others can be added later) case "$(echo "$DISTRO" | tr '[:upper:]' '[:lower:]')" in ubuntu|ubuntu-server) - IMG_STEM="${CODENAME}-preinstalled-${VARIANT}-${ARCH}.img" - IMG_XZ_NAME="${IMG_STEM}.xz" - # Ubuntu daily-preinstalled URL format (no codename directory in the path): - # https://cdimage.ubuntu.com////-preinstalled--.img.xz - IMG_URL="https://cdimage.ubuntu.com/${FLAVOR}/${CHANNEL}/${STREAM}/${IMG_XZ_NAME}" - IMG_NAME="$IMG_STEM" + IMG_URL=${BASE_IMAGE_URL} ;; *) # Leave unsupported distros to be implemented inside the respective target function later. - IMG_STEM="" - IMG_XZ_NAME="" - IMG_NAME="" IMG_URL="" ;; esac @@ -246,10 +289,7 @@ echo " DISTRO=$DISTRO" echo " CODENAME=$CODENAME" echo " ARCH=$ARCH" echo " VARIANT=$VARIANT" -echo " CHANNEL=$CHANNEL" -echo " STREAM=$STREAM" -echo " FLAVOR=$FLAVOR" -[[ -n "$IMG_URL" ]] && echo " URL=$IMG_URL" +echo " BASE_IMAGE_URL=${BASE_IMAGE_URL}" # ============================================================================== # Step 2–3: Target platform switch – preprocess image to fill rootfs/ From 5fdd123b6be48f098b44c737649db8f3668e1a1b Mon Sep 17 00:00:00 2001 From: Bjordis Collaku Date: Mon, 20 Oct 2025 16:59:31 -0700 Subject: [PATCH 4/6] Update build-ubuntu-rootfs.sh Signed-off-by: Bjordis Collaku --- rootfs/scripts/build-ubuntu-rootfs.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rootfs/scripts/build-ubuntu-rootfs.sh b/rootfs/scripts/build-ubuntu-rootfs.sh index d5d2632..483ee55 100755 --- a/rootfs/scripts/build-ubuntu-rootfs.sh +++ b/rootfs/scripts/build-ubuntu-rootfs.sh @@ -166,12 +166,16 @@ image_preproccessing_iot() { } fi - # Check unsquashfs (required). Keep explicit to avoid unexpected installs. + # --- Silent ensure of unsquashfs (squashfs-tools) --- if ! command -v unsquashfs >/dev/null 2>&1; then - echo "[ERROR] 'unsquashfs' not found. Please install 'squashfs-tools'." - echo " e.g., apt-get install -y squashfs-tools" - exit 1 - fi + echo "[INFO][iot][ubuntu] 'unsquashfs' not found. Installing squashfs-tools silently..." + export DEBIAN_FRONTEND=noninteractive + apt-get -qq update >/dev/null 2>&1 || true + apt-get -qq install -y squashfs-tools >/dev/null 2>&1 || { + echo "[ERROR] Failed to install 'squashfs-tools' required for unsquashfs." + exit 1 + } + fi echo "[INFO][iot][ubuntu] Downloading ISO..." From 30ddc065719e9883712eeda0946c274a7b4ef934 Mon Sep 17 00:00:00 2001 From: Bjordis Collaku Date: Mon, 20 Oct 2025 17:22:16 -0700 Subject: [PATCH 5/6] Update build-ubuntu-rootfs.sh Signed-off-by: Bjordis Collaku --- rootfs/scripts/build-ubuntu-rootfs.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rootfs/scripts/build-ubuntu-rootfs.sh b/rootfs/scripts/build-ubuntu-rootfs.sh index 483ee55..22fb789 100755 --- a/rootfs/scripts/build-ubuntu-rootfs.sh +++ b/rootfs/scripts/build-ubuntu-rootfs.sh @@ -179,9 +179,14 @@ image_preproccessing_iot() { echo "[INFO][iot][ubuntu] Downloading ISO..." - # Derive a sane ISO_NAME if not provided - if [[ -z "$ISO_NAME" ]]; then - ISO_NAME=$(basename "${IMG_URL%%\?*}") + # SAFE under set -u: + ISO_NAME="${ISO_NAME-}" + if [[ -z "${ISO_NAME}" ]]; then + if [[ -z "${IMG_URL-}" ]]; then + echo "[ERROR] IMG_URL is empty/unset; cannot derive ISO_NAME." + exit 1 + fi + ISO_NAME="$(basename "${IMG_URL%%\?*}")" [[ -z "$ISO_NAME" || "$ISO_NAME" == "/" ]] && ISO_NAME="image.iso" fi From 44f8a37077a69cefb70b5ab181bb7f492a53b127 Mon Sep 17 00:00:00 2001 From: Bjordis Collaku Date: Mon, 20 Oct 2025 17:28:29 -0700 Subject: [PATCH 6/6] fix(iot): detect ubuntu-server-minimal.squashfs and fallback scan - Add support for casper/ubuntu-server-minimal.squashfs - Keep existing checks for minimal.squashfs and filesystem.squashfs - Fallback: scan ISO tree (depth-limited) for *.squashfs and prefer *minimal* - Log selection and warn when multiple candidates are found Rationale: Recent Ubuntu ISOs package rootfs as ubuntu-server-minimal.squashfs, which broke the previous hard-coded paths. This makes detection robust across ISO variants. Signed-off-by: Bjordis Collaku --- rootfs/scripts/build-ubuntu-rootfs.sh | 46 +++++++++++++++++++++------ 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/rootfs/scripts/build-ubuntu-rootfs.sh b/rootfs/scripts/build-ubuntu-rootfs.sh index 22fb789..e4a94f4 100755 --- a/rootfs/scripts/build-ubuntu-rootfs.sh +++ b/rootfs/scripts/build-ubuntu-rootfs.sh @@ -210,18 +210,44 @@ image_preproccessing_iot() { exit 1 fi - # Prefer minimal.squashfs; fallback to filesystem.squashfs - SQUASHFS_PATH="" - if [[ -f "$ISO_EXTRACT_DIR/casper/minimal.squashfs" ]]; then - SQUASHFS_PATH="$ISO_EXTRACT_DIR/casper/minimal.squashfs" - elif [[ -f "$ISO_EXTRACT_DIR/casper/filesystem.squashfs" ]]; then - SQUASHFS_PATH="$ISO_EXTRACT_DIR/casper/filesystem.squashfs" - echo "[WARN][iot][ubuntu] 'minimal.squashfs' not found, using 'filesystem.squashfs'." - else - echo "[ERROR] Neither 'casper/minimal.squashfs' nor 'casper/filesystem.squashfs' found in ISO." - echo " Looked under: $ISO_EXTRACT_DIR/casper/" + # --- Robust squashfs selection --- + local SQUASHFS_PATH="" + for candidate in \ + "$ISO_EXTRACT_DIR/casper/ubuntu-server-minimal.squashfs" \ + "$ISO_EXTRACT_DIR/casper/minimal.squashfs" \ + "$ISO_EXTRACT_DIR/casper/filesystem.squashfs" \ + "$ISO_EXTRACT_DIR/ubuntu-server-minimal.squashfs" \ + "$ISO_EXTRACT_DIR/minimal.squashfs" \ + "$ISO_EXTRACT_DIR/filesystem.squashfs" + do + if [[ -f "$candidate" ]]; then + SQUASHFS_PATH="$candidate" + break + fi + done + if [[ -z "$SQUASHFS_PATH" ]]; then + mapfile -t found_squashfs < <(find "$ISO_EXTRACT_DIR" -maxdepth 3 -type f -name '*.squashfs' 2>/dev/null | sort) + if (( ${#found_squashfs[@]} == 1 )); then + SQUASHFS_PATH="${found_squashfs[0]}" + elif (( ${#found_squashfs[@]} > 1 )); then + for f in "${found_squashfs[@]}"; do + if [[ "$f" =~ minimal\.squashfs$ ]]; then + SQUASHFS_PATH="$f" + break + fi + done + [[ -z "$SQUASHFS_PATH" ]] && SQUASHFS_PATH="${found_squashfs[0]}" + echo "[WARN][iot][ubuntu] Multiple squashfs files found:" + printf ' - %s\n' "${found_squashfs[@]}" + echo " Selected: $SQUASHFS_PATH" + fi + fi + if [[ -z "$SQUASHFS_PATH" ]]; then + echo "[ERROR] No squashfs image found in ISO after scanning." + echo " Looked under: $ISO_EXTRACT_DIR (depth 3)" exit 1 fi + echo "[INFO][iot][ubuntu] Using squashfs: $SQUASHFS_PATH" echo "[INFO][iot][ubuntu] Unsquashing rootfs from: $SQUASHFS_PATH" if ! unsquashfs -d "$SQUASHFS_WORK_DIR" "$SQUASHFS_PATH" >/dev/null; then