Skip to content

Commit 2917a6a

Browse files
committed
create a boot image for httpd
Build a boot image, which helps to run Hermit with a classical could infrastructure.
1 parent 46343a2 commit 2917a6a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@ on:
44
push:
55
branches:
66
- main
7+
- uefi
78

89
env:
910
GH_TOKEN: ${{ github.token }}
1011
CARGO_TERM_COLOR: always
1112

13+
defaults:
14+
run:
15+
shell: bash
16+
1217
jobs:
1318
publish_image:
1419
name: Publish container image
1520
runs-on: ubuntu-latest
1621

1722
steps:
23+
- name: Install Packages
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y fdisk qemu-utils
1827
- uses: actions/checkout@v6
1928
with:
2029
submodules: true
@@ -32,6 +41,7 @@ jobs:
3241
run: |
3342
gh release download --repo hermit-os/loader --pattern hermit-loader-x86_64
3443
gh release download --repo hermit-os/loader --pattern hermit-loader-x86_64-fc
44+
gh release download --repo hermit-os/loader --pattern hermit-loader-x86_64.efi
3545
- name: Create dockerfile for rusty_demo
3646
run: |
3747
cat << END > Dockerfile
@@ -47,6 +57,27 @@ jobs:
4757
context: .
4858
push: true
4959
tags: ghcr.io/hermit-os/rusty_demo:latest
60+
- name: Build httpd
61+
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit -p httpd --features hermit/dhcpv4,hermit/virtio-net --release
62+
- name: Create bootable image for httpd
63+
run: |
64+
dd if=/dev/zero of=httpd.raw bs=1k count=1M conv=sparse
65+
echo "label: gpt" > partition_table.txt
66+
echo ",,U,*;" >> partition_table.txt # UEFI System Partition
67+
sfdisk --no-reread -f httpd.raw < partition_table.txt
68+
sudo losetup -fP httpd.raw
69+
lsblk
70+
sudo mkfs.fat -F32 /dev/loop0p1
71+
sudo mkdir -p /mnt/esp
72+
sudo mount /dev/loop0p1 /mnt/esp
73+
sudo mkdir -p /mnt/esp/efi/boot
74+
sudo cp target/x86_64-unknown-hermit/release/httpd /mnt/esp/efi/boot/hermit-app
75+
sudo cp hermit-loader-x86_64.efi /mnt/esp/efi/boot/bootx64.efi
76+
sudo umount /mnt/esp
77+
sudo losetup -d /dev/loop0
78+
tar --format=oldgnu -Sczf httpd.tar.gz httpd.raw
79+
qemu-img convert -f raw -O qcow2 httpd.raw httpd.qcow2
80+
gh release create v0.0.1 --draft --notes 'UEFI disk images to boot Hermit-OS applications' --title 'httpd disk images' httpd.qcow2 httpd.tar.gz
5081
- name: Build httpd
5182
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit -p httpd --features hermit/dhcpv4 --release
5283
- name: Copy httpd out of target dir

0 commit comments

Comments
 (0)