Compare commits

...

49 Commits

Author SHA1 Message Date
Takumi Sueda 0c7861189b
Merge pull request #57 from brain-hackers/ci-next
Upgrade submodules etc.
2024-02-03 23:26:06 -08:00
Takumi Sueda 4257f2465a Workaround workaround 2024-02-04 16:13:11 +09:00
Takumi Sueda 24e5428c62 Build U-Boot specially made for PW-A7400 2024-02-04 16:13:11 +09:00
Takumi Sueda 086c5b08f5 Add x11-ico-dvd, remove weston and xwayland 2024-02-04 16:13:11 +09:00
Takumi Sueda 9d65cf08dd Update linux-brain, u-boot-brain, and brainlilo 2024-02-04 16:13:08 +09:00
Takumi Sueda 68e6e1091e
Merge pull request #56 from brain-hackers/buildroot-experiment
Enhance buildroot rootfs
2023-07-31 22:24:07 +09:00
Takumi Sueda ce8d780b33 Enhance blink.sh 2023-07-31 22:09:11 +09:00
Takumi Sueda b561fdaec9 buildroot: specify an override directory to add files into the buildroot rootfs 2023-07-31 18:34:50 +09:00
Takumi Sueda 611706771f
Merge pull request #55 from brain-hackers/readme
Update README
2023-07-29 01:36:35 +09:00
Takumi Sueda 2fa3904480 Update README 2023-07-29 01:35:28 +09:00
Takumi Sueda 3479812f91
Merge pull request #54 from brain-hackers/ci-buildroot
Add buildroot rootfs target and SD image target
2023-07-29 01:17:07 +09:00
Takumi Sueda 94d37b1b76 Add buildroot w/ Brain board definition 2023-07-29 00:24:37 +09:00
Takumi Sueda d6719fd49f Enhance build scripts to generate a buildroot SD image 2023-07-29 00:24:37 +09:00
Takumi Sueda 1de1747fbb Add buildroot submodule 2023-07-29 00:24:37 +09:00
Takumi Sueda d885ca6bc1
Merge pull request #53 from brain-hackers/ci-fix
Fix CI and integrate additional systemd units
2023-07-29 00:23:32 +09:00
Takumi Sueda b242f06d78 Copy systemd units before setup 2023-07-28 21:40:02 +09:00
Takumi Sueda d534aa7416 Call daemon-reload before enabling boot.mount 2023-07-24 17:40:55 +09:00
Takumi Sueda 870363a92e Use the latest checkout action 2023-07-24 17:39:08 +09:00
Takumi Sueda 8ca8a3ab12
Merge pull request #52 from brain-hackers/misc
Misc. addition
2023-03-27 20:01:31 +09:00
Takumi Sueda 33e3afbf13 Enable RNDIS gadget automatically 2023-03-27 19:55:11 +09:00
Takumi Sueda bc2c108d77 Mount /boot automatically 2023-03-21 18:01:11 +09:00
Takumi Sueda ee93757ff1
Merge pull request #51 from brain-hackers/ci-ly-fix
Switch ly repository to freeze the source code
2023-01-18 04:25:37 +09:00
Takumi Sueda 9f41a0bbd2 Switch ly repository to freeze the source code 2023-01-10 19:14:57 +09:00
Takumi Sueda 9671252f5d
Merge pull request #50 from brain-hackers/ci-bullseye
Change the base rootfs to bullseye
2022-12-21 13:11:01 +09:00
Takumi Sueda 935363d6ac Change the base rootfs to bullseye
It is unintentionally reverted back to buster
2022-12-21 13:09:18 +09:00
Takumi Sueda 25668a72e3
Merge pull request #49 from brain-hackers/bump
Update linux-brain: update keyboard driver & maximize brightness
2022-12-08 01:03:01 +09:00
Takumi Sueda d7da4a6e44 Update linux-brain: update keyboard driver & maximize brightness 2022-12-08 01:02:34 +09:00
Takumi Sueda 8f3f63be44
Merge pull request #48 from brain-hackers/ci-timesyncd
Add systemd-timesyncd & revert back issue and os-release
2022-11-24 00:23:56 +09:00
Takumi Sueda a4350f303c Fix sudoers 2022-11-23 23:28:22 +09:00
Takumi Sueda f7a20f61b7 Revert back issue and os-release 2022-11-23 23:20:09 +09:00
Takumi Sueda 2ecec60001 Add systemd-timesyncd 2022-11-23 23:14:38 +09:00
Takumi Sueda eaa027db98
Merge pull request #47 from brain-hackers/sudoer
Show asterisks in sudo
2022-11-23 23:07:09 +09:00
Takumi Sueda 53e39a8bb6 Show asterisks in sudo 2022-11-23 23:00:06 +09:00
Takumi Sueda 453fe8d60f
Merge pull request #46 from brain-hackers/ci-update
Bump versions
2022-11-23 02:06:05 +08:00
Takumi Sueda e7d3c4629a G5300 -> A7200 2022-11-23 01:23:39 +09:00
Takumi Sueda 57c5052909 Update BrainLILO: support 1G
1G is supported by no one else though
2022-11-23 00:14:58 +09:00
Takumi Sueda 84960b1471 Update u-boot-brain: unify 2G, update env 2022-11-23 00:12:11 +09:00
Takumi Sueda 515aff62be Update linux-brain: unify 2G, enable UAC 2022-11-23 00:11:29 +09:00
Takumi Sueda 6cf0f749d4
Merge pull request #44 from brain-hackers/fix
Fix
2022-11-13 20:35:42 +08:00
Takumi Sueda 7ca8ed3cc1 Install ly service 2022-11-13 21:35:03 +09:00
Takumi Sueda f444f68a3b Install ca-certificates 2022-11-13 11:48:38 +09:00
Takumi Sueda f503ef87ef
Merge pull request #43 from brain-hackers/license
Add exeopener license agreement
2022-11-04 10:36:54 +09:00
Takumi Sueda 3f4afedf45 Add exeopener license agreement
as per the body approved by the original author
2022-11-03 00:39:09 +09:00
Takumi Sueda 5e92df0600 Update u-boot-brain 2022-08-27 16:30:48 +09:00
Takumi Sueda e09c0ba017
Merge pull request #42 from brain-hackers/sh4
Update linux-brain: add SH4 keymap
2022-08-07 18:27:53 +09:00
Takumi Sueda d74ba8a70f Update linux-brain: add SH4 keymap 2022-08-07 18:27:09 +09:00
Takumi Sueda ec695f99f0
Merge pull request #41 from brain-hackers/ci-brain-config
Pre-install brain-config
2022-08-07 18:24:24 +09:00
Takumi Sueda 22235e8cf0 Install brain-config from packagecloud 2022-08-07 14:32:11 +09:00
Takumi Sueda 9529327097 Refactor apt install 2022-08-07 14:32:11 +09:00
21 changed files with 326 additions and 54 deletions

