Skip to content

Support bringing up block device as rootfs#295

Open
arihant2math wants to merge 11 commits into
hexagonal-sun:masterfrom
arihant2math:virtio-block
Open

Support bringing up block device as rootfs#295
arihant2math wants to merge 11 commits into
hexagonal-sun:masterfrom
arihant2math:virtio-block

Conversation

@arihant2math
Copy link
Copy Markdown
Collaborator

@arihant2math arihant2math commented May 11, 2026

  • Adds the concept of disks that can be mounted and unmounted (exposed in /dev).
  • Adds support for virtio disks drivers. This allows for bringing up large filesystems.
  • To allow for pivot_root to function this also required the implementation of pivot_root and unmount.

Running the following commands will mount the disk and switch to ubuntu:

mkdir /new-root
mount -t ext4 /dev/vda /new-root

# Create a mount point for the old root inside the new root
mkdir -p /new-root/old-root

cd /new-root

# Mount devfs in the new root so that console is available
mkdir -p dev
mount -t devfs devfs dev

pivot_root . old-root

# change to ubuntu
exec chroot . /bin/bash <dev/console >dev/console 2>&1

Future work:

  • intramfs?
  • Allow for directly loading from a disk.
  • Ubuntu's /bin/ls has some weird crashing issue involving segfaults and /bin/bash has issues with stack smashing.

@arihant2math arihant2math changed the title Support bringing up block rootfs Support bringing up block device as rootfs May 12, 2026
@arihant2math arihant2math marked this pull request as draft May 12, 2026 06:47
@arihant2math arihant2math marked this pull request as ready for review May 12, 2026 06:47
Comment thread src/arch/arm64/exceptions/syscall.rs
Comment thread src/drivers/virtio_hal.rs Outdated
Comment thread src/drivers/virtio_hal.rs Outdated
Comment thread src/drivers/virtio_hal.rs Outdated
Comment thread src/drivers/virtio_hal.rs Outdated
Comment thread src/fs/syscalls/pivot_root.rs Outdated
Comment thread src/fs/syscalls/umount.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants