-
Notifications
You must be signed in to change notification settings - Fork 2
/
resctl-demo-image-legacyboot.yaml
106 lines (91 loc) · 3.14 KB
/
resctl-demo-image-legacyboot.yaml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{{ $variant := or .variant "resctl-demo" }}
{{ $ospack := or .ospack (printf "%s-ospack" $variant) }}
{{ $image := or .image (printf "%s-image-legacyboot" $variant) }}
{{ $imagesize := or .imagesize "32GB" }}
{{ $cmdline := or .cmdline "root=LABEL=system console=tty0 console=ttyS0,115200n1 rootwait fsck.mode=auto fsck.repair=yes systemd.unified_cgroup_hierarchy=1 mem=16G" }}
{{ $pack := or .pack "true" }}
{{ $suite := or .suite "bookworm" }}
{{ $version := or .version "local" }}
architecture: amd64
actions:
- action: recipe
recipe: check-variant.yaml
variables:
variant: {{ $variant }}
- action: image-partition
imagename: {{ $image }}.img
imagesize: {{ $imagesize }}
partitiontype: msdos
mountpoints:
- mountpoint: /
partition: system
options:
- rw
- discard=async
- mountpoint: /boot
partition: boot
partitions:
- name: boot
fs: vfat
start: 2048s
end: 256M
flags: [ boot ]
- name: system
fs: btrfs
start: 256M
end: 100%
- action: filesystem-deploy
description: Deploy onto image
append-kernel-cmdline: {{ $cmdline }}
- action: unpack
file: {{ $ospack }}.tar.gz
- action: apt
description: Install kernel
packages:
- linux-image-amd64
- linux-headers-amd64
- action: run
description: Upgrade kernel to backports
chroot: true
command: |
echo "deb http://deb.debian.org/debian {{ $suite }}-backports main" > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get install --yes -t {{ $suite }}-backports linux-image-amd64
- action: overlay
description: Copy {{ $ospack }}.tar.gz into image
source: out/{{ $ospack }}.tar.gz
destination: resctl-demo-root.tar.gz
- action: run
description: Mount rootfs by LABEL instead of UUID
label: sed
command: |
# The first UUID will be from the image, the second UUID will be the root partition
UUID=$(blkid -o export ${IMAGE}* | grep "^UUID=" | sed -n 2p)
sed -i "s/${UUID}/LABEL=system/g" ${ROOTDIR}/etc/fstab
- action: run
description: Setup bootloader
label: scripts/setup-bootloader.sh
chroot: true
script: scripts/setup-bootloader.sh "i386-pc" "{{ $cmdline }}"
- action: run
description: Examine disk size
chroot: true
command: df -h / /boot
{{ if eq $pack "true" }}
- action: run
description: Convert {{ $image }}.img to {{ $image }}.vmdk
postprocess: true
command: qemu-img convert -f raw -O vmdk -o subformat=streamOptimized "$ARTIFACTDIR/{{ $image }}.img" "$ARTIFACTDIR/{{ $image }}.vmdk"
- action: run
description: Create block map for {{ $image }}.img
postprocess: true
command: bmaptool create "$ARTIFACTDIR/{{ $image }}.img" > "$ARTIFACTDIR/{{ $image }}.img.bmap"
- action: run
description: Compress {{ $image }}.img
postprocess: true
command: pigz -f "$ARTIFACTDIR/{{ $image }}.img"
- action: run
description: Checksum for {{ $image }}.img.gz
postprocess: true
command: sha256sum "$ARTIFACTDIR/{{ $image }}.img.gz" > "$ARTIFACTDIR/{{ $image }}.img.gz.sha256"
{{ end }}