View File

@ -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
@ -41,11 +41,11 @@ jobs:
runs-on: ubuntu-20.04
needs: [create_release]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- 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 build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap python3-pip
- name: Upgrade pip and setuptools
@ -91,11 +91,11 @@ jobs:
runs-on: ubuntu-20.04
needs: [create_release]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- 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 build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabihf libssl-dev lzop qemu-user-static debootstrap
- name: Configure for Linux
@ -128,9 +128,12 @@ jobs:
strategy:
matrix:
include:
- model: g5300
- 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
@ -154,11 +157,11 @@ jobs:
lilo: gen3_7.bin
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- 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 build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap
- name: Build nkbin-maker
@ -200,11 +203,11 @@ jobs:
- model: h1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- 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 build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabihf libssl-dev lzop qemu-user-static debootstrap
- name: Configure for U-Boot
@ -234,7 +237,7 @@ jobs:
runs-on: ubuntu-20.04
needs: [create_release]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Make /opt writable
@ -245,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
@ -277,11 +280,11 @@ jobs:
runs-on: ubuntu-20.04
needs: [create_release]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- 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-gnueabihf libssl-dev lzop qemu-user-static debootstrap
- name: Upgrade pip and setuptools

3
.gitmodules vendored
View File

@ -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

View File

@ -135,7 +135,6 @@ lilobuild:
liloclean:
make -C ./brainlilo clean
brainux:
@if [ "$(shell uname)" != "Linux" ]; then \
echo "Debootstrap is only available in Linux!"; \
@ -144,21 +143,32 @@ brainux:
sudo mkdir -p brainux
@if [ "$(CI)" = "true" ]; then \
echo "I'm in CI and debootstrap without cache."; \
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign buster brainux/; \
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign bullseye brainux/; \
else \
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign buster brainux/ http://localhost:65432/debian/; \
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign bullseye 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 ./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
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:

View File

@ -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 c826f2581ea8de6c32565be7ffa632c9766d5385
Subproject commit 2ec8f7827e40ec8dfe6b7f5b0200e1effaf1b855

1
buildroot Submodule

@ -0,0 +1 @@
Subproject commit cf3ea901082f470449bd174272d8407e039522b2

23
image/LICENSE Normal file
View File

