Skip to content

Commit

Permalink
Add the base for creating a vendor example using infix
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiaswal committed Jan 26, 2025
0 parents commit 94865a7
Show file tree
Hide file tree
Showing 16 changed files with 986 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Bob the Builder

on:
#pull_request:
#push:
# branches:
# - main
workflow_dispatch:

jobs:
build:
if: ${{github.ref_name == 'main' && github.event_name == 'push'}} || github.event_name == 'workflow_dispatch'
name: Vendor example build [${{ matrix.platform }}]
runs-on: [self-hosted, latest]
strategy:
matrix:
platform: [aarch64, x86_64]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: recursive

- name: Set Build Variables
id: vars
run: |
target=${{ matrix.platform }}
echo "dir=vendor-example-$target" >> $GITHUB_OUTPUT
echo "tgz=vendor-example-$target.tar.gz" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v4
with:
path: dl/
key: dl-${{ matrix.platform }}-${{ hashFiles('.git/modules/infix/refs/heads/main', 'configs/*') }}
restore-keys: |
dl-${{ matrix.platform }}-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ hashFiles('.git/modules/infix/refs/heads/main', 'configs/*') }}
restore-keys: |
ccache-${{ matrix.platform }}-
ccache-
- name: Configure & Build
run: |
target=${{ matrix.platform }}_vendor_example_defconfig
echo "Buildring $target ..."
make $target
make
- name: Prepare Artifact
run: |
cd output
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- uses: actions/upload-artifact@v4
with:
path: output/${{ steps.vars.outputs.tgz }}
name: artifact-${{ matrix.platform }}

release:
if: github.repository == 'kernelkit/vendor-example' && github.ref == 'refs/heads/main'
permissions: write-all
name: Upload Latest Build
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitName: true
omitBody: true
omitBodyDuringUpdate: true
prerelease: true
tag: "latest"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "*.tar.gz"
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
# Latest Build Complete! :rocket:
For the public download links of these build artifacts, please see:
<https://github.com/kernelkit/vendor-example/releases/tag/latest>
EOF
110 changes: 110 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Release General

on:
push:
tags:
- 'v[0-9]*.*'
workflow_dispatch:
inputs:
version:
required: false
type: string

jobs:
build:
name: Building Vendor Example Reference Release ${{ github.ref_name }} [${{ matrix.platform }}]
runs-on: [self-hosted, release]
strategy:
matrix:
platform: [aarch64, x86_64]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: recursive

- name: Set Release Variables
id: vars
run: |
if [ -n "${{ inputs.version }}" ]; then
ver=${{ inputs.version }}
else
ver=${GITHUB_REF#refs/tags/v}
fi
echo "ver=${ver}" >> $GITHUB_OUTPUT
if echo $ver | grep -qE '[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then
echo "pre=true" >> $GITHUB_OUTPUT
else
echo "pre=false" >> $GITHUB_OUTPUT
fi
target=${{ matrix.target }}-${ver}
echo "dir=dcp-sc-28p-$target" >> $GITHUB_OUTPUT
echo "tgz=dcp-sc-28p-$target.tar.gz" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v4
with:
path: dl/
key: dl-${{ matrix.platform }}-${{ hashFiles('.git/modules/infix/refs/heads/main', 'configs/*') }}
restore-keys: |
dl-${{ matrix.platform }}-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ hashFiles('.git/modules/infix/refs/heads/main', 'configs/*') }}
restore-keys: |
ccache-${{ matrix.platform }}-
ccache-
- name: Configure & Build
env:
INFIX_RELEASE: ${{ steps.vars.outputs.ver }}
run: |
target=${{ matrix.platform }}_minimal_defconfig
echo "Buildring $target ..."
make $target
make
- name: Prepare Artifact
run: |
cd output
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- uses: actions/upload-artifact@v4
with:
path: output/${{ steps.vars.outputs.tgz }}
name: artifact-${{ matrix.platform }}

