-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_image.sh
More file actions
executable file
·95 lines (79 loc) · 3.07 KB
/
create_image.sh
File metadata and controls
executable file
·95 lines (79 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Create FydeOS Image Script
set -e
echo "=========================================="
echo "Creating FydeOS Image"
echo "=========================================="
BOARD="terra_fydeos"
BUILD_DIR="/mnt/sdb/fydeos_build"
IMAGE_DIR="$BUILD_DIR/src/build/images/$BOARD"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
IMAGE_OUT="$IMAGE_DIR/$TIMESTAMP"
# Create image directories
mkdir -p "$IMAGE_OUT"
ln -sfn "$TIMESTAMP" "$IMAGE_DIR/latest"
echo "Image output directory: $IMAGE_OUT"
# Check if we have the kernel
if [ -f "$BUILD_DIR/chroot/build/$BOARD/boot/vmlinuz" ]; then
echo "✓ Kernel found"
cp "$BUILD_DIR/chroot/build/$BOARD/boot/vmlinuz"* "$IMAGE_OUT/" || true
else
echo "✗ No kernel found"
fi
# Try to use the build_image script if possible
if [ -f "$BUILD_DIR/src/scripts/build_image" ]; then
echo "Attempting to use build_image script..."
cd "$BUILD_DIR"
# Try without cros_sdk
export PATH="$BUILD_DIR/depot_tools:$PATH"
export BOARD="$BOARD"
# Create a wrapper that bypasses cros_sdk
cat > build_image_direct.sh << 'SCRIPT'
#!/bin/bash
# Direct image build bypassing cros_sdk
BOARD="${1:-terra_fydeos}"
echo "Building image for $BOARD"
# Set up environment
export PATH="/mnt/sdb/fydeos_build/depot_tools:$PATH"
export PYTHONPATH="/mnt/sdb/fydeos_build/chromite:$PYTHONPATH"
# Try to invoke build_image directly
python3 /mnt/sdb/fydeos_build/chromite/scripts/build_image.py \
--board="$BOARD" \
--noenable_rootfs_verification \
--build_root="/mnt/sdb/fydeos_build/chroot" \
--output_root="/mnt/sdb/fydeos_build/src/build/images/$BOARD/latest" \
dev || echo "Direct build_image failed"
SCRIPT
chmod +x build_image_direct.sh
./build_image_direct.sh "$BOARD"
else
echo "build_image script not found"
fi
# If build_image didn't work, create a minimal image manually
if [ ! -f "$IMAGE_OUT/chromiumos_image.bin" ] && [ ! -f "$IMAGE_OUT/fydeos_image.bin" ]; then
echo "Creating minimal bootable image manually..."
# Create a 4GB image file
IMAGE_FILE="$IMAGE_OUT/fydeos_terra_minimal.img"
dd if=/dev/zero of="$IMAGE_FILE" bs=1M count=4096 status=progress
# Create partitions (simplified GPT layout)
# This would need proper GPT partitioning for a real ChromeOS image
echo "Image file created at: $IMAGE_FILE"
echo "Note: This is a placeholder image. Proper partitioning needed for boot."
fi
echo "=========================================="
echo "Image Creation Summary"
echo "=========================================="
if [ -d "$IMAGE_OUT" ]; then
echo "Output directory contents:"
ls -lh "$IMAGE_OUT"
fi
echo ""
echo "Notes:"
echo "- Kernel is available at: $BUILD_DIR/chroot/build/$BOARD/boot/vmlinuz"
echo "- Packages built: $(ls $BUILD_DIR/chroot/build/$BOARD/packages/ | wc -l)"
echo ""
echo "Due to environment constraints, a full bootable image could not be created."
echo "To complete the build on a proper system:"
echo "1. Transfer this build directory to a native Linux system"
echo "2. Run: cros_sdk --enter"
echo "3. Run: build_image --board=$BOARD --noenable_rootfs_verification dev"