-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (44 loc) · 1.27 KB
/
Makefile
File metadata and controls
44 lines (44 loc) · 1.27 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
build:
go build -o bin/docker2boot
image:
docker build --iidfile .iid .
docker tag $(shell cat .iid) binc/d2b:v$(shell cat VERSION)
push:
docker push binc/d2b:v$(shell cat VERSION)
run:
# enable for debug guestfish
# export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
#bin./docker2boot -image binc/myos:latest -debug
bin./docker2boot -config config.yaml -debug
test:
# check partitions
guestfish add disk.img : run : list_partitions
# check contents on boot /dev/sda2
mkdir -p ./mnt/boot
mkdir -p ./mnt/root
guestmount -a disk.img -m /dev/sda2 ./mnt/boot
ls ./mnt/boot
# check contents on root /dev/sda3
guestmount -a disk.img -m /dev/sda3 ./mnt/root
ls ./mnt/root
# boot the disk
boot:
# create a qcow on top of the raw
qemu-img create -f qcow2 -b disk.img disk.qcow2 5G
# create local datesource of cloud-init
echo "#cloud-config\nhostname: devicu\n" > user_data
cloud-localds config.img user_data
qemu-system-x86_64 -nographic -serial mon:stdio --enable-kvm -m 2G \
-netdev user,id=mynet0 \
-device e1000,netdev=mynet0 \
-drive file=disk.qcow2,if=virtio,format=qcow2 \
-drive file=config.img,if=virtio,format=raw
clean:
rm bin/docker2boot
rm *.tar -f
rm disk.img -f
rm disk.qcow2 -f
rm config.img -f
guestunmount ./mnt/boot
guestunmount ./mnt/root
rm ./mnt -f