Add prebuilt kernel support for faster builds #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build BlazeNeuro | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 240 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
| sudo apt-get clean | |
| df -h | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential bison flex texinfo gawk \ | |
| libncurses-dev bc libssl-dev libelf-dev parted rsync wget xz-utils \ | |
| libgmp-dev libmpfr-dev libmpc-dev libx11-dev libxft-dev python3 \ | |
| python3-pip gettext autoconf automake libtool pkg-config m4 | |
| - name: Create directory structure | |
| run: | | |
| sudo mkdir -p /mnt/lfs/{tools,sources,build,usr,boot,etc,var,home} | |
| sudo mkdir -p /mnt/lfs/usr/{bin,lib,sbin} | |
| sudo chown -R $USER:$USER /mnt/lfs | |
| mkdir -p logs build | |
| cp -r sources /mnt/lfs/ || mkdir -p /mnt/lfs/sources | |
| - name: Download sources | |
| run: | | |
| mkdir -p sources | |
| cd sources | |
| declare -A urls=( | |
| ["binutils-2.42.tar.xz"]="https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz|https://mirrors.kernel.org/gnu/binutils/binutils-2.42.tar.xz" | |
| ["gcc-13.2.0.tar.xz"]="https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz|https://mirrors.kernel.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz" | |
| ["glibc-2.39.tar.xz"]="https://ftp.gnu.org/gnu/glibc/glibc-2.39.tar.xz|https://mirrors.kernel.org/gnu/glibc/glibc-2.39.tar.xz" | |
| ["linux-6.7.4.tar.xz"]="https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz|https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz" | |
| ["bash-5.2.21.tar.gz"]="https://ftp.gnu.org/gnu/bash/bash-5.2.21.tar.gz|https://mirrors.kernel.org/gnu/bash/bash-5.2.21.tar.gz" | |
| ["coreutils-9.4.tar.xz"]="https://ftp.gnu.org/gnu/coreutils/coreutils-9.4.tar.xz|https://mirrors.kernel.org/gnu/coreutils/coreutils-9.4.tar.xz" | |
| ["findutils-4.9.0.tar.xz"]="https://ftp.gnu.org/gnu/findutils/findutils-4.9.0.tar.xz|https://mirrors.kernel.org/gnu/findutils/findutils-4.9.0.tar.xz" | |
| ["grep-3.11.tar.xz"]="https://ftp.gnu.org/gnu/grep/grep-3.11.tar.xz|https://mirrors.kernel.org/gnu/grep/grep-3.11.tar.xz" | |
| ["gzip-1.13.tar.xz"]="https://ftp.gnu.org/gnu/gzip/gzip-1.13.tar.xz|https://mirrors.kernel.org/gnu/gzip/gzip-1.13.tar.xz" | |
| ["tar-1.35.tar.xz"]="https://ftp.gnu.org/gnu/tar/tar-1.35.tar.xz|https://mirrors.kernel.org/gnu/tar/tar-1.35.tar.xz" | |
| ["xz-5.4.6.tar.xz"]="https://github.com/tukaani-project/xz/releases/download/v5.4.6/xz-5.4.6.tar.xz|https://tukaani.org/xz/xz-5.4.6.tar.xz" | |
| ["util-linux-2.39.3.tar.xz"]="https://www.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.3.tar.xz|https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.3.tar.xz" | |
| ["e2fsprogs-1.47.0.tar.gz"]="https://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.47.0/e2fsprogs-1.47.0.tar.gz|https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.0/e2fsprogs-1.47.0.tar.gz" | |
| ["grub-2.12.tar.xz"]="https://ftp.gnu.org/gnu/grub/grub-2.12.tar.xz|https://mirrors.edge.kernel.org/gnu/grub/grub-2.12.tar.xz" | |
| ) | |
| for file in "${!urls[@]}"; do | |
| IFS='|' read -ra MIRRORS <<< "${urls[$file]}" | |
| echo "Downloading $file" | |
| success=0 | |
| for mirror in "${MIRRORS[@]}"; do | |
| if wget --continue --tries=3 --waitretry=2 --timeout=20 "$mirror" -O "$file"; then | |
| success=1 | |
| break | |
| fi | |
| echo "Failed from $mirror, trying next..." | |
| rm -f "$file" | |
| done | |
| [ $success -eq 0 ] && { echo "All mirrors failed for $file"; exit 1; } | |
| if [[ "$file" == *.xz ]]; then | |
| xz -t "$file" || { echo "Corrupt: $file"; rm -f "$file"; exit 1; } | |
| elif [[ "$file" == *.gz ]]; then | |
| gzip -t "$file" || { echo "Corrupt: $file"; rm -f "$file"; exit 1; } | |
| fi | |
| done | |
| ls -lh | |
| # Copy to /mnt/lfs/sources for build | |
| sudo cp -v *.tar.* /mnt/lfs/sources/ || true | |
| - name: Build complete system | |
| run: | | |
| chmod +x build.sh | |
| sudo ./build.sh all | |
| - name: Upload build logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-logs | |
| path: logs/ | |
| retention-days: 7 | |
| - name: Create system image | |
| if: success() | |
| run: | | |
| cd /mnt/lfs | |
| sudo tar czf $GITHUB_WORKSPACE/blazeneuro-rootfs.tar.gz . | |
| - name: Upload system image | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blazeneuro-system | |
| path: blazeneuro-rootfs.tar.gz | |
| retention-days: 30 |