Skip to content

Commit

Permalink
Merge pull request #76 from SamYuan1990/ubiSupport
Browse files Browse the repository at this point in the history
enable ubi support
  • Loading branch information
rootfs authored Apr 26, 2024
2 parents ba1d0bd + 82fbdbe commit 76241dc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 12 deletions.
58 changes: 46 additions & 12 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,55 @@ print_config() {
}

linuxHeader() {
sudo apt-get install -y linux-headers-"$(uname -r)"
sudo apt-get install -y linux-modules-"$(uname -r)"
sudo apt-get install -y linux-modules-extra-"$(uname -r)"
if [ -f /usr/bin/apt-get ]; then
sudo apt-get install -y linux-headers-"$(uname -r)"
sudo apt-get install -y linux-modules-"$(uname -r)"
sudo apt-get install -y linux-modules-extra-"$(uname -r)"
fi
if [ -f /usr/bin/yum ]; then
echo "do nothing for yum with linux header?"
fi
}

ebpf() {
sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
mkdir -p temp-libbpf
cd temp-libbpf
git clone -b "$LIBBPF_VERSION" https://github.com/libbpf/libbpf
cd libbpf/src
sudo BUILD_STATIC_ONLY=y make install
sudo make install_uapi_headers
cd ../../..
sudo rm -rf temp-libbpf
if [ -f /usr/bin/apt-get ]; then
sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
mkdir -p temp-libbpf
cd temp-libbpf
git clone -b "$LIBBPF_VERSION" https://github.com/libbpf/libbpf
cd libbpf/src
sudo BUILD_STATIC_ONLY=y make install
sudo make install_uapi_headers
cd ../../..
sudo rm -rf temp-libbpf
fi
if [ -f /usr/bin/yum ]; then
export workdir=$PWD
yum -y install yum-utils cpio bzip2 clang llvm-devel zlib-devel libcurl-devel m4 xz
yum-config-manager --enable ubi-9-baseos-source
mkdir -p /tmp/elfutils-source
cd /tmp/elfutils-source
yumdownloader --source elfutils
rpm2cpio elfutils-0.189-3.el9.src.rpm | cpio -iv
ls -al
tar xjvf elfutils-0.189.tar.bz2
cd /tmp/elfutils-source/elfutils-0.189
./configure --disable-debuginfod
make install

mkdir -p /tmp/libbpf-source
cd /tmp/libbpf-source
yumdownloader --source libbpf
rpm2cpio libbpf-1.2.0-1.el9.src.rpm | cpio -iv
tar xf ./linux-*el9.tar.xz
cd /tmp/libbpf-source/linux-5.14.0-333.el9/tools/lib/bpf
make install_headers
prefix=/usr BUILD_STATIC_ONLY=y make install
cd /tmp/libbpf-source/linux-5.14.0-333.el9/tools/bpf
make bpftool

cd "$workdir"
fi
}

containerruntime() {
Expand Down
1 change: 1 addition & 0 deletions test/ubi.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ RUN yum update -y && yum install -y git sudo
#RUN yum install -y yum-utils
#RUN yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#RUN yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
RUN sudo ./main.sh prerequisites
RUN sudo ./main.sh containerruntime
RUN sudo ./verify.sh containerruntime

0 comments on commit 76241dc

Please sign in to comment.