Skip to content

Commit

Permalink
Add generic image
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rzr committed Jan 14, 2021
1 parent 3469eec commit af2abc0
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions generic/debimage-generic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{{- $architecture := or .architecture "amd64" -}}
{{- $image := or .image "debian-generic.img" -}}
{{- $suite := or .suite "buster" -}}

architecture: {{$architecture}}

actions:

- action: debootstrap
suite: "{{$suite}}"
components:
- main
mirror: https://deb.debian.org/debian
variant: minbase

- action: apt
packages: [adduser, sudo, systemd-sysv]

- action: run
chroot: true
description: Set hostname
command: echo "{{$architecture}}" > /etc/hostname

- action: run
description: Set up user
chroot: true
command: >
/sbin/adduser --gecos user --disabled-password --shell /bin/bash user
&& /sbin/adduser user sudo
&& sh -c "echo 'user:user' | chpasswd"
- action: apt
packages: [
{{if eq $architecture "i386" "amd64"}}
grub-pc,
{{end}}
{{if eq $suite "buster" "stable"}}
{{if eq $architecture "i386"}}
linux-image-686
{{else}}
linux-image-{{$architecture}}
{{end}}
{{else}}
linux-image-generic
{{end}}
]

- action: image-partition
imagename: {{ $image }}
imagesize: 1GB
partitiontype: msdos
mountpoints:
- mountpoint: /
partition: root
partitions:
- name: root
fs: ext4
start: 1MiB
end: 100%
flags: [ boot ]

- action: filesystem-deploy
description: Deploying filesystem onto image

- action: run
description: Install bootloader
chroot: true
command: >
{{if eq $architecture "i386" "amd64"}}
update-grub
&& grub-install /dev/disk/by-id/virtio-fakedisk-0
{{end}}

0 comments on commit af2abc0

Please sign in to comment.