Skip to content

Commit af2abc0

Browse files
committed
Add generic image
This image can be used as reference "generic" image for any architectures supported by debian. Boot on PC (x86 or x86_64) is supported thanks to grub, extra tweaking might be needed to boot other architectures on virtual machines. For the record, this is inspired from recipes I wrote for emilia pinball. Change-Id: I709a456f196df337c3f368f03416defe6aadcb0b Signed-off-by: Philippe Coval <[email protected]>
1 parent 3469eec commit af2abc0

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

generic/debimage-generic.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{{- $architecture := or .architecture "amd64" -}}
2+
{{- $image := or .image "debian-generic.img" -}}
3+
{{- $suite := or .suite "buster" -}}
4+
5+
architecture: {{$architecture}}
6+
7+
actions:
8+
9+
- action: debootstrap
10+
suite: "{{$suite}}"
11+
components:
12+
- main
13+
mirror: https://deb.debian.org/debian
14+
variant: minbase
15+
16+
- action: apt
17+
packages: [adduser, sudo, systemd-sysv]
18+
19+
- action: run
20+
chroot: true
21+
description: Set hostname
22+
command: echo "{{$architecture}}" > /etc/hostname
23+
24+
- action: run
25+
description: Set up user
26+
chroot: true
27+
command: >
28+
/sbin/adduser --gecos user --disabled-password --shell /bin/bash user
29+
&& /sbin/adduser user sudo
30+
&& sh -c "echo 'user:user' | chpasswd"
31+
32+
- action: apt
33+
packages: [
34+
{{if eq $architecture "i386" "amd64"}}
35+
grub-pc,
36+
{{end}}
37+
{{if eq $suite "buster" "stable"}}
38+
{{if eq $architecture "i386"}}
39+
linux-image-686
40+
{{else}}
41+
linux-image-{{$architecture}}
42+
{{end}}
43+
{{else}}
44+
linux-image-generic
45+
{{end}}
46+
]
47+
48+
- action: image-partition
49+
imagename: {{ $image }}
50+
imagesize: 1GB
51+
partitiontype: msdos
52+
mountpoints:
53+
- mountpoint: /
54+
partition: root
55+
partitions:
56+
- name: root
57+
fs: ext4
58+
start: 1MiB
59+
end: 100%
60+
flags: [ boot ]
61+
62+
- action: filesystem-deploy
63+
description: Deploying filesystem onto image
64+
65+
- action: run
66+
description: Install bootloader
67+
chroot: true
68+
command: >
69+
{{if eq $architecture "i386" "amd64"}}
70+
update-grub
71+
&& grub-install /dev/disk/by-id/virtio-fakedisk-0
72+
{{end}}

0 commit comments

Comments
 (0)