-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathraspberrypi.yaml
124 lines (108 loc) · 4.33 KB
/
raspberrypi.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
{{- $firmware_version := or .firmware_version "master" -}}
{{- $architecture := or .architecture "arm64" -}}
{{- $image := or .image "ubuntu-touch-raspberrypi.img" -}}
{{- $debug := or .debug "on" -}}
architecture: {{ $architecture }}
actions:
# Include mainline-rootfs-core.yaml and in that file mainline-rootfs-mods.yaml is included
- action: recipe
description: Setup core rootfs
recipe: mainline-rootfs-core.yaml
variables:
architecture: {{ $architecture }}
debug: {{ $debug }}
# Add the linux-firmware package
- action: recipe
description: Setup core rootfs
recipe: mainline-rootfs-firmware.yaml
variables:
architecture: {{ $architecture }}
# cp root/etc/mke2fs.conf /etc/mke2fs.conf
- action: run
description: Copy mke2fs config
script: scripts/copy-rootfs-mke2fs.sh
# Download the lastest raspberry pi https://github.com/raspberrypi/firmware
- action: download
description: Download latest version of the firmware from GitHub
url: https://github.com/raspberrypi/firmware/archive/{{ $firmware_version }}.tar.gz
unpack: true
name: firmware
# Create image partitions for the image.
# /boot/firmware for the device tree blobs and so on. The Device Tree Blob gets loaded by the bootloader and parsed bythe kernel at boot time.
# / for the linux filesystem
- action: image-partition
imagename: {{ $image }}
imagesize: 4GB
partitiontype: msdos
mountpoints:
- mountpoint: /
partition: root
- mountpoint: /boot/firmware
partition: firmware
partitions:
- name: firmware
fs: fat32
start: 0%
end: 200MB
- name: root
fs: ext4
start: 200MB
end: 100%
flags: [ boot ]
# Deploying filesystem into image
- action: filesystem-deploy
description: Deploying filesystem into image
# Setting egl libs to use mesa (https://www.mesa3d.org/egl.html)
- action: run
chroot: true
description: Setting egl libs to use mesa
script: scripts/enable-mesa.sh
# Copy firmware/boot from github to the image /boot/modules
- action: overlay
origin: firmware
source: firmware-{{ $firmware_version }}/boot
destination: /boot/firmware
# Copy firmware/modules from github to the image /lib/modules
- action: overlay
origin: firmware
source: firmware-{{ $firmware_version }}/modules
destination: /lib/modules
# Copy raspberry-pi folder with cmdline.txt and config.txt in /boot/firmware/
- action: overlay
source: raspberry-pi/
destination: /
# Copy ubportspiblobs_0.1-0.deb to the image file system
# brcmfmac43430-sdio.clm_blob, brcmfmac43430-sdio.txt, brcmfmac43455-sdio.clm_blob and brcmfmac43455-sdio.txt
- action: overlay
description: Copying linux firmwares to rootfs
source: files/ubportspiblobs_0.1-0.deb
destination: /var/tmp/ubportspiblobs_0.1-0.deb
# Installing ubportspiblobs_0.1-0.deb this to add the additional files which are not included in linux-firmware_1.183.1_all.deb:
# brcmfmac43430-sdio.clm_blob, brcmfmac43430-sdio.txt, brcmfmac43455-sdio.clm_blob and brcmfmac43455-sdio.txt
- action: run
chroot: true
description: Installing linux firmwares
label: dpkg
command: dpkg -i /var/tmp/*.deb && rm /var/tmp/* -r
# Depmod program to generate modules.dep and map files of the frimware.
#"$(find /lib/modules -type d -name "*-v8+" | grep -oE "[^/]+$")" -> looks like "4.19.73-v8+" depending on the github version
- action: run
chroot: true
command: depmod -a "$(find /lib/modules -type d -name "*-v8+" | grep -oE "[^/]+$")"
# The update-initramfs script manages your initramfs images on your local box. It keeps track of the existing initramfs archives in /boot.
# -c This mode creates a new initramfs.
# -k Set the specific kernel version for whom the initramfs will be generated.
- action: run
chroot: true
command: kernelversion=$(find /lib/modules -type d -name "*-v8+" | grep -oE "[^/]+$") && update-initramfs -c -k "$kernelversion" -b /boot/firmware && sed -i "s/initrd.img/initrd.img-$kernelversion/g" /boot/firmware/config.txt
- action: run
chroot: true
description: Set uart tty
label: uart
command: sed -i 's/ttyS0/ttyAMA0/g' /etc/init/ttyS0.conf
- action: recipe
description: Polish the image
recipe: polish.yaml
variables:
architecture: {{ $architecture }}
image: {{ $image }}