Skip to content

Commit

Permalink
aarch64/x86_64: build kernel with clang lto
Browse files Browse the repository at this point in the history
Signed-off-by: sbwml <admin@cooluc.com>
  • Loading branch information
sbwml committed May 6, 2024
1 parent 49b0bd1 commit 64598cd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/build-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,26 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo sh -c 'echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" >> /etc/apt/sources.list'
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y build-essential flex bison clang-17 cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename qemu-utils
sudo apt-get install -y build-essential flex bison cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename qemu-utils
sudo apt-get clean
git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com'
df -Th
- name: Install LLVM
run: |
export PATH="/opt/clang/bin:$PATH"
mkdir /opt/clang
curl -LO https://github.com/sbwml/ubuntu-llvm-project/releases/download/17.0.6/clang-17.0.6-x86_64-ubuntu-22.04.tar.xz --progress-bar
sudo tar --strip-components=1 -C /opt/clang -xf clang-17.0.6-x86_64-ubuntu-22.04.tar.xz
clang --version
- name: Compile OpenWrt
id: compile
continue-on-error: true
working-directory: /builder
run: |
export PATH="/opt/clang/bin:$PATH"
[ "${{ matrix.model }}" != "netgear_r8500" ] && export KERNEL_CLANG_LTO=y
BUILD_FAST=y ENABLE_OTA=y ENABLE_BPF=y ENABLE_LTO=y ENABLE_LRNG=y MINIMAL_BUILD=y USE_GCC15=y USE_MOLD=y bash <(curl -sS ${{ secrets.script_url_general }}) ${{ matrix.tag.type }} ${{ matrix.model }}
cd openwrt
tags=$(git describe --abbrev=0 --tags)
Expand All @@ -108,6 +114,7 @@ jobs:
if: steps.compile.outcome == 'failure'
working-directory: /builder
run: |
export PATH="/opt/clang/bin:$PATH"
cd openwrt
make V=s
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,26 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo sh -c 'echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" >> /etc/apt/sources.list'
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y build-essential flex bison clang-17 cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename qemu-utils
sudo apt-get install -y build-essential flex bison cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename qemu-utils
sudo apt-get clean
git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com'
df -Th
- name: Install LLVM
run: |
export PATH="/opt/clang/bin:$PATH"
mkdir /opt/clang
curl -LO https://github.com/sbwml/ubuntu-llvm-project/releases/download/17.0.6/clang-17.0.6-x86_64-ubuntu-22.04.tar.xz --progress-bar
sudo tar --strip-components=1 -C /opt/clang -xf clang-17.0.6-x86_64-ubuntu-22.04.tar.xz
clang --version
- name: Compile OpenWrt
id: compile
continue-on-error: true
working-directory: /builder
run: |
export PATH="/opt/clang/bin:$PATH"
[ "${{ matrix.model }}" != "netgear_r8500" ] && export KERNEL_CLANG_LTO=y
BUILD_FAST=y ENABLE_OTA=y ENABLE_BPF=y ENABLE_LTO=y ENABLE_LRNG=y USE_GCC15=y USE_MOLD=y bash <(curl -sS ${{ secrets.script_url_general }}) ${{ matrix.tag.type }} ${{ matrix.model }}
cd openwrt
tags=$(git describe --abbrev=0 --tags)
Expand All @@ -118,6 +124,7 @@ jobs:
if: steps.compile.outcome == 'failure'
working-directory: /builder
run: |
export PATH="/opt/clang/bin:$PATH"
cd openwrt
make V=s
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/build-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,26 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo sh -c 'echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main" >> /etc/apt/sources.list'
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y build-essential flex bison clang-17 cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename
sudo apt-get install -y build-essential flex bison cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename qemu-utils
sudo apt-get clean
git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com'
df -Th
- name: Install LLVM
run: |
export PATH="/opt/clang/bin:$PATH"
mkdir /opt/clang
curl -LO https://github.com/sbwml/ubuntu-llvm-project/releases/download/17.0.6/clang-17.0.6-x86_64-ubuntu-22.04.tar.xz --progress-bar
sudo tar --strip-components=1 -C /opt/clang -xf clang-17.0.6-x86_64-ubuntu-22.04.tar.xz
clang --version
- name: Compile OpenWrt
id: compile
continue-on-error: true
working-directory: /builder
run: |
export PATH="/opt/clang/bin:$PATH"
[ "${{ matrix.model }}" != "netgear_r8500" ] && export KERNEL_CLANG_LTO=y
BUILD_FAST=y ENABLE_BPF=y ENABLE_LTO=y ENABLE_LRNG=y USE_GCC15=y USE_MOLD=y bash <(curl -sS ${{ secrets.script_url_general }}) ${{ matrix.tag.type }} ${{ matrix.model }}
build_date=$(date "+%Y-%m-%d")
echo "build_date=$build_date" >> $GITHUB_ENV
Expand All @@ -108,6 +114,7 @@ jobs:
if: steps.compile.outcome == 'failure'
working-directory: /builder
run: |
export PATH="/opt/clang/bin:$PATH"
cd openwrt
make V=s
Expand Down

0 comments on commit 64598cd

Please sign in to comment.