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
Forwarded: #20
Signed-off-by: Philippe Coval <[email protected]>
  • Loading branch information
rzr committed Mar 1, 2021
1 parent 3469eec commit 0409307
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions generic/debimage-generic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{- $architecture := or .architecture "amd64" -}}
{{- $image := or .image "debian-generic.img" -}}
{{- $kernel := or .kernel "linux-image-generic" -}}
{{- $suite := or .suite "buster" -}}

{{if eq $suite "buster" "stable"}}
{{if eq $architecture "i386"}}
{{ $kernel = or .kernel "linux-image-686"}}
{{else}}
{{$kernel = or .kernel (printf "linux-image-%s" $architecture)}}
{{end}}
{{end}}


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 "debian" > /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}}
$kernel
]

- 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 0409307

Please sign in to comment.