-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathrootfs.yaml
208 lines (173 loc) · 5.62 KB
/
rootfs.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
{{- $architecture := or .architecture "arm64" -}}
{{- $basename := or .basename "." -}}
{{- $extra_packages := or .extra_packages "" -}}
{{- $extra_firmware := or .extra_firmware "" -}}
{{- $linux_fw_version := or .linux_fw_version "" -}}
{{- $suite := or .suite "buster" -}}
{{- $script := or .script "scripts/nothing.sh" -}}
{{- $test_overlay := .test_overlay -}}
{{- $extra_packages_remove := or .extra_packages_remove -}}
{{- $extra_files_remove := or .extra_files_remove -}}
{{- $crush_image_options := or .crush_image_options "" -}}
{{- $debian_mirror := or .debian_mirror "http://deb.debian.org/debian" -}}
{{- $keyring_package := or .keyring_package "" -}}
{{- $keyring_file := or .keyring_file "" -}}
{{- $imagesize := or .imagesize "1GB" -}}
architecture: {{ $architecture }}
actions:
- action: debootstrap
suite: {{ $suite }}
components:
- main
mirror: {{ $debian_mirror }}
variant: minbase
keyring-package: {{ $keyring_package }}
keyring-file: {{ $keyring_file }}
- action: apt
recommends: false
packages:
- udev
- kmod
- dbus
- systemd-sysv
- diffutils
- usbutils
- initramfs-tools
- patch
- systemd-timesyncd
{{ if $extra_firmware }}
- rdfind
{{ end }}
{{ if $extra_firmware }}
- action: run
description: add firmware files
chroot: false
script: scripts/install-firmware.sh --ignore-duplicates -f {{ $extra_firmware }} {{ if $linux_fw_version }} -v {{ $linux_fw_version }} {{ end }}
{{ end }}
- action: run
description: Build testsuite
chroot: true
script: {{ $script }}
- action: run
description: Create manifest file
chroot: false
command: /usr/bin/env python3 ${RECIPEDIR}/scripts/create_manifest.py; rm -f ${ROOTDIR}/test_suites.json
- action: run
chroot: false
command: mkdir -p ${ARTIFACTDIR}/{{ $basename -}} ; cp ${ROOTDIR}/build_info.json ${ARTIFACTDIR}/{{ $basename -}}/build_info.json
- action: run
description: Install extra packages
chroot: true
command: DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends {{ $extra_packages }}
- action: run
description: Set hostname
chroot: true
command: echo debian-{{ $suite }}-{{ $architecture }} > /etc/hostname
- action: run
description: Remove root password
chroot: true
command: passwd root -d
- action: overlay
description: Tell agetty to log automatically on the serial console
source: overlays/auto-login
- action: overlay
description: Change prompt to '$(cwd) # '
source: overlays/prompt
- action: overlay
description: Add network configuration
source: overlays/networkd
- action: run
description: Setup networking
chroot: true
script: scripts/setup-networking.sh
- action: run
description: Change root shell to sh as bash will be dropped
chroot: true
command: chsh -s /bin/sh
- action: overlay
description: Add /var/tmp
source: overlays/minimal
- action: overlay
description: Disable suspend in systemd
source: overlays/nosuspend
{{ if $test_overlay }}
- action: overlay
description: Add test overlay {{ $test_overlay }}
source: {{ $test_overlay }}
{{ end }}
- action: run
description: Drop legacy /var/lib/dbus/machine-id generation
chroot: true
command: rm /usr/lib/tmpfiles.d/dbus.conf
- action: run
description: Set symbolic link to init
chroot: true
command: ln -s /usr/bin/systemd /init
- action: run
description: Clean installed package files
chroot: true
command: apt-get clean
- action: run
description: Create full archive
chroot: false
command: cd ${ROOTDIR} ; tar cvfJ ${ARTIFACTDIR}/{{ $basename -}}/full.rootfs.tar.xz .
- action: run
description: Create full cpio archive
chroot: false
command: cd ${ROOTDIR} ; find -H | cpio -H newc -v -o | gzip -9 -c - > ${ARTIFACTDIR}/{{ $basename -}}/full.rootfs.cpio.gz
- action: image-partition
imagename: rootfs.ext4
imagesize: {{ $imagesize }}
partitiontype: msdos
mountpoints:
- mountpoint: /
partition: root
partitions:
- name: root
fs: ext4
start: 0%
end: 100%
flags: [ boot ]
- action: filesystem-deploy
description: Deploying filesystem onto image
- action: run
description: Move image to output directory
command: mv ${ARTIFACTDIR}/rootfs.ext4 ${ARTIFACTDIR}/{{ $basename -}}/
postprocess: true
- action: run
command: xz -9 -T0 -f ${ARTIFACTDIR}/{{ $basename -}}/rootfs.ext4
postprocess: true
- action: run
description: update-initramfs step
chroot: true
script: scripts/create_initrd_ramdisk.sh
- action: run
chroot: false
command: mv ${ROOTDIR}/boot/initrd.img-min ${ARTIFACTDIR}/{{ $basename -}}/initrd.cpio.gz
- action: run
chroot: true
script: scripts/strip.sh
{{ if $extra_packages_remove }}
- action: run
description: remove extra packages
chroot: true
command: dpkg --purge --force-remove-essential --force-depends {{ $extra_packages_remove }}
{{ end }}
- action: run
chroot: true
script: scripts/crush.sh {{ $crush_image_options }}
{{ if $extra_files_remove }}
- action: run
description: remove extra files
chroot: true
command: |
for exp in {{ $extra_files_remove }}; do
for f in $(find . -name "$exp"); do
rm -rf "$f"
done
done
{{ end }}
- action: run
description: Create cpio archive
chroot: false
command: cd ${ROOTDIR} ; find -H | cpio -H newc -v -o | gzip -c - > ${ARTIFACTDIR}/{{ $basename -}}/rootfs.cpio.gz