-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-on-firecracker.sh
More file actions
executable file
·62 lines (51 loc) · 1.83 KB
/
Copy pathrun-on-firecracker.sh
File metadata and controls
executable file
·62 lines (51 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!bash
set -e
echo "Prerequisites: you first have to create the tap device, like this :"
echo "sudo ip tuntap add tapfc1 mode tap"
echo "Elsewhere run :"
echo "sudo setfacl -m u:${USER}:rw /dev/kvm"
echo "(rm /tmp/firecracker.socket || echo 'nothing to delete') && firecracker"
echo ""
echo Running ArnOs on Firecracker...
curl --unix-socket /tmp/firecracker.socket -i \
-X PUT 'http://localhost/boot-source' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"kernel_image_path": "'$(pwd)'/target/arn_os-target/debug/arn_os",
"boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
}'
curl --unix-socket /tmp/firecracker.socket -i \
-X PUT 'http://localhost/logger' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"log_fifo": "/dev/stdout",
"metrics_fifo": "/dev/null"
}'
curl --unix-socket /tmp/firecracker.socket -i \
-X PUT 'http://localhost/network-interfaces/iface_1' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"iface_id": "iface_1",
"host_dev_name": "tapfc1",
"guest_mac": "06:00:c0:a8:34:02"
}'
curl --unix-socket /tmp/firecracker.socket -i -X GET 'http://localhost/machine-config'
curl --unix-socket /tmp/firecracker.socket -i \
-X PUT 'http://localhost/actions' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"action_type": "InstanceStart"
}'
echo all commands sent
sleep 5
curl --unix-socket /tmp/firecracker.socket -i \
-X PUT 'http://localhost/actions' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"action_type": "SendCtrlAltDel"
}'