Skip to content

Commit

Permalink
Merge pull request #736 from fabiendupont/get-kernel-version-from-boo…
Browse files Browse the repository at this point in the history
…tc-image

Driver Toolkit: Get kernel version from bootc image
  • Loading branch information
javipolo authored Aug 8, 2024
2 parents 198a13f + 78c57fe commit acb2b5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions training/common/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ DISK_TYPE ?= qcow2
DISK_UID ?= $(shell id -u)
DISK_GID ?= $(shell id -g)

ARCH ?=
ARCH ?= $(shell arch)

DRIVER_VERSION ?=
KERNEL_VERSION ?=
KERNEL_VERSION ?= $(shell skopeo inspect --format json docker://${FROM} | jq -r '.Labels["ostree.linux"]' | sed "s/\.${ARCH}//")

INSTRUCTLAB_IMAGE ?= $(REGISTRY)/$(REGISTRY_ORG)/instructlab-$(HARDWARE):$(IMAGE_TAG)
WRAPPER = $(CURDIR)/../ilab-wrapper/ilab
Expand All @@ -43,8 +43,9 @@ TRAIN_WRAPPER = $(CURDIR)/../ilab-wrapper/ilab-training-launcher
OUTDIR = $(CURDIR)/../build
MODELS_CONTAINERFILE = $(OUTDIR)/Containerfile.models

DRIVER_TOOLKIT_BASE_IMAGE ?=
DRIVER_TOOLKIT_IMAGE_NAME ?= driver-toolkit
DRIVER_TOOLKIT_IMAGE_TAG ?= latest
DRIVER_TOOLKIT_IMAGE_TAG ?= ${KERNEL_VERSION}
DRIVER_TOOLKIT_IMAGE ?= ${REGISTRY}/${REGISTRY_ORG}/${DRIVER_TOOLKIT_IMAGE_NAME}:${DRIVER_TOOLKIT_IMAGE_TAG}

ENABLE_RT ?=
Expand Down Expand Up @@ -113,7 +114,7 @@ driver-toolkit:
$(ARCH:%=--platform linux/%) \
$(BUILD_ARG_FILE:%=--build-arg-file=%) \
$(ENABLE_RT:%=--build-arg ENABLE_RC=%) \
$(FROM:%=--from=%) \
$(DRIVER_TOOLKIT_BASE_IMAGE:%=--build-arg BASEIMAGE=%) \
$(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \
$(SOURCE_DATE_EPOCH:%=--timestamp=%) \
--file ../common/driver-toolkit/Containerfile \
Expand Down
1 change: 1 addition & 0 deletions training/intel-bootc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ bootc: prepare-files
${CONTAINER_TOOL} build \
$(ARCH:%=--platform linux/%) \
$(BUILD_ARG_FILE:%=--build-arg-file=%) \
$(DRIVER_TOOLKIT_IMAGE:%=--build-arg DRIVER_TOOLKIT_IMAGE=%) \
$(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \
$(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=%) \
$(FROM:%=--build-arg BASEIMAGE=%) \
Expand Down
4 changes: 2 additions & 2 deletions training/nvidia-bootc/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COPY --chown=1001:0 x509-configuration.ini x509-configuration.ini
RUN export KVER=$(rpm -q --qf "%{VERSION}" kernel-core) \
KREL=$(rpm -q --qf "%{RELEASE}" kernel-core | sed 's/\.el.\(_.\)*$//') \
KDIST=$(rpm -q --qf "%{RELEASE}" kernel-core | awk -F '.' '{ print "."$NF}') \
OS_VERSION_MAJOR=$(grep "^VERSION=" /etc/os-release | cut -d '=' -f 2 | sed 's/"//g') \
OS_VERSION_MAJOR=$(grep "^VERSION=" /etc/os-release | cut -d '=' -f 2 | sed 's/"//g' | cut -d '.' -f 1) \
&& if [ "${BUILD_ARCH}" == "" ]; then \
export BUILD_ARCH=$(arch) \
&& export TARGET_ARCH=$(echo "${BUILD_ARCH}" | sed 's/+64k//') ;\
Expand Down Expand Up @@ -93,7 +93,7 @@ ARG IMAGE_VERSION_ID
# The need for the `cp /etc/dnf/dnf.conf` is a workaround for https://github.com/containers/bootc/issues/637
RUN mv /etc/selinux /etc/selinux.tmp \
&& dnf install -y /rpms/kmod-nvidia-*.rpm \
&& export OS_VERSION_MAJOR=$(grep "^VERSION=" /etc/os-release | cut -d '=' -f 2 | sed 's/"//g') \
&& export OS_VERSION_MAJOR=$(grep "^VERSION=" /etc/os-release | cut -d '=' -f 2 | sed 's/"//g' | cut -d '.' -f 1) \
&& if [ "${TARGET_ARCH}" == "" ]; then \
export TARGET_ARCH="$(arch)" ;\
fi \
Expand Down

0 comments on commit acb2b5d

Please sign in to comment.