@ -0,0 +1,23 @@
*** exeopener ***
MIT License
Copyright (c) 2022 Chiharu Shirasaka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -5,13 +5,16 @@ 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 "g5300" "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
@ -19,9 +22,11 @@ for i in "g5300" "sh1" "sh2" "sh3" "sh4" "sh5" "sh6" "sh7"; do
${REPO}/nkbin_maker/bsd-ce ${REPO}/u-boot-brain/u-boot.bin
case $i in
"g5300")
"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;;
@ -34,7 +39,7 @@ for i in "g5300" "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))
@ -49,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
@ -71,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 e342c1c00092283097a51f236dfcccd503c44925
Subproject commit afbb7e017623f0963270cbad512f1d83b83a3d5b

10
os-brainux/override-pre.sh Executable file
View 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

View File

@ -5,10 +5,8 @@ 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
install -g root -o root -m 0440 $SRC/etc/sudoers $DST/etc/sudoers
install -g root -o root -m 0644 $SRC/etc/X11/xorg.conf $DST/etc/X11/xorg.conf
install -g root -o root -m 0644 $SRC/etc/X11/Xsession.d/96calibrate $DST/etc/X11/Xsession.d/96calibrate

View File

@ -1,2 +0,0 @@
Brainux GNU/Linux 10 \n \l

View File

@ -1 +0,0 @@
Brainux GNU/Linux 10

View File

@ -0,0 +1,27 @@
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset,pwfeedback
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "@include" directives:
@includedir /etc/sudoers.d

View File

@ -0,0 +1,10 @@
[Unit]
Description=Mount boot partition
[Mount]
What=/dev/mmcblk1p1
Where=/boot
Options=ro
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,9 @@
[Unit]
Description=Enable RNDIS USB Gadget
[Service]
Type=oneshot
ExecStart=/usr/bin/enable_rndis_gadget
[Install]
WantedBy=multi-user.target

View 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

View File

@ -1,9 +0,0 @@
PRETTY_NAME="Brainux GNU/Linux 11 (bullseye)"
NAME="Brainux GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
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"

View File

@ -33,6 +33,7 @@ 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
@ -50,22 +51,48 @@ rm /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
echo "brain" > /etc/hostname
# Install packagecloud repository
# Reference: https://packagecloud.io/brainhackers/brainux/install
# curl, ca-certificates: downloads the GPG key from packagecloud
# gnupg, debian-archive-keyring: packagecloud verification dependency
DEBIAN_FRONTEND=noninteractive \
apt install -y curl ca-certificates gnupg debian-archive-keyring
# apt-transport-https can be installed after debian-archive-keyring being installed
DEBIAN_FRONTEND=noninteractive \
apt install -y apt-transport-https
# Install GPG key and packagecloud repository config
mkdir -p /etc/apt/keyrings
curl -fsSL "https://packagecloud.io/brainhackers/brainux/gpgkey" \
| gpg --dearmor > /etc/apt/keyrings/brainhackers_brainux-archive-keyring.gpg
cat <<EOF > /etc/apt/sources.list.d/packagecloud.list
deb [signed-by=/etc/apt/keyrings/brainhackers_brainux-archive-keyring.gpg] https://packagecloud.io/brainhackers/brainux/any/ any main
deb-src [signed-by=/etc/apt/keyrings/brainhackers_brainux-archive-keyring.gpg] https://packagecloud.io/brainhackers/brainux/any/ any main
EOF
# Fetch packagecloud repository
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\
dbus udev alsa-utils usbutils iw fake-hwclock systemd-timesyncd\
build-essential flex bison pkg-config autotools-dev libtool autoconf automake device-tree-compiler \
python3 python3-dev python3-setuptools python3-wheel python3-pip python3-smbus \
resolvconf net-tools ssh openssh-client avahi-daemon curl wget git \
network-manager zip neofetch sl python3-numpy ipython3 netsurf-gtk
resolvconf net-tools ssh openssh-client avahi-daemon wget git \
network-manager zip neofetch sl python3-numpy ipython3 netsurf-gtk fcitx-anthy
# Packages from packagecloud
DEBIAN_FRONTEND=noninteractive \
apt install -y --install-recommends fcitx-anthy
apt install -y --install-recommends brain-config
systemctl enable fake-hwclock
@ -73,10 +100,11 @@ systemctl enable fake-hwclock
DEBIAN_FRONTEND=noninteractive \
apt install -y libpam0g-dev libxcb-xkb-dev
cd /
git clone --recurse-submodules https://github.com/nullgemm/ly.git
git clone --recurse-submodules -b master-24f017e https://github.com/brain-hackers/ly.git
cd ly
make
make install
make installsystemd
cd /
rm -r ly
systemctl enable ly
@ -107,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

View 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 +1 @@
Subproject commit 0449ff1430e6d3eb3d0086aaab1e7a74078f8085
Subproject commit e8fc0d0cf39d9cd06245ef1777d1cf54258e5cb6