Skip to content

Commit eec5a66

Browse files
authored
fix(build): Enable UDF format to support AI files larger than 4GB
1 parent 575c878 commit eec5a66

File tree

1 file changed

+15
-46
lines changed

1 file changed

+15
-46
lines changed

build.sh

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
echo "====== LUMINOS MASTER BUILD SCRIPT (v7.2 - Robust Layers) ======"
4+
echo "====== LUMINOS MASTER BUILD SCRIPT (v7.3 - UDF Support) ======"
55
if [ "$(id -u)" -ne 0 ]; then echo "ERROR: This script must be run as root."; exit 1; fi
66

77
# --- 1. Define Directories & Vars ---
@@ -141,53 +141,20 @@ umount "${CHROOT_DIR}/proc"
141141
umount "${CHROOT_DIR}/dev/pts"
142142
umount "${CHROOT_DIR}/dev"
143143

144-
# --- 8. Build the ISO (Layered) ---
145-
# ---------------------------------------------------------
146-
# STRATEGY: 3 Layers to keep files under 4GB
147-
# 01-filesystem.squashfs (Base OS ~2GB)
148-
# 02-ai-part1.squashfs (Models Part A ~2.5GB)
149-
# 03-ai-part2.squashfs (Models Part B ~2.5GB)
150-
# ---------------------------------------------------------
144+
# --- 8. Build the ISO (Layers + UDF) ---
145+
# We use layers to keep the main OS clean, even if UDF allows large files.
146+
# This is cleaner for updates later.
151147

152-
# Layer 1: Main OS (excludes AI models path)
148+
# Layer 1: Main OS (excludes /usr/share/ollama/.ollama)
153149
echo "--> Compressing Layer 1: Main OS..."
154150
mksquashfs "${CHROOT_DIR}" "${ISO_DIR}/live/01-filesystem.squashfs" -e boot -e usr/share/ollama/.ollama -comp zstd
155151

156-
# Prepare AI Split
157-
echo "--> Preparing AI Layers..."
158-
AI_LAYER_1="${WORK_DIR}/ai_layer_1"
159-
AI_LAYER_2="${WORK_DIR}/ai_layer_2"
160-
161-
# Create the structure
162-
mkdir -p "${AI_LAYER_1}/usr/share/ollama/.ollama/blobs"
163-
mkdir -p "${AI_LAYER_2}/usr/share/ollama/.ollama/blobs"
164-
165-
# Copy the 'manifests' folder to Layer 1 (it's small)
166-
cp -r "${TARGET_MODEL_DIR}/manifests" "${AI_LAYER_1}/usr/share/ollama/.ollama/"
167-
168-
# Split the 'blobs' (The heavy files)
169-
echo "--> Splitting AI blobs..."
170-
# We simply list files and move half to layer 2.
171-
# This logic is safer than the loop.
172-
find "${TARGET_MODEL_DIR}/blobs" -type f > "${WORK_DIR}/blob_list.txt"
173-
TOTAL_BLOBS=$(wc -l < "${WORK_DIR}/blob_list.txt")
174-
HALF_BLOBS=$((TOTAL_BLOBS / 2))
175-
176-
# Copy first half to Layer 1
177-
head -n "$HALF_BLOBS" "${WORK_DIR}/blob_list.txt" | while read -r file; do
178-
cp "$file" "${AI_LAYER_1}/usr/share/ollama/.ollama/blobs/"
179-
done
180-
181-
# Copy second half to Layer 2
182-
tail -n +$((HALF_BLOBS + 1)) "${WORK_DIR}/blob_list.txt" | while read -r file; do
183-
cp "$file" "${AI_LAYER_2}/usr/share/ollama/.ollama/blobs/"
184-
done
185-
186-
echo "--> Compressing Layer 2: AI Part A..."
187-
mksquashfs "${AI_LAYER_1}" "${ISO_DIR}/live/02-ai-part-a.squashfs" -comp zstd
188-
189-
echo "--> Compressing Layer 3: AI Part B..."
190-
mksquashfs "${AI_LAYER_2}" "${ISO_DIR}/live/03-ai-part-b.squashfs" -comp zstd
152+
# Layer 2: AI Models (All in one go, relies on UDF support)
153+
echo "--> Compressing Layer 2: AI Models..."
154+
AI_LAYER_DIR="${WORK_DIR}/ai_layer_full"
155+
mkdir -p "${AI_LAYER_DIR}/usr/share/ollama/.ollama"
156+
cp -r "${TARGET_MODEL_DIR}/." "${AI_LAYER_DIR}/usr/share/ollama/.ollama/"
157+
mksquashfs "${AI_LAYER_DIR}" "${ISO_DIR}/live/02-ai-models.squashfs" -comp zstd
191158

192159
echo "--> Preparing Bootloader..."
193160
cp "${CHROOT_DIR}/boot"/vmlinuz* "${ISO_DIR}/live/vmlinuz"
@@ -202,8 +169,10 @@ menuentry "LuminOS v0.2.1 Live" {
202169
}
203170
EOF
204171

205-
echo "--> Generating ISO image..."
206-
grub-mkrescue -o "${BASE_DIR}/${ISO_NAME}" "${ISO_DIR}"
172+
echo "--> Generating ISO image (UDF Mode)..."
173+
# FIX: Use -- -udf to enable UDF filesystem which supports files > 4GB
174+
# We also disable Joliet to avoid the 4GB limit error from that standard.
175+
grub-mkrescue -o "${BASE_DIR}/${ISO_NAME}" "${ISO_DIR}" -- -udf -joliet off
207176

208177
echo "--> Cleaning up work directory..."
209178
sudo rm -rf "${WORK_DIR}"

0 commit comments

Comments
 (0)