Skip to content

Commit 57ec2dc

Browse files
authored
Merge pull request #1249 from kernelkit/releng
2 parents 102e13a + 94fa7ea commit 57ec2dc

File tree

4 files changed

+152
-5
lines changed

4 files changed

+152
-5
lines changed

.github/workflows/build-release.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Needed for make pkg-stats
2+
# sudo apt install python3-aiohttp
3+
---
14
name: Build Release
25

36
on:
@@ -75,7 +78,12 @@ jobs:
7578
7679
- name: Generate SBOM from Build
7780
run: |
81+
# Generate manifest files in CSV format for CycloneDX
7882
make legal-info
83+
# Generate cpe.json for CycloneDX
84+
make -s show-info > output/cpe.json
85+
# Generate pkg-stats.{json,html} for humans
86+
make pkg-stats
7987
8088
- name: Build test specification
8189
run: |
@@ -84,13 +92,22 @@ jobs:
8492
- name: Prepare Artifacts
8593
run: |
8694
cd output/
95+
96+
# Collect relevant files for SBOM and CPE info. for more info, see:
97+
# https://github.com/CycloneDX/cyclonedx-buildroot
98+
mkdir images/sbom
99+
mv pkg-stats.* images/sbom/
100+
mv cpe.json images/sbom/
101+
mv legal-info/*.csv images/sbom/
102+
103+
# Remove rootfs.squashfs from release (can be extracted from rootfs.itb)
104+
# Saves ~131MB per architecture. See issue #858
105+
rm -f images/rootfs.squashfs
106+
87107
mv images ${{ steps.vars.outputs.dir }}
88108
ln -s ${{ steps.vars.outputs.dir }} images
89109
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
90110
91-
mv legal-info legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
92-
tar cfz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}.tar.gz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
93-
94111
- uses: actions/upload-artifact@v4
95112
with:
96113
name: artifact-${{ matrix.target }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
if echo $ver | grep -qE 'v[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then
7676
echo "pre=true" >> $GITHUB_OUTPUT
7777
echo "latest=false" >> $GITHUB_OUTPUT
78-
elif echo $ver | grep -qE '^v[0-9.]+\.[0-9.]+(\.[0-9]+)?$'; then
78+
elif echo $ver | grep -qE '^v[0-9]+\.[0-9]+(\.0)?$'; then
7979
echo "pre=false" >> $GITHUB_OUTPUT
8080
echo "latest=true" >> $GITHUB_OUTPUT
8181
echo "cat=Releases" >> $GITHUB_OUTPUT
@@ -117,7 +117,7 @@ jobs:
117117
prerelease: ${{ steps.rel.outputs.pre }}
118118
makeLatest: ${{ steps.rel.outputs.latest }}
119119
discussionCategory: ${{ steps.rel.outputs.cat }}
120-
bodyFile: release.md
120+
bodyFile: release.md
121121
artifacts: "*.tar.gz*,*.qcow2*"
122122

123123
- name: Summary

board/common/qemu/qemu.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,35 @@ gdb_args()
313313
echo -n "-gdb chardev:gdbqemu"
314314
}
315315

316+
extract_squashfs()
317+
{
318+
# Extract rootfs.squashfs from rootfs.itb if missing
319+
# The .itb file is rootfs.itbh (4096 bytes) + rootfs.squashfs
320+
input="${1:-rootfs.itb}"
321+
output="${2:-rootfs.squashfs}"
322+
323+
[ -f "$input" ] || die "Cannot extract $output: $input not found"
324+
325+
echo "Extracting $output from $input (skipping 4096-byte FIT header)..."
326+
dd if="$input" of="$output" bs=4096 skip=1 2>/dev/null \
327+
|| die "Failed to extract $output from $input"
328+
329+
echo "Successfully created $output"
330+
}
331+
316332
run_qemu()
317333
{
334+
# Auto-extract rootfs.squashfs from rootfs.itb if needed for initrd mode
335+
if [ "$CONFIG_QEMU_ROOTFS_INITRD" = "y" ]; then
336+
if [ "$CONFIG_QEMU_ROOTFS" = "rootfs.squashfs" ] && [ ! -f "rootfs.squashfs" ]; then
337+
if [ -f "rootfs.itb" ]; then
338+
extract_squashfs "rootfs.itb" "rootfs.squashfs"
339+
else
340+
die "Missing rootfs.squashfs and cannot find rootfs.itb to extract it from"
341+
fi
342+
fi
343+
fi
344+
318345
if [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
319346
if ! qemu-img check "qemu.qcow2"; then
320347
rm -f "qemu.qcow2"

utils/extract-squashfs.sh

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/bin/sh
2+
#
3+
# Extract rootfs.squashfs from a release tarball's rootfs.itb file
4+
#
5+
# Usage: extract-squashfs.sh <tarball-or-itb-file> [output-file]
6+
#
7+
8+
set -e
9+
10+
usage() {
11+
cat <<EOF
12+
Usage: $(basename "$0") <tarball-or-itb-file> [output-file]
13+
14+
Extract rootfs.squashfs from a release tarball or .itb file.
15+
16+
Arguments:
17+
<tarball-or-itb-file> Release tarball (*.tar.gz) or rootfs.itb file
18+
[output-file] Output squashfs file (default: rootfs.squashfs)
19+
20+
Examples:
21+
# From release tarball
22+
$(basename "$0") infix-x86_64-25.09.0.tar.gz
23+
24+
# From .itb file directly
25+
$(basename "$0") output/images/rootfs.itb
26+
27+
# Custom output location
28+
$(basename "$0") infix-x86_64-25.09.0.tar.gz /tmp/my-rootfs.squashfs
29+
30+
The script skips the 4096-byte FIT header to extract the SquashFS image.
31+
EOF
32+
}
33+
34+
die() {
35+
echo "ERROR: $*" >&2
36+
exit 1
37+
}
38+
39+
# Parse arguments
40+
case "$1" in
41+
-h|--help)
42+
usage
43+
exit 0
44+
;;
45+
"")
46+
usage
47+
exit 1
48+
;;
49+
esac
50+
51+
input="$1"
52+
output="${2:-rootfs.squashfs}"
53+
54+
[ -f "$input" ] || die "File not found: $input"
55+
56+
# Detect if input is a tarball or .itb file
57+
case "$input" in
58+
*.tar.gz)
59+
echo "Extracting rootfs.itb from tarball..."
60+
itb_file=$(tar -tzf "$input" | grep -m1 'rootfs\.itb$') \
61+
|| die "No rootfs.itb found in tarball"
62+
63+
echo "Found: $itb_file"
64+
echo "Extracting SquashFS (skipping 4096-byte FIT header)..."
65+
66+
tar -xzOf "$input" "$itb_file" | dd bs=4096 skip=1 of="$output" 2>/dev/null \
67+
|| die "Failed to extract SquashFS"
68+
;;
69+
*.itb)
70+
echo "Extracting SquashFS from .itb file (skipping 4096-byte FIT header)..."
71+
dd if="$input" of="$output" bs=4096 skip=1 2>/dev/null \
72+
|| die "Failed to extract SquashFS"
73+
;;
74+
*)
75+
die "Unsupported file type. Expected *.tar.gz or *.itb"
76+
;;
77+
esac
78+
79+
# Verify output
80+
if [ -f "$output" ]; then
81+
size=$(stat --format=%s "$output" 2>/dev/null || stat -f%z "$output")
82+
file_type=$(file "$output")
83+
84+
# Try to format size nicely, fall back to bytes if numfmt not available
85+
if command -v numfmt >/dev/null 2>&1; then
86+
size_str=$(numfmt --to=iec-i --suffix=B "$size")
87+
else
88+
size_str="$size bytes"
89+
fi
90+
91+
echo "Success! Created: $output ($size_str)"
92+
echo "Type: $file_type"
93+
94+
# Quick sanity check for squashfs magic
95+
if echo "$file_type" | grep -qi squashfs; then
96+
echo "✓ Verified: Valid SquashFS filesystem"
97+
else
98+
echo "⚠ Warning: Output may not be a valid SquashFS image"
99+
exit 1
100+
fi
101+
else
102+
die "Failed to create output file"
103+
fi

0 commit comments

Comments
 (0)