mirror of
https://github.com/brain-hackers/buildbrain
synced 2024-06-09 23:36:04 +09:00
Compare commits
21 Commits
ci-nikkei-
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
0c7861189b | ||
|
4257f2465a | ||
|
24e5428c62 | ||
|
086c5b08f5 | ||
|
9d65cf08dd | ||
|
68e6e1091e | ||
|
ce8d780b33 | ||
|
b561fdaec9 | ||
|
611706771f | ||
|
2fa3904480 | ||
|
3479812f91 | ||
|
94d37b1b76 | ||
|
d6719fd49f | ||
|
1de1747fbb | ||
|
d885ca6bc1 | ||
|
b242f06d78 | ||
|
d534aa7416 | ||
|
870363a92e | ||
|
8ca8a3ab12 | ||
|
33e3afbf13 | ||
|
bc2c108d77 |
250
.github/workflows/build.yml
vendored
250
.github/workflows/build.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: false
|
||||
|
@ -37,11 +37,207 @@ jobs:
|
|||
draft: false
|
||||
prerelease: true
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm -f /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 python3-pip
|
||||
- name: Upgrade pip and setuptools
|
||||
run: pip3 install -U pip setuptools
|
||||
- name: Install listconfig
|
||||
run: pip3 install listconfig
|
||||
- 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
|
||||
- name: Generate listconfig
|
||||
run: listconfig ./linux-brain/Kconfig ./linux-brain/.config > listconfig
|
||||
- name: Upload listconfig
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
asset_path: listconfig
|
||||
asset_name: listconfig
|
||||
asset_content_type: text/plain
|
||||
|
||||
build-linux-x1:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm -f /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-gnueabihf libssl-dev lzop qemu-user-static debootstrap
|
||||
- name: Configure for Linux
|
||||
run: make ldefconfig-x1
|
||||
- name: Build Linux
|
||||
run: make lbuild
|
||||
- name: Setup releases
|
||||
id: release_name
|
||||
run: |
|
||||
mkdir release
|
||||
cp ./linux-brain/arch/arm/boot/dts/imx7ulp-pwh*.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-x1-${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:
|
||||
matrix:
|
||||
include:
|
||||
- model: a7200
|
||||
nk: edna3exe.bin
|
||||
lilo: gen2.bin
|
||||
- model: a7400
|
||||
nk: edna3exe.bin
|
||||
lilo: gen2_7400.bin
|
||||
- model: sh1
|
||||
nk: edsa1exe.bin
|
||||
lilo: gen3_1.bin
|
||||
- model: sh2
|
||||
nk: edsa2exe.bin
|
||||
lilo: gen3_2.bin
|
||||
- model: sh3
|
||||
nk: edsa3exe.bin
|
||||
lilo: gen3_3.bin
|
||||
- model: sh4
|
||||
nk: edsh4exe.bin
|
||||
lilo: gen3_4.bin
|
||||
- model: sh5
|
||||
nk: edsh5exe.bin
|
||||
lilo: gen3_5.bin
|
||||
- model: sh6
|
||||
nk: edsh6exe.bin
|
||||
lilo: gen3_6.bin
|
||||
- model: sh7
|
||||
nk: edsh7exe.bin
|
||||
lilo: gen3_7.bin
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm -f /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: Build nkbin-maker
|
||||
run: make nkbin-maker
|
||||
- name: Configure for U-Boot
|
||||
run: make udefconfig-${{ matrix.model }}
|
||||
- name: Build U-Boot
|
||||
run: make ubuild
|
||||
- name: Generate NK.bin
|
||||
run: make nk.bin
|
||||
- name: Setup releases
|
||||
id: release_name
|
||||
run: |
|
||||
mkdir release
|
||||
cp ./u-boot-brain/u-boot.bin release/u-boot.bin
|
||||
cp ./u-boot-brain/u-boot.bin release/${{ matrix.lilo }}
|
||||
cp ./u-boot-brain/u-boot.sb release/u-boot.sb
|
||||
cp ./nk.bin release/${{ matrix.nk }}
|
||||
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:
|
||||
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-x1:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- model: h1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm -f /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-gnueabihf libssl-dev lzop qemu-user-static debootstrap
|
||||
- name: Configure for U-Boot
|
||||
run: make udefconfig-${{ matrix.model }}
|
||||
- name: Build U-Boot
|
||||
run: make ubuild
|
||||
- name: Setup releases
|
||||
id: release_name
|
||||
run: |
|
||||
mkdir release
|
||||
cp ./u-boot-brain/u-boot.bin release/u-boot.bin
|
||||
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:
|
||||
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-sd:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Make /opt writable
|
||||
|
@ -52,7 +248,7 @@ jobs:
|
|||
unzip -q cegcc.zip
|
||||
cp -r cegcc /opt/
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
|
||||
run: sudo rm -f /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
|
||||
|
@ -60,7 +256,9 @@ jobs:
|
|||
- name: Build Linux
|
||||
run: make lbuild
|
||||
- name: Build Debian Root
|
||||
run: make minimal
|
||||
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\//}
|
||||
|
@ -77,3 +275,47 @@ jobs:
|
|||
asset_path: ${{ steps.image_name.outputs.name }}.zip
|
||||
asset_name: ${{ steps.image_name.outputs.name }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
build-sd-x1:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [create_release]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Workaround for apt update failure
|
||||
run: sudo rm -f /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-gnueabihf libssl-dev lzop qemu-user-static debootstrap
|
||||
- name: Upgrade pip and setuptools
|
||||
run: pip3 install -U pip setuptools
|
||||
- name: Install pyelftools
|
||||
run: pip3 install pyelftools
|
||||
- name: Build Boot4u
|
||||
run: make boot4ubuild
|
||||
- name: Configure for U-Boot
|
||||
run: make udefconfig-h1
|
||||
- name: Build U-Boot
|
||||
run: make ubuild
|
||||
- name: Configure for Linux
|
||||
run: make ldefconfig-x1
|
||||
- name: Build Linux
|
||||
run: make lbuild
|
||||
- name: Build Debian Root
|
||||
run: make brainux
|
||||
- name: Generate image name
|
||||
id: image_name
|
||||
run: echo ::set-output name=name::sdimage-x1-${GITHUB_REF/refs\/*s\//}
|
||||
- name: Build SD image
|
||||
run: make image/sd_x1.img && mv image/sd_x1.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
|
||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -13,3 +13,6 @@
|
|||
[submodule "brainlilo"]
|
||||
path = brainlilo
|
||||
url = https://github.com/brain-hackers/brainlilo.git
|
||||
[submodule "buildroot"]
|
||||
path = buildroot
|
||||
url = https://github.com/brain-hackers/buildroot.git
|
||||
|
|
26
Makefile
26
Makefile
|
@ -135,7 +135,6 @@ lilobuild:
|
|||
liloclean:
|
||||
make -C ./brainlilo clean
|
||||
|
||||
|
||||
brainux:
|
||||
@if [ "$(shell uname)" != "Linux" ]; then \
|
||||
echo "Debootstrap is only available in Linux!"; \
|
||||
|
@ -150,27 +149,26 @@ brainux:
|
|||
fi
|
||||
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
|
||||
sudo cp ./os-brainux/setup_brainux.sh brainux/
|
||||
sudo ./os-brainux/override-pre.sh ./os-brainux/override ./brainux
|
||||
sudo -E chroot brainux /setup_brainux.sh
|
||||
sudo rm brainux/setup_brainux.sh
|
||||
sudo ./os-brainux/override.sh ./os-brainux/override ./brainux
|
||||
|
||||
minimal:
|
||||
@if [ "$(shell uname)" != "Linux" ]; then \
|
||||
echo "Debootstrap is only available in Linux!"; \
|
||||
exit 1; \
|
||||
fi
|
||||
sudo mkdir -p brainux
|
||||
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign bullseye brainux/; \
|
||||
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
|
||||
sudo cp ./os-minimal/setup_brainux.sh brainux/
|
||||
sudo -E chroot brainux /setup_brainux.sh
|
||||
sudo rm brainux/setup_brainux.sh
|
||||
buildroot_rootfs:
|
||||
make -C buildroot brain_imx28_defconfig
|
||||
make -C buildroot -j 12
|
||||
sudo mkdir -p buildroot_rootfs
|
||||
sudo tar -C ./buildroot_rootfs -xf buildroot/output/images/rootfs.tar
|
||||
|
||||
image/sd.img: clean_work
|
||||
./image/build_image.sh
|
||||
./image/build_image.sh brainux sd.img 3072
|
||||
|
||||
image/sd_x1.img: clean_work
|
||||
./image/build_image_x1.sh
|
||||
./image/build_image_x1.sh brainux sd_x1.img 3072
|
||||
|
||||
image/sd_buildroot.img: clean_work
|
||||
./image/build_image.sh buildroot_rootfs sd_buildroot.img 128
|
||||
|
||||
|
||||
.PHONY:
|
||||
clean_work:
|
||||
|
|
20
README.md
20
README.md
|
@ -94,8 +94,8 @@ Build Linux
|
|||
1. Confirm that `linux-brain/arch/arm/boot/zImage` exists.
|
||||
|
||||
|
||||
Bootstrap Debian 11 (bullseye)
|
||||
------------------------------
|
||||
Build a Debian rootfs
|
||||
---------------------
|
||||
|
||||
1. Run `make ldefconfig lbuild`.
|
||||
|
||||
|
@ -107,9 +107,23 @@ Bootstrap Debian 11 (bullseye)
|
|||
|
||||
1. Confirm that `image/sd.img` is built and burn it to an SD card.
|
||||
|
||||
|
||||
Build a Buildroot rootfs
|
||||
------------------------
|
||||
|
||||
Buildroot rootfs aims to be the most lightweight rootfs for experimental use. `make buildroot_rootfs` runs the defconfig target for rootfs-only build and then builds the rootfs tarball and a CPIO archive for initramfs. `make image/sd_buildroot.img` makes a bootable SD image in `image` directory like the typical Brainux SD image.
|
||||
|
||||
If you want to customize the build of Buildroot, `cd` into `buildroot` and use the following targets:
|
||||
|
||||
- `make menuconfig` to change the configuration
|
||||
- `make` to build the rootfs (`-j` option might give you extra speed)
|
||||
|
||||
`image/sd_buildroot.img` target expects presence of the tarball at `buildroot/output/images/rootfs.tar`. You'll have to `clean` and rebuild every time you change the Buildroot's config before making the SD image.
|
||||
|
||||
|
||||
Known issues
|
||||
----------------------------------------
|
||||
If you using gcc 10 for host compiler, `make ubuild` may fail.
|
||||
If you use GCC 10 for the host compiler, `make ubuild` may fail.
|
||||
To complete build, open `/u-boot-brain/scripts/dtc/dtc-lexer.lex.c` or `/u-boot-brain/scripts/dtc/dtc-parser.tab.c` then comment out `YYLTYPE yylloc;`
|
||||
|
||||
Watch changes in submodules & auto-build
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0ef73cdeb41b6d56538fa0739210f935eb9f2768
|
||||
Subproject commit 2ec8f7827e40ec8dfe6b7f5b0200e1effaf1b855
|
1
buildroot
Submodule
1
buildroot
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit cf3ea901082f470449bd174272d8407e039522b2
|
|
@ -5,24 +5,33 @@ JOBS=$(nproc)
|
|||
REPO=$(git rev-parse --show-toplevel)
|
||||
WORK=${REPO}/image/work
|
||||
LINUX=${REPO}/linux-brain
|
||||
IMG=${REPO}/image/sd.img
|
||||
ROOTFS=$1
|
||||
IMG_NAME=$2
|
||||
IMG=${REPO}/image/${IMG_NAME}
|
||||
SIZE_M=$3
|
||||
export CROSS_COMPILE=arm-linux-gnueabi-
|
||||
|
||||
mkdir -p ${WORK}
|
||||
mkdir -p ${WORK}/lilobin
|
||||
|
||||
for i in "a7200" "sh1" "sh2" "sh3" "sh4" "sh5" "sh6" "sh7"; do
|
||||
for i in "a7200" "a7400" "sh1" "sh2" "sh3" "sh4" "sh5" "sh6" "sh7"; do
|
||||
NUM=$(echo $i | sed -E 's/sh//g')
|
||||
|
||||
make -C ${REPO}/u-boot-brain distclean pw${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
|
||||
"a7200")
|
||||
mv ${REPO}/nk.bin ${WORK}/edna3exe.bin
|
||||
mv ${REPO}/u-boot-brain/u-boot.bin ${WORK}/lilobin/gen2.bin;;
|
||||
"a7400")
|
||||
mv ${REPO}/u-boot-brain/u-boot.bin ${WORK}/lilobin/gen2_7400.bin;;
|
||||
"sh1" | "sh2" | "sh3")
|
||||
mv ${REPO}/nk.bin ${WORK}/edsa${NUM}exe.bin
|
||||
mv ${REPO}/u-boot-brain/u-boot.bin ${WORK}/lilobin/gen3_${NUM}.bin;;
|
||||
"sh4" | "sh5" | "sh6" | "sh7")
|
||||
mv ${REPO}/nk.bin ${WORK}/edsh${NUM}exe.bin
|
||||
mv ${REPO}/u-boot-brain/u-boot.bin ${WORK}/lilobin/gen3_${NUM}.bin;;
|
||||
*)
|
||||
echo "WTF: $i"
|
||||
|
@ -30,7 +39,7 @@ for i in "a7200" "sh1" "sh2" "sh3" "sh4" "sh5" "sh6" "sh7"; do
|
|||
esac
|
||||
done
|
||||
|
||||
dd if=/dev/zero of=${IMG} bs=1M count=3072
|
||||
dd if=/dev/zero of=${IMG} bs=1M count=${SIZE_M}
|
||||
|
||||
START1=2048
|
||||
SECTORS1=$((1024 * 1024 * 64 / 512))
|
||||
|
@ -45,7 +54,7 @@ sfdisk ${IMG} < ${WORK}/part.sfdisk
|
|||
|
||||
sudo kpartx -av ${IMG}
|
||||
|
||||
LOOPDEV=$(losetup -l | grep sd.img | grep -o 'loop.' | tail -n 1)
|
||||
LOOPDEV=$(losetup -l | grep ${IMG_NAME} | grep -o 'loop.' | tail -n 1)
|
||||
|
||||
sudo mkfs.fat -n boot -F32 -v -I /dev/mapper/${LOOPDEV}p1
|
||||
sudo mkfs.ext4 -L rootfs /dev/mapper/${LOOPDEV}p2
|
||||
|
@ -56,6 +65,8 @@ 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-pw*.dtb ${WORK}/p1/
|
||||
sudo mkdir -p ${WORK}/p1/nk
|
||||
sudo cp ${WORK}/*.bin ${WORK}/p1/nk/
|
||||
|
||||
make -C ${REPO}/brainlilo
|
||||
|
||||
|
@ -65,13 +76,13 @@ sudo touch "${LILO}/index.din"
|
|||
sudo touch "${LILO}/AppMain.cfg"
|
||||
sudo cp ${REPO}/brainlilo/*.dll "${LILO}/"
|
||||
sudo cp ${REPO}/brainlilo/BrainLILO.exe "${LILO}/AppMain_.exe"
|
||||
gzip -d ${REPO}/image/exeopener.exe.gz
|
||||
gzip -cd ${REPO}/image/exeopener.exe.gz > ${REPO}/image/exeopener.exe
|
||||
sudo cp ${REPO}/image/exeopener.exe "${LILO}/AppMain.exe"
|
||||
|
||||
sudo mkdir -p ${WORK}/p1/loader
|
||||
sudo cp ${WORK}/lilobin/*.bin ${WORK}/p1/loader/
|
||||
|
||||
sudo cp -ra ${REPO}/brainux/* ${WORK}/p2/
|
||||
sudo cp -ra ${REPO}/${ROOTFS}/* ${WORK}/p2/
|
||||
|
||||
sudo umount ${WORK}/p1 ${WORK}/p2
|
||||
sudo kpartx -d ${IMG}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 60e1cb92ee16b5ecf61baccdc19c4821d6b15aee
|
||||
Subproject commit afbb7e017623f0963270cbad512f1d83b83a3d5b
|
10
os-brainux/override-pre.sh
Executable file
10
os-brainux/override-pre.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -uex -o pipefail
|
||||
|
||||
SRC=$1
|
||||
DST=$2
|
||||
|
||||
install -g root -o root -m 0644 $SRC/lib/systemd/system/boot.mount $DST/lib/systemd/system/boot.mount
|
||||
install -g root -o root -m 0644 $SRC/lib/systemd/system/rndis_gadget.service $DST/lib/systemd/system/rndis_gadget.service
|
||||
install -g root -o root -m 0755 $SRC/usr/bin/enable_rndis_gadget $DST/usr/bin/enable_rndis_gadget
|
10
os-brainux/override/lib/systemd/system/boot.mount
Normal file
10
os-brainux/override/lib/systemd/system/boot.mount
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Mount boot partition
|
||||
|
||||
[Mount]
|
||||
What=/dev/mmcblk1p1
|
||||
Where=/boot
|
||||
Options=ro
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Enable RNDIS USB Gadget
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/enable_rndis_gadget
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
25
os-brainux/override/usr/bin/enable_rndis_gadget
Executable file
25
os-brainux/override/usr/bin/enable_rndis_gadget
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
g=/sys/kernel/config/usb_gadget/eth
|
||||
|
||||
mkdir ${g}
|
||||
|
||||
echo "0x3066" > ${g}/bcdDevice
|
||||
echo "1" > ${g}/os_desc/use
|
||||
echo "0xcd" > ${g}/os_desc/b_vendor_code
|
||||
echo "MSFT100" > ${g}/os_desc/qw_sign
|
||||
|
||||
mkdir ${g}/functions/rndis.rn0
|
||||
echo "RNDIS" > ${g}/functions/rndis.rn0/os_desc/interface.rndis/compatible_id
|
||||
echo "5162001" > ${g}/functions/rndis.rn0/os_desc/interface.rndis/sub_compatible_id
|
||||
echo "8a:15:8b:44:3a:02" > ${g}/functions/rndis.rn0/dev_addr
|
||||
echo "8a:15:8b:44:3a:01" > ${g}/functions/rndis.rn0/host_addr
|
||||
|
||||
mkdir ${g}/configs/c.1
|
||||
ln -s ${g}/functions/rndis.rn0 ${g}/configs/c.1/
|
||||
|
||||
echo "ci_hdrc.0" > ${g}/UDC
|
||||
|
||||
sleep 1
|
||||
ifconfig usb0 up
|
||||
dhclient
|
|
@ -80,9 +80,8 @@ apt update -y
|
|||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt install -y dialog sudo \
|
||||
libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev \
|
||||
xserver-xorg xserver-xorg-video-fbdev xserver-xorg-dev xserver-xorg-input-evdev xinput-calibrator xorg-dev x11-apps xinit \
|
||||
xserver-xorg xserver-xorg-video-fbdev xserver-xorg-dev xserver-xorg-input-evdev xinput-calibrator xorg-dev x11-apps x11-ico-dvd xinit \
|
||||
jwm \
|
||||
weston xwayland \
|
||||
bash tmux vim htop \
|
||||
midori pcmanfm lxterminal xterm gnome-terminal fbterm uim-fep uim-anthy fonts-noto-cjk \
|
||||
dbus udev alsa-utils usbutils iw fake-hwclock systemd-timesyncd\
|
||||
|
@ -136,6 +135,12 @@ ttymxc0
|
|||
ttyLP0
|
||||
EOF
|
||||
|
||||
# Enable /boot mount
|
||||
systemctl enable boot.mount
|
||||
|
||||
# Enable RNDIS gadget
|
||||
systemctl enable rndis_gadget
|
||||
|
||||
# Get wild
|
||||
cat <<EOF > /etc/apt/sources.list
|
||||
deb http://deb.debian.org/debian bullseye main contrib non-free
|
||||
|
|
112
os-buildroot/override/root/blink.sh
Executable file
112
os-buildroot/override/root/blink.sh
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/bin/sh
|
||||
set -u
|
||||
|
||||
VERBOSE=0
|
||||
PIN=""
|
||||
SLEEP=1
|
||||
GPIOS=""
|
||||
|
||||
while getopts "hvr:p:s:" OPT; do
|
||||
case "$OPT" in
|
||||
h)
|
||||
echo "Usage: blink.sh [-hv] [-r PIN_RANGE_FROM-PIN_RANGE_TO] [-p PIN] [-s SLEEP_SEC]"
|
||||
echo "Example: blink.sh -r 0-10 -p 12"
|
||||
echo " (blink from GPIO 0 to 10 and 12)"
|
||||
exit 0
|
||||
;;
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
r)
|
||||
RE='^([0-9]+)-([0-9]+)$'
|
||||
if echo $OPTARG | grep -qvE $RE; then
|
||||
echo "Error: invalid range: $OPTARG"
|
||||
exit 1
|
||||
fi
|
||||
FROM=$(echo $OPTARG | sed -E "s/$RE/\\1/")
|
||||
TO=$(echo $OPTARG | sed -E "s/$RE/\\2/")
|
||||
GPIOS="$GPIOS$(seq -s " " $FROM $TO) "
|
||||
;;
|
||||
p)
|
||||
if echo $OPTARG | grep -qvE "^[0-9]+$"; then
|
||||
echo "Error: invalid pin number: $OPTARG"
|
||||
exit 1
|
||||
fi
|
||||
GPIOS="$GPIOS$OPTARG "
|
||||
;;
|
||||
s)
|
||||
if echo $OPTARG | grep -qvE "^[0-9]+$"; then
|
||||
echo "Error: invalid sleep duration: $OPTARG"
|
||||
exit 1
|
||||
fi
|
||||
SLEEP=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $VERBOSE -eq 1 ]; then
|
||||
echo "Pins to iterate over: $GPIOS"
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" -ne "0" ]; then
|
||||
echo "Error: please run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
AVAILABLE_GPIOS=""
|
||||
|
||||
export_gpio() {
|
||||
echo $1 > /sys/class/gpio/export
|
||||
}
|
||||
|
||||
set_direction() {
|
||||
echo out > /sys/class/gpio/gpio$1/direction
|
||||
}
|
||||
|
||||
set_value() {
|
||||
echo $2 > /sys/class/gpio/gpio$1/value
|
||||
}
|
||||
|
||||
for i in $GPIOS; do
|
||||
if [ ! -e "/sys/class/gpio/gpio$i" ]; then
|
||||
export_gpio $i 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: failed to export the pin $i"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
set_direction $i 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
# Ignore the failure if the actual direction is out
|
||||
if grep -vq "out" /dsys/class/gpio/gpio$i/direction; then
|
||||
echo "Error: failed to set the direction of the pin $i to out"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
AVAILABLE_GPIOS="$AVAILABLE_GPIOS$i "
|
||||
done
|
||||
|
||||
echo "Available GPIOs: $AVAILABLE_GPIOS"
|
||||
|
||||
while [ 1 ]; do
|
||||
for i in $AVAILABLE_GPIOS; do
|
||||
set_value $i 1 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Warning: failed to set the value of the pin $i to high"
|
||||
fi
|
||||
done
|
||||
|
||||
sleep $SLEEP
|
||||
|
||||
for i in $AVAILABLE_GPIOS; do
|
||||
set_value $i 0 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Warning: failed to set the value of the pin $i to low"
|
||||
fi
|
||||
done
|
||||
|
||||
sleep $SLEEP
|
||||
done
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -uex -o pipefail
|
||||
|
||||
/debootstrap/debootstrap --second-stage
|
||||
|
||||
# cat <<EOF > /etc/apt/sources.list
|
||||
# deb http://deb.debian.org/debian bullseye main contrib non-free
|
||||
# deb-src http://deb.debian.org/debian bullseye main contrib non-free
|
||||
# deb http://deb.debian.org/debian bullseye-updates main contrib non-free
|
||||
# deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free
|
||||
# deb http://deb.debian.org/debian-security bullseye-security/updates main contrib non-free
|
||||
# deb-src http://deb.debian.org/debian-security bullseye-security/updates main contrib non-free
|
||||
# EOF
|
||||
|
||||
# cat <<EOF > /etc/apt/apt.conf.d/90-norecommend
|
||||
# APT::Install-Recommends "0";
|
||||
# APT::Install-Suggests "0";
|
||||
# EOF
|
||||
|
||||
# locales: locale has to be set before going any further
|
||||
apt update -y
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt install -y locales bash
|
||||
|
||||
echo "Asia/Tokyo" > /etc/timezone
|
||||
rm /etc/localtime
|
||||
dpkg-reconfigure -f noninteractive tzdata
|
||||
sed -i -e 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
|
||||
echo 'LANG="en_US.UTF-8"' > /etc/default/locale
|
||||
dpkg-reconfigure -f noninteractive locales
|
||||
update-locale LANG=en_US.UTF-8
|
||||
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
echo "brain" > /etc/hostname
|
||||
|
||||
# apt install -y sudo
|
||||
|
||||
# Network
|
||||
# apt install -y ca-certificates fake-hwclock systemd-timesyncd net-tools ssh avahi-daemon network-manager
|
||||
# systemctl enable fake-hwclock
|
||||
|
||||
# Setup users
|
||||
# adduser --gecos "" --disabled-password --home /home/user user
|
||||
# echo user:brain | chpasswd
|
||||
# echo "user ALL=(ALL:ALL) ALL" > /etc/sudoers.d/user
|
||||
|
||||
apt install -y ssh jwm xserver-xorg xserver-xorg-video-fbdev xserver-xorg-input-evdev xinput-calibrator x11-apps xinit xterm fonts-vlgothic
|
||||
|
||||
echo -e "127.0.1.1\tbrain" >> /etc/hosts
|
||||
|
||||
echo root:root | chpasswd
|
|
@ -1 +1 @@
|
|||
Subproject commit 783749833dcc9fd1cd318af7750c2b17be182852
|
||||
Subproject commit e8fc0d0cf39d9cd06245ef1777d1cf54258e5cb6
|
Loading…
Reference in New Issue
Block a user