File tree Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ dep_installer () {
3838 cpio \
3939 kmod
4040 fi
41+
42+ # Download unzboot as kernel images are compressed in the zboot format on RHEL 9 arm64
43+ # unzboot is only available on the EPEL RPM repo
44+ dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
45+ dnf config-manager --enable epel
46+ dnf install -y unzboot
47+
4148 rm -rf /var/cache/yum/*
4249}
4350
Original file line number Diff line number Diff line change @@ -142,24 +142,22 @@ _install_prerequisites() (
142142 depmod ${KERNEL_VERSION}
143143
144144 echo " Generating Linux kernel version string..."
145- if [ " $TARGETARCH " = " arm64" ]; then
146- # Download unzboot as kernel images are compressed in the zboot format on RHEL 9 arm64
147- # unzboot is only available on the EPEL RPM repo
148- dnf -q -y --releasever=${DNF_RELEASEVER} install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
149- dnf config-manager --enable epel
150- dnf -q -y --releasever=${DNF_RELEASEVER} install unzboot
151-
152- if ! unzboot /lib/modules/${KERNEL_VERSION} /vmlinuz vmlinuz.out; then
153- echo " Could not extract /lib/modules/${KERNEL_VERSION} /vmlinuz" >&2
154- return 1
155- fi
145+ extract-vmlinux /lib/modules/${KERNEL_VERSION} /vmlinuz | strings | grep -E ' ^Linux version' | sed ' s/^\(.*\)\s\+(.*)$/\1/' > version
156146
147+ if [ -z " $( < version) " ]; then
148+ echo " extract-vmlinux image extraction failed. Falling back to unzboot..."
149+ unzboot /lib/modules/${KERNEL_VERSION} /vmlinuz vmlinuz.out
157150 < vmlinuz.out strings | grep -E ' ^Linux version' | sed ' s/^\(.*\)\s\+(.*)$/\1/' > version
158151 rm vmlinuz.out
159- else
160- extract-vmlinux /lib/modules/${KERNEL_VERSION} /vmlinuz | strings | grep -E ' ^Linux version' | sed ' s/^\(.*\)\s\+(.*)$/\1/' > version
161152 fi
153+
154+ if [ -z " $( < version) " ]; then
155+ echo " unzboot image extraction failed. Falling back to gunzip..."
156+ gunzip -c /lib/modules/${KERNEL_VERSION} /vmlinuz | strings | grep -E ' ^Linux version' | sed ' s/^\(.*\)\s\+(.*)$/\1/' > version
157+ fi
158+
162159 if [ -z " $( < version) " ]; then
160+ echo " All attempts to extract /lib/modules/${KERNEL_VERSION} /vmlinuz failed"
163161 echo " Could not locate Linux kernel version string" >&2
164162 return 1
165163 fi
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ nv-ctr-run-with-dtk() {
2626 /usr/local/bin/common.sh \
2727 /usr/local/bin/extract-vmlinux \
2828 /usr/local/bin/vgpu-util \
29+ /usr/bin/unzboot \
2930 /drivers \
3031 /licenses \
3132 " $DRIVER_TOOLKIT_SHARED_DIR /"
@@ -137,6 +138,7 @@ dtk-build-driver() {
137138 " $DRIVER_TOOLKIT_SHARED_DIR /common.sh" \
138139 " $DRIVER_TOOLKIT_SHARED_DIR /extract-vmlinux" \
139140 " $DRIVER_TOOLKIT_SHARED_DIR /vgpu-util" \
141+ " $DRIVER_TOOLKIT_SHARED_DIR /unzboot" \
140142 " ${DRIVER_TOOLKIT_SHARED_DIR} /bin"
141143
142144 ln -s $( which true) ${DRIVER_TOOLKIT_SHARED_DIR} /bin/dnf --force
You can’t perform that action at this time.
0 commit comments