Skip to content

Commit

Permalink
workflows: update linux source tgz file version. (#644)
Browse files Browse the repository at this point in the history
* workflows: update linux source tgz file version.

error output:
Reading state information...
E: Unable to locate package linux-source-6.8.0
E: Couldn't find any package by glob 'linux-source-6.8.0'
E: Couldn't find any package by regex 'linux-source-6.8.0'
Error: Process completed with exit code 100.

Signed-off-by: CFC4N <[email protected]>

---------

Signed-off-by: CFC4N <[email protected]>
  • Loading branch information
cfc4n authored Sep 30, 2024
1 parent d50ee78 commit 716cd74
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 55 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,15 @@ jobs:
- name: Install Compilers
run: |
sudo apt-get update
kernel_ver=`uname -r | cut -d'-' -f 1`
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-12 clang-12 linux-tools-common linux-tools-generic flex bison gcc-aarch64-linux-gnu libssl-dev linux-source-${kernel_ver}
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
sudo ln -s /usr/bin/$tool-12 /usr/bin/$tool
done
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm clang linux-tools-common linux-tools-generic flex bison gcc-aarch64-linux-gnu libssl-dev linux-source
cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
sudo tar -xf $source_file
cd $source_dir
test -f .config || sudo make oldconfig
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- prepare V=0
ls -al /usr/src/linux-source-${kernel_ver}
ls -al /usr/src/$source_dir
shell: bash
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
34 changes: 19 additions & 15 deletions .github/workflows/go-c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,20 @@ jobs:
- name: Install Compilers
run: |
sudo apt-get update
kernel_ver=`uname -r | cut -d'-' -f 1`
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 flex bison linux-tools-common linux-tools-generic gcc gcc-aarch64-linux-gnu libssl-dev linux-source-${kernel_ver}
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 flex bison linux-tools-common linux-tools-generic gcc gcc-aarch64-linux-gnu libssl-dev linux-source
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
sudo ln -s /usr/bin/$tool-14 /usr/bin/$tool
done
cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
sudo tar -xf $source_file
cd $source_dir
test -f .config || sudo make oldconfig
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- prepare V=0
ls -al /usr/src/linux-source-${kernel_ver}
ls -al /usr/src/$source_dir
shell: bash
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -170,18 +171,19 @@ jobs:
install: |
uname -a
apt-get update
kernel_ver=`uname -r | cut -d'-' -f 1`
apt-get install --yes wget git build-essential pkgconf libelf-dev llvm-12 clang-12 linux-tools-generic linux-tools-common flex bison file gcc-x86-64-linux-gnu libssl-dev bc linux-source-${kernel_ver}
apt-get install --yes wget git build-essential pkgconf libelf-dev llvm-12 clang-12 linux-tools-generic linux-tools-common flex bison file gcc-x86-64-linux-gnu libssl-dev bc linux-source
wget https://go.dev/dl/go1.21.0.linux-arm64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go1.21.0.linux-arm64.tar.gz
cd /usr/src
tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
tar -xf $source_file
cd $source_dir
test -f .config || make oldconfig > /dev/null
make ARCH=x86 CROSS_COMPILE=x86_64-linux-gnu- prepare V=0 > /dev/null
make prepare V=0 > /dev/null
ls -al /usr/src/linux-source-${kernel_ver}
ls -al /usr/src/$source_dir
# Produce a binary artifact and place it in the mounted volume
run: |
uname -a
Expand All @@ -199,18 +201,20 @@ jobs:
cat /proc/1/cgroup
echo "cat /proc/1/sched:"
cat /proc/1/sched
cd /usr/src
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
git config --global --add safe.directory /source_code
cd /source_code
kernel_ver=`uname -r | cut -d'-' -f 1`
echo "-------------------start: Build CO-RE Linux (include non-CO-RE)-------------------"
KERN_HEADERS=/usr/src/linux-source-${kernel_ver} make env
KERN_HEADERS=/usr/src/$source_dir make env
make clean
KERN_HEADERS=/usr/src/linux-source-${kernel_ver} make
KERN_HEADERS=/usr/src/$source_dir make
bin/ecapture -v
echo "-------------------start: Build non-CO-RE (Cross-Compilation) Linux -------------------"
make clean
KERN_HEADERS=/usr/src/linux-source-${kernel_ver} CROSS_ARCH=amd64 make env
KERN_HEADERS=/usr/src/linux-source-${kernel_ver} CROSS_ARCH=amd64 make nocore -j8
KERN_HEADERS=/usr/src/$source_dir CROSS_ARCH=amd64 make env
KERN_HEADERS=/usr/src/$source_dir CROSS_ARCH=amd64 make nocore -j8
file bin/ecapture
- name: Show the artifact
# Items placed in /artifacts in the container will be in
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ jobs:
- name: Install Compilers
run: |
sudo apt-get update
kernel_ver=`uname -r | cut -d'-' -f 1`
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic gcc gcc-aarch64-linux-gnu linux-source-${kernel_ver}
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic gcc gcc-aarch64-linux-gnu linux-source
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
sudo ln -s /usr/bin/$tool-14 /usr/bin/$tool
done
cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
sudo tar -xf $source_file
cd $source_dir
test -f .config || sudo make oldconfig
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- prepare V=0
ls -al /usr/src/linux-source-${kernel_ver}
ls -al /usr/src/$source_dir
shell: bash
- uses: actions/checkout@v4
with:
Expand Down
9 changes: 5 additions & 4 deletions COMPILATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ To cross-compile the eCapture tool, you need to install the kernel header files
install the `linux-source` package.

```shell
kernel_ver=`uname -r | cut -d'-' -f 1`
sudo apt-get install -y linux-source-$kernel_ver
sudo apt-get install -y linux-source
cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
sudo tar -xf $source_file
cd $source_dir
test -f .config || yes "" | sudo make oldconfig
```

Expand Down
6 changes: 4 additions & 2 deletions COMPILATION_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ bin/ecapture
kernel_ver=`uname -r | cut -d'-' -f 1`
sudo apt-get install -y linux-source-$kernel_ver
cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
sudo tar -xf $source_file
cd $source_dir
test -f .config || yes "" | sudo make oldconfig
```

Expand Down
6 changes: 4 additions & 2 deletions README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ bin/ecapture --help
kernel_ver=`uname -r | cut -d'-' -f 1`
sudo apt-get install -y linux-source-$kernel_ver
cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
sudo tar -xf $source_file
cd $source_dir
test -f .config || yes "" | sudo make oldconfig
```

Expand Down
30 changes: 15 additions & 15 deletions builder/init_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@ if [ $? -ne 0 ]; then
exit
fi

CLANG_NUM=12
CLANG_NUM=-12
# shellcheck disable=SC2209
MAKE_ECAPTURE=make
if [ ${release_num} == "20.04" ]; then
CLANG_NUM=9
CLANG_NUM=-9
MAKE_ECAPTURE="make nocore"
elif [ ${release_num} == "20.10" ]; then
CLANG_NUM=10
CLANG_NUM=-10
MAKE_ECAPTURE="make nocore"
elif [ ${release_num} == "21.04" ]; then
CLANG_NUM=11
CLANG_NUM=-11
elif [ ${release_num} == "21.10" ]; then
CLANG_NUM=12
CLANG_NUM=-12
elif [ ${release_num} == "22.04" ]; then
CLANG_NUM=12
CLANG_NUM=-12
elif [ ${release_num} == "22.10" ]; then
CLANG_NUM=12
CLANG_NUM=-12
elif [ ${release_num} == "23.04" ];then
CLANG_NUM=15
CLANG_NUM=-15
else
echo "unsupported release version ${release_num}" && exit
echo "used default CLANG Version"
CLANG_NUM=
fi

echo "CLANG_NUM=${CLANG_NUM}"
Expand All @@ -52,22 +53,21 @@ cd ~

uname -a
sudo apt-get update
kernel_ver=`uname -r | cut -d'-' -f 1`
# 环境安装
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-${CLANG_NUM} clang-${CLANG_NUM} linux-tools-common linux-tools-generic gcc-aarch64-linux-gnu libssl-dev flex bison linux-source-${kernel_ver}
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm${CLANG_NUM} clang${CLANG_NUM} linux-tools-common linux-tools-generic gcc-aarch64-linux-gnu libssl-dev flex bison linux-source
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
sudo ln -s /usr/bin/$tool-${CLANG_NUM} /usr/bin/$tool
sudo ln -s /usr/bin/$tool${CLANG_NUM} /usr/bin/$tool
done

cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
sudo tar -xf linux-source.tar.bz2
cd /usr/src/linux-source
test -f .config || yes "" | sudo make oldconfig
yes "" | sudo make ARCH=${ARCH} CROSS_COMPILE=aarch64-linux-gnu- prepare V=0 > /dev/null
yes "" | sudo make prepare V=0 > /dev/null
ls -al /usr/src/linux-source-${kernel_ver}
ls -al /usr/src/linux-source

clang --version
cd ~
Expand Down
9 changes: 7 additions & 2 deletions variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ HOST_VERSION_SHORT := $(shell uname -r | cut -d'-' -f 1)

# linux-source-5.15.0.tar.bz2
LINUX_SOURCE_PATH ?= /usr/src/linux-source-$(HOST_VERSION_SHORT)
LINUX_SOURCE_TAR ?= /usr/src/linux-source-$(HOST_VERSION_SHORT).tar.bz2
ifdef KERN_HEADERS
LINUX_SOURCE_PATH = $(KERN_HEADERS)
else
KERN_HEADERS = $(LINUX_SOURCE_PATH)
endif

LINUX_SOURCE_TAR ?= $(LINUX_SOURCE_PATH).tar.bz2

ifdef CROSS_ARCH
ifeq ($(HOST_ARCH),aarch64)
Expand Down Expand Up @@ -172,7 +178,6 @@ endif
#
ifdef CROSS_ARCH
KERNEL_HEADER_GEN = test -e arch/$(LINUX_ARCH)/kernel/asm-offsets.s || yes "" | $(SUDO) make ARCH=$(LINUX_ARCH) CROSS_COMPILE=$(CMD_CC_PREFIX) prepare V=0
KERN_HEADERS = $(LINUX_SOURCE_PATH)
endif
KERN_RELEASE ?= $(UNAME_R)
KERN_BUILD_PATH ?= $(if $(KERN_HEADERS),$(KERN_HEADERS),/lib/modules/$(KERN_RELEASE)/build)
Expand Down

0 comments on commit 716cd74

Please sign in to comment.