-
Notifications
You must be signed in to change notification settings - Fork 733
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix support for Fedora probe builder
Fedora 31 introduced zstd-compressed RPMs, which older rpm2cpio can't read. Work around it by using a helper Alpine-based Docker image that includes a new enough version. Add a Fedora 31 gcc 9.2 builder too for future-proofing. Also fix the crawler to include Fedora 30/31 kernels, as f29 and older are now archived. While we're removing dependencies, move the kpartx device mapper manipulation to the toolkit image as well
- Loading branch information
Showing
5 changed files
with
102 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM fedora:31 | ||
|
||
RUN yum -y install \ | ||
wget \ | ||
git \ | ||
gcc \ | ||
gcc-c++ \ | ||
autoconf \ | ||
bison \ | ||
flex \ | ||
make \ | ||
cmake \ | ||
elfutils-devel \ | ||
findutils \ | ||
kmod \ | ||
python-lxml && yum clean all | ||
|
||
ADD builder-entrypoint.sh / | ||
WORKDIR /build/probe | ||
ENTRYPOINT [ "/builder-entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM alpine | ||
|
||
RUN apk add rpm2cpio multipath-tools | ||
ADD toolkit-entrypoint.sh /toolkit-entrypoint.sh | ||
ENTRYPOINT ["/toolkit-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/sh | ||
|
||
set -euo pipefail | ||
|
||
usage() { | ||
cat >&2 <<EOF | ||
Usage: | ||
$0 DISTRIBUTION KERNEL_PACKAGE OUTPUT_DIR | ||
EOF | ||
exit 1 | ||
} | ||
|
||
unpack_coreos_kernel() | ||
{ | ||
KERNEL_PACKAGE="$1" | ||
OUTPUT_DIR="$2" | ||
|
||
bzcat "$KERNEL_PACKAGE" > /tmp/container.img | ||
|
||
# mount developer container is a very stateful part of this script | ||
# the section between mount/unmounting should be kept very small | ||
# otherwise if something fails there are many inconsistencies that can happen | ||
LOOPDEV=$(kpartx -asv /tmp/container.img | cut -d\ -f 3) | ||
mount /dev/mapper/$LOOPDEV /mnt | ||
# Copy kernel headers | ||
cp -r /mnt/lib/modules "$OUTPUT_DIR" | ||
|
||
# Copy kernel config | ||
rm -f $OUTPUT_DIR/config-* | ||
cp /mnt/usr/boot/config-* $OUTPUT_DIR/ | ||
cp $OUTPUT_DIR/config-* $OUTPUT_DIR/config_orig | ||
# umount and remove the developer container | ||
umount /mnt | ||
kpartx -dv /tmp/container.img | ||
} | ||
|
||
unpack_rpm() | ||
{ | ||
KERNEL_PACKAGE="$1" | ||
OUTPUT_DIR="$2" | ||
|
||
rpm2cpio "$KERNEL_PACKAGE" | (cd "$OUTPUT_DIR" && cpio -idm) | ||
} | ||
|
||
case "$1" in | ||
coreos) | ||
unpack_coreos_kernel "$2" "$3" | ||
;; | ||
rpm) | ||
unpack_rpm "$2" "$3" | ||
;; | ||
*) | ||
echo "Unsupported distribution $1" | ||
exit 1 | ||
;; | ||
esac |