diff --git a/.github/workflows/cloud-build.yml b/.github/workflows/cloud-build.yml new file mode 100644 index 0000000..c9350d8 --- /dev/null +++ b/.github/workflows/cloud-build.yml @@ -0,0 +1,37 @@ +name: cloud-build + +on: + workflow_dispatch: {} + +concurrency: + group: cloud-build-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build sysroot with Dockerfile + run: | + docker buildx build \ + --target artifact \ + --output type=local,dest=./build-out \ + . + + - name: Package sysroot + run: | + cd build-out + tar -czf ../sysroot.tar.gz opt/sysroot + + - name: Upload sysroot artifact + uses: actions/upload-artifact@v4 + with: + name: sysroot + path: sysroot.tar.gz + retention-days: 7 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..15c9a1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# syntax=docker/dockerfile:1.6 +FROM debian:buster AS builder + +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /opt + +# Base tools for fetching sources; the main build dependencies are installed by the script itself +RUN echo "deb http://archive.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list \ + && echo "deb http://archive.debian.org/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list \ + && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until \ + && apt-get update \ + && apt-get install -y git + +COPY . /opt/linux.base +RUN mkdir -p /opt/sysroot + +# Run the existing build script to assemble the sysroot +RUN bash /opt/linux.base/create.sh + +FROM scratch AS artifact +COPY --from=builder /opt/sysroot/ / diff --git a/README.md b/README.md index 0423957..cc7d571 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,18 @@ Linux Kernel 3.18 (64bit) + Drivers + Busybox + GCC + glibc + wpa_supplicant (fo ## BUILD INSTRUCTIONS -mkdir /opt/sysroot +- **docker run (legacy manual run)** + - `mkdir /opt/sysroot` + - `docker run -it --mount type=bind,source=/opt/sysroot,target=/opt/sysroot --rm debian:buster /bin/bash -c "apt-get update; apt-get install -y git; cd /opt; git clone https://github.com/buzzy/linux.base.git; bash"` + - `time bash linux.base/create.sh` -docker run -it --mount type=bind,source=/opt/sysroot,target=/opt/sysroot --rm debian:buster /bin/bash -c "apt-get update; apt-get install -y git; cd /opt; git clone https://github.com/buzzy/linux.base.git; bash" +- **docker build (recommended)** + - `docker buildx build --target artifact --output type=local,dest=/opt/sysroot .` + +- **cloud build (GitHub Actions)** + - Run the workflow `cloud-build` (workflow_dispatch) in GitHub Actions. + - Output artifact: download `sysroot` artifact containing `/opt/sysroot`. -time bash linux.base/create.sh ## ENABLE USB BOOT diff --git a/create.sh b/create.sh index c6fc7c5..6785256 100644 --- a/create.sh +++ b/create.sh @@ -99,7 +99,7 @@ rm -rf /opt/sysroot/tmp/* #BINUTILS cd /opt -wget https://ftp.yzu.edu.tw/gnu/binutils/binutils-2.32.tar.xz +wget https://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz tar xfv binutils-2.32.tar.xz cd binutils-2.32 @@ -126,7 +126,7 @@ make tooldir=/opt/sysroot/usr install #GCC cd /opt -wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-8.3.0/gcc-8.3.0.tar.xz +wget https://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz tar xfv gcc-8.3.0.tar.xz cd gcc-8.3.0 ./contrib/download_prerequisites @@ -164,7 +164,7 @@ ln -s arm-linux-gnueabihf-gcc /opt/sysroot/usr/bin/cc #bison cd /opt -wget http://ftp.twaren.net/Unix/GNU/gnu/bison/bison-3.4.1.tar.xz +wget https://ftp.gnu.org/gnu/bison/bison-3.4.1.tar.xz tar xfv bison-3.4.1.tar.xz cd bison-3.4.1 ./configure \ @@ -199,7 +199,7 @@ rm -fr /opt/sysroot/tmp/* #make cd /opt -wget http://ftp.twaren.net/Unix/GNU/gnu/make/make-4.2.1.tar.gz +wget https://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz tar xfv make-4.2.1.tar.gz cd make-4.2.1 sed -i '211,217 d; 219,229 d; 232 d' glob/glob.c @@ -282,7 +282,7 @@ rm -fr /tmp/iw #zlib cd /opt -wget https://zlib.net/zlib-1.2.11.tar.gz +wget https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.gz tar xfv zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure \ @@ -352,7 +352,7 @@ rm -fr /tmp/openssl #ncurses cd /opt -wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz +wget https://ftp.gnu.org/gnu/ncurses/ncurses-6.1.tar.gz tar xfv ncurses-6.1.tar.gz cd ncurses-6.1 ./configure \