forked from alexellis/firecracker-init-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.sh
executable file
·49 lines (42 loc) · 1.62 KB
/
boot.sh
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
#!/bin/bash
# Configure our custom init process, change to /sbin/init to
# use the one that ships with the rootfs
# Also sets the network IP address statically, via a kernel parameter
sudo 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\": \"./vmlinux\",
\"boot_args\": \"console=ttyS0 reboot=k panic=1 pci=off init=/init ip=172.16.0.2::172.16.0.1:255.255.255.0::eth0:off\"
}"
# Configure a network device, notice the host_dev_name macthes what
# we set in setup_networking.sh
sudo curl -X PUT \
--unix-socket /tmp/firecracker.socket \
'http://localhost/network-interfaces/eth0' \
-H accept:application/json \
-H content-type:application/json \
-d '{
"iface_id": "eth0",
"host_dev_name": "ftap0"
}'
# Configure the first drive, pointing at our disk image
sudo curl --unix-socket /tmp/firecracker.socket -i \
-X PUT 'http://localhost/drives/rootfs' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d "{ \
\"drive_id\": \"rootfs\",
\"path_on_host\": \"./rootfs.img\",
\"is_root_device\": true,
\"is_read_only\": false
}"
# Boot the VM
sudo 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"
}'