mirror of
https://github.com/brain-hackers/buildbrain
synced 2024-12-22 12:10:12 +09:00
Build Brainux on CI
This commit is contained in:
parent
a0a58f83c6
commit
fc61df79b6
93
.github/workflows/build.yml
vendored
93
.github/workflows/build.yml
vendored
@ -29,7 +29,42 @@ jobs:
|
||||
draft: false
|
||||
prerelease: true
|
||||
|
||||
build:
|
||||
build-linux:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
|
||||
- name: Install deps
|
||||
run: sudo apt update && sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap
|
||||
- name: Configure for Linux
|
||||
run: make ldefconfig
|
||||
- name: Build Linux
|
||||
run: make lbuild
|
||||
- name: Setup releases
|
||||
id: release_name
|
||||
run: |
|
||||
mkdir release
|
||||
cp ./linux-brain/arch/arm/boot/dts/imx28-pwsh*.dtb release/
|
||||
cp ./linux-brain/arch/arm/boot/zImage release/zImage
|
||||
zip -r release.zip release/
|
||||
- name: Generate archive name
|
||||
id: archive_name
|
||||
run: echo ::set-output name=name::linux-${GITHUB_REF/refs\/*s\//}
|
||||
- name: Upload release.zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: release.zip
|
||||
asset_name: ${{ steps.archive_name.outputs.name }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
build-uboot:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
strategy:
|
||||
@ -64,18 +99,6 @@ jobs:
|
||||
run: make ubuild
|
||||
- name: Generate NK.bin
|
||||
run: make nk.bin
|
||||
- name: Configure for Linux
|
||||
run: make ldefconfig
|
||||
- name: Build Linux
|
||||
run: make lbuild
|
||||
|
||||
# - name: Build Debian Root # Wait for buildroot
|
||||
# run: |
|
||||
# ./tools/aptcache_linux_amd64 \
|
||||
# -rule 'local=localhost:65432, remote=ftp.us.debian.org' \
|
||||
# -rule 'local=localhost:65433, remote=security.debian.org' &
|
||||
# make debian
|
||||
|
||||
- name: Setup releases
|
||||
id: release_name
|
||||
run: |
|
||||
@ -83,9 +106,10 @@ jobs:
|
||||
cp ./u-boot-brain/u-boot.bin release/u-boot.bin
|
||||
cp ./u-boot-brain/u-boot.sb release/u-boot.sb
|
||||
cp ./nk.bin release/${{ matrix.nk }}
|
||||
cp ./linux-brain/arch/arm/boot/dts/imx28-pw${{ matrix.model }}.dtb release/imx28-pw${{ matrix.model }}.dtb
|
||||
cp ./linux-brain/arch/arm/boot/zImage release/zImage
|
||||
zip -r release.zip release/
|
||||
- name: Generate archive name
|
||||
id: archive_name
|
||||
run: echo ::set-output name=name::uboot-${{ matrix.model }}-${GITHUB_REF/refs\/*s\//}
|
||||
- name: Upload release.zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
@ -93,5 +117,42 @@ jobs:
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: release.zip
|
||||
asset_name: ${{ matrix.model }}-boot.zip
|
||||
asset_name: ${{ steps.archive_name.outputs.name }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
build-sd:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
|
||||
- name: Install deps
|
||||
run: sudo apt update && sudo apt install kpartx build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap
|
||||
- name: Configure for Linux
|
||||
run: make ldefconfig
|
||||
- name: Build Linux
|
||||
run: make lbuild
|
||||
- name: Build Debian Root
|
||||
run: make brainux
|
||||
- name: Build bsd-ce
|
||||
run: make -C nkbin_maker bsd-ce
|
||||
- name: Generate image name
|
||||
id: image_name
|
||||
run: echo ::set-output name=name::sdimage-${GITHUB_REF/refs\/*s\//}
|
||||
- name: Build SD image
|
||||
run: make image/sd.img && mv image/sd.img ${{ steps.image_name.outputs.name }}.img
|
||||
- name: Compress
|
||||
run: zip ${{ steps.image_name.outputs.name }}.zip ${{ steps.image_name.outputs.name }}.img
|
||||
- name: Upload the image
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ steps.image_name.outputs.name }}.zip
|
||||
asset_name: ${{ steps.image_name.outputs.name }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
|
26
Makefile
26
Makefile
@ -80,16 +80,30 @@ nkbin-maker:
|
||||
nk.bin:
|
||||
./nkbin_maker/bsd-ce ./u-boot-brain/u-boot.bin
|
||||
|
||||
debian:
|
||||
brainux:
|
||||
@if [ "$(shell uname)" != "Linux" ]; then \
|
||||
echo "Debootstrap is only available in Linux!"; \
|
||||
exit 1; \
|
||||
fi
|
||||
mkdir -p debian
|
||||
sudo debootstrap --arch=armel --foreign buster debian/ http://localhost:65432/debian/
|
||||
sudo cp /usr/bin/qemu-arm-static debian/usr/bin/
|
||||
sudo cp ./tools/setup_debian.sh debian/
|
||||
sudo chroot debian /setup_debian.sh
|
||||
mkdir -p brainux
|
||||
@if [ "$(CI)" = "true" ]; then \
|
||||
echo "I'm in CI and debootstrap without cache."; \
|
||||
sudo debootstrap --arch=armel --foreign buster brainux/; \
|
||||
else \
|
||||
sudo debootstrap --arch=armel --foreign buster brainux/ http://localhost:65432/debian/; \
|
||||
fi
|
||||
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
|
||||
sudo cp ./os-brainux/setup_brainux.sh brainux/
|
||||
sudo -E chroot brainux /setup_brainux.sh
|
||||
sudo rm brainux/setup_brainux.sh
|
||||
sudo ./os-brainux/override.sh ./os-brainux/override ./brainux
|
||||
|
||||
image/sd.img: clean_work
|
||||
./image/build_image.sh
|
||||
|
||||
.PHONY:
|
||||
clean_work:
|
||||
sudo rm -rf image/work
|
||||
|
||||
.PHONY:
|
||||
aptcache:
|
||||
|
62
image/build_image.sh
Executable file
62
image/build_image.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
set -uex -o pipefail
|
||||
|
||||
JOBS=$(nproc)
|
||||
REPO=$(git rev-parse --show-toplevel)
|
||||
WORK=${REPO}/image/work
|
||||
LINUX=${REPO}/linux-brain
|
||||
IMG=${REPO}/image/sd.img
|
||||
|
||||
mkdir -p ${WORK}
|
||||
|
||||
for i in $(seq 1 6); do
|
||||
make -C ${REPO}/u-boot-brain pwsh${i}_defconfig
|
||||
make -j${JOBS} -C ${REPO}/u-boot-brain u-boot.bin
|
||||
${REPO}/nkbin_maker/bsd-ce ${REPO}/u-boot-brain/u-boot.bin
|
||||
|
||||
case $i in
|
||||
1|2|3)
|
||||
mv ${REPO}/nk.bin ${WORK}/edsa${i}exe.bin;;
|
||||
4|5|6)
|
||||
mv ${REPO}/nk.bin ${WORK}/edsh${i}exe.bin;;
|
||||
*)
|
||||
echo "WTF: $i"
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
dd if=/dev/zero of=${IMG} bs=1M count=2048
|
||||
|
||||
START1=2048
|
||||
SECTORS1=$((1024 * 1024 * 64 / 512))
|
||||
START2=$((2048 + ${SECTORS1}))
|
||||
|
||||
cat <<EOF > ${WORK}/part.sfdisk
|
||||
${IMG}1 : start=${START1}, size=${SECTORS1}, type=b
|
||||
${IMG}2 : start=${START2}, type=83
|
||||
EOF
|
||||
|
||||
sfdisk ${IMG} < ${WORK}/part.sfdisk
|
||||
|
||||
sudo kpartx -av ${IMG}
|
||||
|
||||
LOOPDEV=$(losetup -l | grep sd.img | grep -o 'loop.')
|
||||
|
||||
sudo mkfs.fat -F32 -v -I /dev/mapper/${LOOPDEV}p1
|
||||
sudo mkfs.ext4 /dev/mapper/${LOOPDEV}p2
|
||||
|
||||
mkdir -p ${WORK}/p1 ${WORK}/p2
|
||||
sudo mount /dev/mapper/${LOOPDEV}p1 ${WORK}/p1
|
||||
sudo mount /dev/mapper/${LOOPDEV}p2 ${WORK}/p2
|
||||
|
||||
sudo cp ${LINUX}/arch/arm/boot/zImage ${WORK}/p1/
|
||||
sudo cp ${LINUX}/arch/arm/boot/dts/imx28-pwsh*.dtb ${WORK}/p1/
|
||||
sudo cp ${WORK}/*.bin ${WORK}/p1/
|
||||
|
||||
sudo cp -ra ${REPO}/brainux/* ${WORK}/p2/
|
||||
|
||||
sudo umount ${WORK}/p1 ${WORK}/p2
|
||||
sudo kpartx -d ${IMG}
|
||||
|
||||
rmdir ${WORK}/p1 ${WORK}/p2
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 550d9bd50c3b0591e91f05f96b6f159cdacad6fa
|
||||
Subproject commit a1c7346b9a87a762868be715be2296bcda314408
|
11
os-brainux/override.sh
Executable file
11
os-brainux/override.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -uex -o pipefail
|
||||
|
||||
SRC=$1
|
||||
DST=$2
|
||||
|
||||
install -g root -o root -m 0644 $SRC/usr/lib/os-release $DST/usr/lib/os-release
|
||||
install -g root -o root -m 0644 $SRC/etc/issue $DST/etc/issue
|
||||
install -g root -o root -m 0644 $SRC/etc/issue.net $DST/etc/issue.net
|
||||
install -g root -o root -m 0644 $SRC/etc/motd $DST/etc/motd
|
2
os-brainux/override/etc/issue
Normal file
2
os-brainux/override/etc/issue
Normal file
@ -0,0 +1,2 @@
|
||||
Brainux GNU/Linux 10 \n \l
|
||||
|
1
os-brainux/override/etc/issue.net
Normal file
1
os-brainux/override/etc/issue.net
Normal file
@ -0,0 +1 @@
|
||||
Brainux GNU/Linux 10
|
12
os-brainux/override/etc/motd
Normal file
12
os-brainux/override/etc/motd
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
____ _
|
||||
| _ \ (_)
|
||||
| |_) |_ __ __ _ _ _ __ _ ___ __
|
||||
| _ <| '__/ _` | | '_ \| | | \ \/ /
|
||||
| |_) | | | (_| | | | | | |_| |> <
|
||||
|____/|_| \__,_|_|_| |_|\__,_/_/\_\
|
||||
|
||||
by Brain Hackers
|
||||
|
||||
https://github.com/brain-hackers
|
||||
|
9
os-brainux/override/usr/lib/os-release
Normal file
9
os-brainux/override/usr/lib/os-release
Normal file
@ -0,0 +1,9 @@
|
||||
PRETTY_NAME="Brainux GNU/Linux 10 (buster)"
|
||||
NAME="Brainux GNU/Linux"
|
||||
VERSION_ID="10"
|
||||
VERSION="10 (buster)"
|
||||
VERSION_CODENAME=buster
|
||||
ID=debian
|
||||
HOME_URL="https://github.com/brain-hackers/README"
|
||||
SUPPORT_URL="https://github.com/brain-hackers/buildbrain"
|
||||
BUG_REPORT_URL="https://github.com/brain-hackers/buildbrain"
|
@ -4,14 +4,21 @@ TIMEZONE="Asia/Tokyo"
|
||||
|
||||
/debootstrap/debootstrap --second-stage
|
||||
|
||||
# Use local APT cache during debootstrap
|
||||
if [ "${CI}" == "true" ]; then
|
||||
REPO=deb.debian.org
|
||||
REPO_SECURITY=deb.debian.org
|
||||
else
|
||||
REPO=localhost:65432
|
||||
REPO_SECURITY=localhost:65433
|
||||
fi
|
||||
|
||||
cat <<EOF > /etc/apt/sources.list
|
||||
deb http://localhost:65432/debian buster main contrib non-free
|
||||
deb-src http://localhost:65432/debian buster main contrib non-free
|
||||
deb http://localhost:65432/debian buster-updates main contrib non-free
|
||||
deb-src http://localhost:65432/debian buster-updates main contrib non-free
|
||||
deb http://localhost:65433/debian-security buster/updates main contrib non-free
|
||||
deb-src http://localhost:65433/debian-security buster/updates main contrib non-free
|
||||
deb http://${REPO}/debian buster main contrib non-free
|
||||
deb-src http://${REPO}/debian buster main contrib non-free
|
||||
deb http://${REPO}/debian buster-updates main contrib non-free
|
||||
deb-src http://${REPO}/debian buster-updates main contrib non-free
|
||||
deb http://${REPO_SECURITY}/debian-security buster/updates main contrib non-free
|
||||
deb-src http://${REPO_SECURITY}/debian-security buster/updates main contrib non-free
|
||||
EOF
|
||||
|
||||
cat <<EOF > /etc/apt/apt.conf.d/90-norecommend
|
||||
@ -44,6 +51,7 @@ DEBIAN_FRONTEND=noninteractive \
|
||||
xserver-xorg xserver-xorg-video-fbdev xserver-xorg-dev xorg-dev x11-apps \
|
||||
openbox obconf obmenu \
|
||||
weston xwayland \
|
||||
alsa-utils \
|
||||
bash tmux vim htop \
|
||||
midori pcmanfm lxterminal xterm gnome-terminal fonts-noto-cjk \
|
||||
dbus udev build-essential flex bison pkg-config autotools-dev libtool autoconf automake \
|
||||
@ -52,11 +60,11 @@ DEBIAN_FRONTEND=noninteractive \
|
||||
|
||||
# Get wild
|
||||
cat <<EOF > /etc/apt/sources.list
|
||||
deb http://ftp.jaist.ac.jp/debian buster main contrib non-free
|
||||
deb-src http://ftp.jaist.ac.jp/debian buster main contrib non-free
|
||||
deb http://ftp.jaist.ac.jp/debian buster-updates main contrib non-free
|
||||
deb-src http://ftp.jaist.ac.jp/debian buster-updates main contrib non-free
|
||||
deb http://security.debian.org/debian-security buster/updates main contrib non-free
|
||||
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
|
||||
deb http://deb.debian.org/debian buster main contrib non-free
|
||||
deb-src http://deb.debian.org/debian buster main contrib non-free
|
||||
deb http://deb.debian.org/debian buster-updates main contrib non-free
|
||||
deb-src http://deb.debian.org/debian buster-updates main contrib non-free
|
||||
deb http://deb.debian.org/debian-security buster/updates main contrib non-free
|
||||
deb-src http://deb.debian.org/debian-security buster/updates main contrib non-free
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user