Skip to content

arm64: enable virtio-net and add network scripts #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

otischung
Copy link

@otischung otischung commented Jun 30, 2025

Enable POSIX timers to support ping’s POSIX timer syscalls:

  • CONFIG_POSIX_TIMERS=y in configs/linux-arm64.config

Enable network stack and virtio-net in kernel config:

  • CONFIG_NET, CONFIG_INET, CONFIG_IP_MULTICAST, CONFIG_IP_PNP
  • CONFIG_IP_PNP_DHCP, CONFIG_NETDEVICES, CONFIG_VIRTIO
  • CONFIG_VIRTIO_NET, CONFIG_VIRTIO_RING, CONFIG_UNIX
  • CONFIG_UNIX_SCM, CONFIG_AF_UNIX_OOB

Add virtio_net_dev to FDT generation:

  • src/arch/arm64/vm.c: include virtio_net_dev in interrupt-map

Define VIRTIO_NET_IRQ=2 (SPI 34) in src/arch/arm64/desc.h

Add scripts for host and guest network setup:

  • scripts/set-host-bridge.sh to configure TAP bridge and default route
  • scripts/set-guest-route.sh to configure guest static IP and route

Update README.md with new scripts and build instructions

These changes have been validated on a Raspberry Pi 5 Model B
(Revision 1.0) running Ubuntu 25.10 with Linux kernel version 6.14.0.

Copy link

@visitorckw visitorckw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since patch 3 fixes a typo introduced in patch 1 of this PR, please squash patch 3 into patch 1 using git rebase -i to keep the history clean.

otischung added 2 commits July 1, 2025 21:06
Enable POSIX timers to support ping’s POSIX timer syscalls:
- CONFIG_POSIX_TIMERS=y in configs/linux-arm64.config

Enable network stack and virtio-net in kernel config:
- CONFIG_NET, CONFIG_INET, CONFIG_IP_MULTICAST, CONFIG_IP_PNP
- CONFIG_IP_PNP_DHCP, CONFIG_NETDEVICES, CONFIG_VIRTIO
- CONFIG_VIRTIO_NET, CONFIG_VIRTIO_RING, CONFIG_UNIX
- CONFIG_UNIX_SCM, CONFIG_AF_UNIX_OOB

Add virtio_net_dev to FDT generation:
- src/arch/arm64/vm.c: include virtio_net_dev in interrupt-map

Define VIRTIO_NET_IRQ=2 (SPI 34) in src/arch/arm64/desc.h

Add scripts for host and guest network setup:
- scripts/set-host-bridge.sh to configure TAP bridge and default route
- scripts/set-guest-route.sh to configure guest static IP and route

Update README.md with new scripts and build instructions

These changes have been validated on a Raspberry Pi 5 Model B
(Revision 1.0) running Ubuntu 25.10 with Linux kernel version 6.14.0.
The previous URL of The Linux/x86 Boot Protocol returned a 404 error
due to an incorrect origin.
Updated the link to point to the correct resource.

References:
- The Linux/x86 Boot Protocol:
  https://www.kernel.org/doc/html/latest/arch/x86/boot.html
@otischung otischung force-pushed the feat/arm64-support branch from b8bb89c to 60835d6 Compare July 1, 2025 13:14
@otischung
Copy link
Author

Many thanks to @visitorckw.

I rebased the branch, interchanged patches 2 and 3, flagged patch 2 for squashing, and force-pushed the result. Please examine the changes at your convenience.

@@ -42,8 +44,63 @@ containing concatenated `bootsect.o + setup.o + misc.o + piggy.o`. `initrd` is t
initial RAM disk image, which is an optional argument.
`disk-image` is the path to disk image which can be mounted as a block device via virtio. For the reference Linux guest, ext4 filesystem is used for disk image.

### Stop Emulator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is meant to "stop" the emulation. Instead, the operation is dedicated to "exit" from the execution loop.

Comment on lines +78 to +80
CONFIG_UNIX=y
CONFIG_UNIX_SCM=y
CONFIG_AF_UNIX_OOB=y
Copy link
Contributor

@jserv jserv Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm if they are needed or not.

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.

3 participants