Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions kernel/src/drivers/virtio/gpu_pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,11 @@ pub fn init() -> Result<(), &'static str> {
Err(e) => crate::serial_println!("[virtio-gpu-pci] GET_DISPLAY_INFO failed: {}", e),
}

// Use the display-reported resolution if it's reasonable, otherwise
// fall back to our default. This respects the actual Parallels display
// mode instead of forcing a resolution that may be ignored.
let (use_width, use_height) = match display_dims {
Ok((w, h)) if w >= 640 && h >= 480 && w <= FB_MAX_WIDTH && h <= FB_MAX_HEIGHT => (w, h),
_ => (DEFAULT_FB_WIDTH, DEFAULT_FB_HEIGHT),
};
// Always use our configured resolution. GET_DISPLAY_INFO reports the
// Parallels native display (e.g. 2560x1600 on Retina), but we want to
// control the rendering resolution for performance. The VirtIO GPU
// SET_SCANOUT will tell Parallels to use our chosen resolution.
let (use_width, use_height) = (DEFAULT_FB_WIDTH, DEFAULT_FB_HEIGHT);

// Update state with actual dimensions
unsafe {
Expand Down
29 changes: 22 additions & 7 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ if [ "$PARALLELS" = true ]; then
EXT2_HDD_DIR="$PARALLELS_DIR/breenix-ext2.hdd"
EXT2_DISK="$BREENIX_ROOT/target/ext2-aarch64.img"

# Stop VM BEFORE building/creating disks — if the VM is still running,
# rm -rf on the HDD directory may fail to clean locked .hds files,
# causing stale disk images to be deployed.
VM_STATUS=$(prlctl status "$PARALLELS_VM" 2>/dev/null | awk '{print $NF}')
if [ "$VM_STATUS" = "running" ] || [ "$VM_STATUS" = "paused" ] || [ "$VM_STATUS" = "suspended" ] || [ "$VM_STATUS" = "stopping" ]; then
echo "Stopping VM before build..."
prlctl stop "$PARALLELS_VM" --kill 2>/dev/null || true
# Wait until fully stopped
while ! prlctl status "$PARALLELS_VM" 2>/dev/null | grep -q stopped; do
sleep 1
done
echo "VM stopped."
fi

if [ "$NO_BUILD" = true ]; then
echo "Skipping builds (--no-build)"
if [ ! -d "$HDD_DIR" ]; then
Expand All @@ -174,6 +188,13 @@ if [ "$PARALLELS" = true ]; then
exit 1
fi
else
# Clean build caches if --clean was specified
if [ "$CLEAN" = true ]; then
echo "[0/6] Cleaning build caches..."
cargo clean -p kernel 2>/dev/null || true
cargo clean -p parallels-loader 2>/dev/null || true
fi

# Build the UEFI loader
echo "[1/6] Building UEFI loader..."
cargo build --release --target aarch64-unknown-uefi -p parallels-loader
Expand Down Expand Up @@ -292,13 +313,7 @@ if [ "$PARALLELS" = true ]; then
prlctl set "$PARALLELS_VM" --cpus 4
fi

# Stop VM if running
VM_STATUS=$(prlctl status "$PARALLELS_VM" 2>/dev/null | awk '{print $NF}')
if [ "$VM_STATUS" = "running" ] || [ "$VM_STATUS" = "paused" ] || [ "$VM_STATUS" = "suspended" ]; then
echo "Stopping VM..."
prlctl stop "$PARALLELS_VM" --kill 2>/dev/null || true
sleep 2
fi
# VM was already stopped before the build (see above)

# Configure VM: EFI boot, remove all SATA devices (hdds + cdroms), attach our disks
prlctl set "$PARALLELS_VM" --efi-boot on 2>/dev/null || true
Expand Down
Loading