{"id":17277768,"url":"https://github.com/sassman/rust-munich-meetup-5","last_synced_at":"2025-07-31T14:39:50.946Z","repository":{"id":137878025,"uuid":"338157576","full_name":"sassman/rust-munich-meetup-5","owner":"sassman","description":"Rust Munich Meetup #5 talk about unikernels and rusty-hermit","archived":false,"fork":false,"pushed_at":"2021-02-17T20:47:05.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T14:19:34.718Z","etag":null,"topics":["hermit","operating-system","qemu","rust","unikernel","virtualization"],"latest_commit_sha":null,"homepage":"https://youtu.be/-b1qTYv4EhE?t=218","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sassman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-11T21:29:00.000Z","updated_at":"2022-11-02T14:44:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"c58b73c8-3e8c-4f12-bcd6-fe84b0e2f2ae","html_url":"https://github.com/sassman/rust-munich-meetup-5","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sassman/rust-munich-meetup-5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Frust-munich-meetup-5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Frust-munich-meetup-5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Frust-munich-meetup-5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Frust-munich-meetup-5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sassman","download_url":"https://codeload.github.com/sassman/rust-munich-meetup-5/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassman%2Frust-munich-meetup-5/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268057415,"owners_count":24188619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hermit","operating-system","qemu","rust","unikernel","virtualization"],"created_at":"2024-10-15T09:09:55.162Z","updated_at":"2025-07-31T14:39:50.910Z","avatar_url":"https://github.com/sassman.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Munich Meetup - #5 Remote\n\nThis session is all about [Unikernels][1] and [rusty-hermit][2].\n\nFind the [slides online](https://docs.google.com/presentation/d/1Vscnq9QMO6hcSb0hxHcXLR-Zdb0OZNpZzbI9lEVycg8/edit?usp=sharing)\n\n## Intro\n\n\u003e containers where yesterday, today we'll package our web service as OS and run it directly on a hypervisor\n\n[![arch](https://rust-osdev.com/showcase/rusty-hermit/libos.png)][2]\n\nmaybe slides?\n\n## Setup\n### 0. Git Submodules!\nmake sure you have them all updated.\n\n```sh\ngit submodules init\ngit submodules update\n```\n\n### 0.1 Qemu + deps\nWe going to use Qemu as hypervisor, let's install it.\n\n\u003e Windows users [might look](https://github.com/hermitcore/rusty-loader/blob/master/.github/workflows/build.yml#L52) up their dependencies, sorry I have not tested it.\n\n#### Linux\n```sh\nsudo apt-get update --fix-missing \nsudo apt-get install qemu-system-x86 nasm\n```\n\n#### MacOS\n```sh\nbrew install qemu nasm\n```\n\n### 1. Rust nightly (handled by rust-toolchain file)\n\n\u003e Note: this is not needed, because rust checks the file `rust-toolchain` and make sure everything runs as defined in that file.\n\nfor completeness that is essentially whats happening:\n```sh\nrustup default nightly\nrustup component add rust-src llvm-tools-preview\n```\n\n### 1.2 Other crates\n\n```sh\ncargo install cargo-download\n```\n\n### 2. Build the loader (for qemu)\n```sh\ncd rusty-loader\nrelease=1 make\n```\n\n## Demo\n### Hello World\n```sh\ncd hello-hermit\ncargo run --release\n```\n\nWhat we should get is something like this:\n\n```plain\n[LOADER] Loader: [0x100000 - 0x31a018]\n[LOADER] Found Multiboot information at 0x9500\n[LOADER] Found module: [0x31c000 - 0x5113d0]\n[LOADER] Module length: 0x1f53d0\n[LOADER] Found an ELF module at 0x31c000\n[LOADER] Map 228 pages at 0x31c000 (page size 4 KByte)\n[LOADER] Map 1 pages at 0x400000 (page size 2048 KByte)\n....\n[0][INFO] ===================== MULTIPROCESSOR INFORMATION =====================\n[0][INFO] APIC in use:             xAPIC\n[0][INFO] Initialized CPUs:        1\n[0][INFO] ======================================================================\n[0][INFO]\n[0][INFO] Compiled with PCI support\n[0][INFO] Compiled with ACPI support\n[0][INFO] Compiled with SMP support\n[0][INFO] HermitCore is running on common system!\nHello World!\n[0][INFO] Number of interrupts\n[0][INFO] [0][7]: 1\n[0][INFO] Shutting down system\n```\n\n🚀 Congrats! The first application as OS has been launched\n\n\u003e NOTE: the demo project has a `.cargo/config` file that describes the target architecture, features and the runner, that is `qemu` in this case\n\n### Echo TCP Server\n\u003e Note: it's possible to use a tun network device, [here you can read more][3]\n\nWe are using here a port forwarded network setup. The echo server listens on port `8080`.\n\u003e Note: for this we need an additional feature to add: `dhcpv4`\n\n```sh\ncd echo-hermit\ncargo run --release\n```\n\nshould output something like:\n```plain\n    Finished release [optimized] target(s) in 0.06s\n     Running `qemu-system-x86_64 -device rtl8139,netdev=net0 -netdev 'user,id=net0,hostfwd=tcp::8080-:8080' -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr -display none -smp 1 -m 64M -serial stdio -kernel ../rusty-loader/target/x86_64-unknown-hermit-loader/release/rusty-loader -initrd target/x86_64-unknown-hermit/release/echo-hermit`\n[LOADER] Loader: [0x100000 - 0x31a018]\n[LOADER] Found Multiboot information at 0x9500\n...\n[0][INFO] Compiled with PCI support\n[0][INFO] Compiled with ACPI support\n[0][INFO] Compiled with SMP support\n[0][INFO] HermitCore is running on common system!\n[0][INFO] Found Realtek network device with device id 0x8139\n[0][INFO] RTL8139: CR = 0xd, ISR = 0x0, speed = 10 mbps\n[INFO] Spawn network thread with id 2\n[INFO] MAC address 52-54-00-12-34-56\n[INFO] MTU: 1500 bytes\n[INFO] Assigned a new IPv4 address: 10.0.2.15/24\n[INFO] Default gateway: 10.0.2.2\n[INFO] DNS servers:\n[INFO] - 10.0.2.3\n```\n\n#### testing\n```sh\ntelnet localhost 8080\nhello hermit\nhello hermit\n```\n\n## Bonus Track: RustyHermit on K8S \n\nWe won't cover that today, but there is a nice [wiki page about how](https://github.com/hermitcore/rusty-hermit/wiki/RustyHermit-on-K8S) \none can run RustyHermit on [KubeVirt](https://kubevirt.io).\n\n[1]: http://unikernel.org/\n[2]: https://rust-osdev.com/showcase/rusty-hermit/\n[3]: https://github.com/hermitcore/rusty-hermit/wiki/Advanced-Configuration-Features\n\n## References\n\n- [github/hermitcore](https://github.com/hermitcore)\n- [hermit/playground](https://raw.githubusercontent.com/hermitcore/hermit-playground/master/README.md)\n- [macos/tuntaposx/faq](http://tuntaposx.sourceforge.net/faq.xhtml)\n- [macos/qemu-bridging](https://www.dzombak.com/files/qemu-bridging-mavericks.pdf)\n- [qemu/networking](https://wiki.qemu.org/Documentation/Networking#Network_Backends)\n- [qemu/macos-specifics](https://www.emaculation.com/doku.php/ppc-osx-on-qemu-for-osx)\n\n## Appendix MacOS networking Cheat Sheet\n\n- remove a network bridge interface: `sudo ifconfig \u003cbridge01\u003e destroy`\n- create a tun interface: `brew install tuntap \u0026\u0026 sudo ifconfig tun0 create`\n- check route to host: `traceroute 10.0.5.3`\n- add a route to one (first) host via (second) gateway: `sudo route add 10.0.5.3 10.0.5.1`\n- qemu supported models: `qemu-system-x86_64 -nic model=help`\n\n## Appendix Tap Networking on Linux\n```sh\nsudo ip tuntap add tap10 mode tap\nsudo ip addr add 10.0.5.1/24 broadcast 10.0.5.255 dev tap10\nsudo ip link set dev tap10 up\nsudo bash -c 'echo 1 \u003e /proc/sys/net/ipv4/conf/tap10/proxy_arp'\n# sudo route add -net 10.0.5.0/24 gw 10.0.5.1\n```\n\n\u003e Note: when running qemu must provide the right network device with those options\n`qemu-system-x86_64` options:\n- `-netdev tap,id=net0,ifname=tap10,script=no,downscript=no,vhost=on`\n- `-device virtio-net-pci,netdev=net0,disable-legacy=on`\n- `-m 512M` memory needs to be at least `512M`\n\n\u003e Note: you can control the network properties via env variables\n\u003e `HERMIT_VERBOSE=1 HERMIT_IP=\"10.0.5.3\" HERMIT_GATEWAY=\"10.0.5.2\" HERMIT_MASK=\"255.255.255.0\" HERMIT_NETIF=bridge102 cargo run --release`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassman%2Frust-munich-meetup-5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsassman%2Frust-munich-meetup-5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassman%2Frust-munich-meetup-5/lists"}