Skip to content

Commit 645c875

Browse files
authored
Feature/drivers workflow (#3)
* add workflow to build drivers * first draft build drivers * fix name * fix targetted build * update deps * build lib first * add dep * Add libasound2-dev * try and pull files from built image * temp push tarball * only build 64bit * increase 64bit image size * fix extract * fix image name * update desc for build-drivers * update ref to runner.temp * dont generate hash by default * update task versions * update step names * remove gitversion steps * restore gitversion * fix job name * empty drive bin folder to ensure we are building new drivers * fix typo * update driver output path * allow building a specific commit * set fetch depth * move checkout location * revert * add 32bit drivers * set fetch depth * rename driver folder after extract * remove gitversion * add patchelf * add git dependency * install autoconf * correct path to osd driver file
1 parent 6e920ff commit 645c875

File tree

6 files changed

+71
-26
lines changed

6 files changed

+71
-26
lines changed

.github/actions/build-drivers/action.yml

+16-15
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,7 @@ inputs:
77

88
runs:
99
using: "composite"
10-
steps:
11-
- name: Install GitVersion
12-
uses: gittools/actions/gitversion/setup@v0
13-
with:
14-
versionSpec: '5.x'
15-
16-
- name: Determine Version
17-
id: gitversion
18-
uses: gittools/actions/gitversion/execute@v0
19-
10+
steps:
2011
- name: Install dependencies
2112
run: |
2213
sudo apt-get update
@@ -41,21 +32,31 @@ runs:
4132

4233
- name: Build driver image
4334
run: |
44-
sudo packer build -only ${{ inputs.build }} -var pspi_version=v${{ steps.gitversion.outputs.majorMinorPatch }} "$GITHUB_WORKSPACE/packer/"
35+
sudo packer build -only ${{ inputs.build }} "$GITHUB_WORKSPACE/packer/"
4536
working-directory: packer/plugins/packer-builder-arm
4637
shell: bash
4738

4839
- name: Extract drivers from image
4940
run: |
50-
mv PSPi6.Drivers.tar.gz $RUNNER_TEMP
41+
mv *.tar.gz $RUNNER_TEMP
5142
cd $RUNNER_TEMP
52-
tar --extract --file=PSPi6.Drivers.tar.gz ./packer/drivers/bin
43+
tar --extract --file=PSPi6.Drivers_32bit.tar.gz ./packer/drivers/bin
44+
mv ./packer/drivers/bin ./packer/drivers/bin_32
45+
tar --extract --file=PSPi6.Drivers_64bit.tar.gz ./packer/drivers/bin
46+
mv ./packer/drivers/bin ./packer/drivers/bin_64
5347
working-directory: packer/plugins/packer-builder-arm
5448
shell: bash
5549

5650
- name: Upload Artifact
5751
uses: actions/upload-artifact@v4
5852
with:
59-
name: drivers
60-
path: ${{ runner.temp }}/packer/drivers/bin/
53+
name: drivers_32bit
54+
path: ${{ runner.temp }}/packer/drivers/bin_32/
55+
if-no-files-found: error
56+
57+
- name: Upload Artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: drivers_64bit
61+
path: ${{ runner.temp }}/packer/drivers/bin_64/
6162
if-no-files-found: error

.github/workflows/build_drivers.yml

-9
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: Build Drivers
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
commit:
7-
description: 'Commit SHA1'
8-
required: false
9-
default: ''
10-
type: string
115
push:
126
pull_request:
137
branches:
@@ -18,9 +12,6 @@ jobs:
1812
runs-on: ubuntu-latest
1913
steps:
2014
- uses: actions/checkout@v4
21-
with:
22-
ref: ${{ inputs.commit == '' && github.sha || inputs.commit }}
23-
fetch-depth: 0
2415
- name: Build Drivers
2516
uses: ./.github/actions/build-drivers
2617
with:

packer/build.drivers.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ build {
22
name = "drivers"
33

44
sources = [
5+
"arm.drivers_raspios_lite_armhf",
56
"arm.drivers_raspios_lite_arm64"
67
]
78

packer/scripts/installers/build-drivers.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@
33
## File: build-drivers.sh
44
## Desc: Installs required dependencies for PSPi6 drivers & builds them
55
################################################################################
6+
set -x
67

78
# Install Dependencies
89
apt-get update
9-
apt-get install make libraspberrypi-dev raspberrypi-kernel-headers libpng-dev libasound2-dev -y
10+
apt-get install make libraspberrypi-dev raspberrypi-kernel-headers libpng-dev libasound2-dev git autoconf -y
1011

1112
cd /packer/drivers
1213
make clean
1314
make all
15+
16+
# Build patchelf
17+
git clone https://github.com/NixOS/patchelf.git
18+
cd patchelf
19+
./bootstrap.sh
20+
./configure
21+
make
22+
make check
23+
make install
24+
25+
# Patch OSD Driver
26+
patchelf --replace-needed libbcm_host.so.0 libbcm_host.so ../bin/osd

packer/sources.drivers.pkr.hcl

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
1+
source "arm" "drivers_raspios_lite_armhf" {
2+
file_urls = ["https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2023-12-11/2023-12-11-raspios-bookworm-armhf-lite.img.xz"]
3+
file_checksum_url = "https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2023-12-11/2023-12-11-raspios-bookworm-armhf-lite.img.xz.sha256"
4+
file_checksum_type = "sha256"
5+
file_target_extension = "xz"
6+
file_unarchive_cmd = ["xz", "--decompress", "$ARCHIVE_PATH"]
7+
image_build_method = "resize"
8+
image_path = "PSPi6.Drivers_32bit.tar.gz"
9+
image_size = "3G"
10+
image_type = "dos"
11+
12+
# configure boot partition
13+
image_partitions {
14+
name = "boot"
15+
type = "c"
16+
start_sector = "8192"
17+
filesystem = "vfat"
18+
size = "512M"
19+
mountpoint = "/boot"
20+
}
21+
22+
# configure root partition
23+
image_partitions {
24+
name = "root"
25+
type = "83"
26+
start_sector = "1056768"
27+
filesystem = "ext4"
28+
size = "0"
29+
mountpoint = "/"
30+
}
31+
32+
image_chroot_env = ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"]
33+
34+
# qemu binary paths
35+
qemu_binary_source_path = "/usr/bin/qemu-arm-static"
36+
qemu_binary_destination_path = "/usr/bin/qemu-arm-static"
37+
}
38+
139
source "arm" "drivers_raspios_lite_arm64" {
240
file_urls = ["https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz"]
341
file_checksum_url = "https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz.sha256"
442
file_checksum_type = "sha256"
543
file_target_extension = "xz"
644
file_unarchive_cmd = ["xz", "--decompress", "$ARCHIVE_PATH"]
745
image_build_method = "resize"
8-
image_path = "PSPi6.Drivers.tar.gz"
46+
image_path = "PSPi6.Drivers_64bit.tar.gz"
947
image_size = "3G"
1048
image_type = "dos"
1149

packer/variables.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
variable "pspi_version" {
22
type = string
3+
default = "0.0.0"
34
}

0 commit comments

Comments
 (0)