release:
name: Release Infix / Vendor Example ${{ github.ref_name }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- name: Extract ChangeLog entry ...
run: |
awk '/-----*/{if (x == 1) exit; x=1;next}x' doc/ChangeLog.md \
|head -n -1 > release.md
cat release.md
- uses: ncipollo/release-action@v1
with:
name: Vendor example Reference Release ${{ github.ref_name }}
prerelease: ${{ needs.vars.outputs.pre }}
bodyFile: release.md
artifacts: "*.tar.gz*"
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
For the public download links of this release, please see:
<https://github.com/kernelkit/vendor-example/releases/tag/${{ github.ref_name }}>
EOF
57 changes: 57 additions & 0 deletions .github/workflows/sync-infix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Automatically sync Infix

on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
permissions:
contents: write

jobs:
commit:
runs-on: [ self-hosted, latest ]
if: ${{ env.SYNC_INFIX }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.COMMIT_TOKEN }}
fetch-depth: 0
submodules: true

- name: Check for updates on infix and commit them
run: |
git config --global user.name 'Wires bot'
git config --global user.email 'noreply@wires.se'
CHANGES=0
if git ls-remote --heads origin latest | grep -q latest; then
echo "Latest exists, checking out"
git checkout latest
git submodule update --init --recursive
else
echo "Latest does not exist, create it"
git checkout -b latest
fi
cd infix
git checkout main
git pull origin main
cd ..
if [[ -n "$(git diff --exit-code infix)" ]]; then
git add infix
git commit infix -m "Step up infix"
CHANGES=1
fi
make defconfigs-generate
if [[ -n "$(git diff --exit-code configs)" ]]; then
git add configs
git commit configs/ -m "Update defconfigs"
CHANGES=1
fi
if [ $CHANGES -eq 1 ]; then
git push origin latest
fi
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*~
/.ccache
/dl
/output*
/local.mk
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "infix"]
path = infix
url = git@github.com:kernelkit/infix.git
1 change: 1 addition & 0 deletions Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#source "$BR2_EXTERNAL_VENDOR_EXAMPLE_PATH/package/Config.in"
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
export BR2_EXTERNAL := $(CURDIR)/infix:$(CURDIR)

ARCH ?= $(shell uname -m)
O ?= $(CURDIR)/output

config := $(O)/.config
bmake = $(MAKE) -C infix/buildroot O=$(O) $1
imake = $(MAKE) -C infix O=$(O) $1


all: $(config) infix/buildroot/Makefile
@+$(call bmake,$@)

$(config):
@+$(call bmake,list-defconfigs)
@echo "ERROR: No configuration selected."
@echo "Please choose a configuration from the list above by running"
@echo "'make <board>_defconfig' before building an image."
@exit 1

%_defconfig: configs/%_defconfig
@+$(call bmake,$@)

%: | infix/buildroot/Makefile
@+$(call bmake,$@)

infix/buildroot/Makefile:
@git submodule update --init --recursive

.PHONY: all

.PHONY: test

test:
$(call imake,test)

test-spec:
$(call imake,test-spec)

defconfigs-generate:
./infix/utils/generate-defconfig.sh -b infix/configs/aarch64_defconfig -c config-snippets/vendor.conf -o configs/aarch64_defconfig
./infix/utils/generate-defconfig.sh -b infix/configs/x86_64_defconfig -c config-snippets/vendor.conf -o configs/x86_64_defconfig
./infix/utils/generate-defconfig.sh -b infix/configs/aarch64_minimal_defconfig -c config-snippets/vendor.conf -o configs/aarch64_minimal_defconfig
./infix/utils/generate-defconfig.sh -b infix/configs/x86_64_minimal_defconfig -c config-snippets/vendor.conf -o configs/x86_64_minimal_defconfig
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Vendor example for infix

This repo is an example of how to extend standard Infix
13 changes: 13 additions & 0 deletions config-snippets/vendor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
INFIX_VENDOR="Example"
INFIX_VENDOR_HOME="http://www.company.com"
INFIX_NAME="Example"
INFIX_ID="Example"
BR2_TARGET_GENERIC_HOSTNAME="example"
BR2_TARGET_GENERIC_ISSUE=""
INFIX_COMPATIBLE="infix-${BR2_ARCH}"
INFIX_HOME="https://www.company.com"
INFIX_DOC="https://www.company.com"
INFIX_SUPPORT="mailto:support@vendor"
INFIX_OEM_PATH="${BR2_EXTERNAL_VENDOR_EXAMPLE_PATH}"
BR2_CCACHE_DIR="${BR2_EXTERNAL_VENDOR_EXAMPLE_PATH}/.ccache"
BR2_DL_DIR="${BR2_EXTERNAL_VENDOR_EXAMPLE_PATH}/dl"
Loading

0 comments on commit 94865a7

Please sign in to comment.