mirror of
https://github.com/brain-hackers/buildbrain
synced 2026-03-29 09:11:08 +09:00
Compare commits
1 Commits
2023-07-29
...
suspend
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35f04a7b11 |
14
.github/workflows/build.yml
vendored
14
.github/workflows/build.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: false
|
submodules: false
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
needs: [create_release]
|
needs: [create_release]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Workaround for apt update failure
|
- name: Workaround for apt update failure
|
||||||
@@ -91,7 +91,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
needs: [create_release]
|
needs: [create_release]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Workaround for apt update failure
|
- name: Workaround for apt update failure
|
||||||
@@ -154,7 +154,7 @@ jobs:
|
|||||||
lilo: gen3_7.bin
|
lilo: gen3_7.bin
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Workaround for apt update failure
|
- name: Workaround for apt update failure
|
||||||
@@ -200,7 +200,7 @@ jobs:
|
|||||||
- model: h1
|
- model: h1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Workaround for apt update failure
|
- name: Workaround for apt update failure
|
||||||
@@ -234,7 +234,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
needs: [create_release]
|
needs: [create_release]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Make /opt writable
|
- name: Make /opt writable
|
||||||
@@ -277,7 +277,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
needs: [create_release]
|
needs: [create_release]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Workaround for apt update failure
|
- name: Workaround for apt update failure
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -13,6 +13,3 @@
|
|||||||
[submodule "brainlilo"]
|
[submodule "brainlilo"]
|
||||||
path = brainlilo
|
path = brainlilo
|
||||||
url = https://github.com/brain-hackers/brainlilo.git
|
url = https://github.com/brain-hackers/brainlilo.git
|
||||||
[submodule "buildroot"]
|
|
||||||
path = buildroot
|
|
||||||
url = https://github.com/brain-hackers/buildroot.git
|
|
||||||
|
|||||||
16
Makefile
16
Makefile
@@ -135,6 +135,7 @@ lilobuild:
|
|||||||
liloclean:
|
liloclean:
|
||||||
make -C ./brainlilo clean
|
make -C ./brainlilo clean
|
||||||
|
|
||||||
|
|
||||||
brainux:
|
brainux:
|
||||||
@if [ "$(shell uname)" != "Linux" ]; then \
|
@if [ "$(shell uname)" != "Linux" ]; then \
|
||||||
echo "Debootstrap is only available in Linux!"; \
|
echo "Debootstrap is only available in Linux!"; \
|
||||||
@@ -149,26 +150,15 @@ brainux:
|
|||||||
fi
|
fi
|
||||||
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
|
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
|
||||||
sudo cp ./os-brainux/setup_brainux.sh brainux/
|
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 -E chroot brainux /setup_brainux.sh
|
||||||
sudo rm brainux/setup_brainux.sh
|
sudo rm brainux/setup_brainux.sh
|
||||||
sudo ./os-brainux/override.sh ./os-brainux/override ./brainux
|
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/sd.img: clean_work
|
||||||
./image/build_image.sh brainux sd.img 3072
|
./image/build_image.sh
|
||||||
|
|
||||||
image/sd_x1.img: clean_work
|
image/sd_x1.img: clean_work
|
||||||
./image/build_image_x1.sh brainux sd_x1.img 3072
|
./image/build_image_x1.sh
|
||||||
|
|
||||||
image/sd_buildroot.img: clean_work
|
|
||||||
./image/build_image.sh buildroot_rootfs sd_buildroot.img 128
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
clean_work:
|
clean_work:
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -94,8 +94,8 @@ Build Linux
|
|||||||
1. Confirm that `linux-brain/arch/arm/boot/zImage` exists.
|
1. Confirm that `linux-brain/arch/arm/boot/zImage` exists.
|
||||||
|
|
||||||
|
|
||||||
Build a Debian rootfs
|
Bootstrap Debian 11 (bullseye)
|
||||||
---------------------
|
------------------------------
|
||||||
|
|
||||||
1. Run `make ldefconfig lbuild`.
|
1. Run `make ldefconfig lbuild`.
|
||||||
|
|
||||||
@@ -107,23 +107,9 @@ Build a Debian rootfs
|
|||||||
|
|
||||||
1. Confirm that `image/sd.img` is built and burn it to an SD card.
|
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
|
Known issues
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
If you use GCC 10 for the host compiler, `make ubuild` may fail.
|
If you using gcc 10 for 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;`
|
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
|
Watch changes in submodules & auto-build
|
||||||
|
|||||||
Submodule buildroot deleted from e39044fa44
@@ -5,10 +5,7 @@ JOBS=$(nproc)
|
|||||||
REPO=$(git rev-parse --show-toplevel)
|
REPO=$(git rev-parse --show-toplevel)
|
||||||
WORK=${REPO}/image/work
|
WORK=${REPO}/image/work
|
||||||
LINUX=${REPO}/linux-brain
|
LINUX=${REPO}/linux-brain
|
||||||
ROOTFS=$1
|
IMG=${REPO}/image/sd.img
|
||||||
IMG_NAME=$2
|
|
||||||
IMG=${REPO}/image/${IMG_NAME}
|
|
||||||
SIZE_M=$3
|
|
||||||
export CROSS_COMPILE=arm-linux-gnueabi-
|
export CROSS_COMPILE=arm-linux-gnueabi-
|
||||||
|
|
||||||
mkdir -p ${WORK}
|
mkdir -p ${WORK}
|
||||||
@@ -37,7 +34,7 @@ for i in "a7200" "sh1" "sh2" "sh3" "sh4" "sh5" "sh6" "sh7"; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
dd if=/dev/zero of=${IMG} bs=1M count=${SIZE_M}
|
dd if=/dev/zero of=${IMG} bs=1M count=3072
|
||||||
|
|
||||||
START1=2048
|
START1=2048
|
||||||
SECTORS1=$((1024 * 1024 * 64 / 512))
|
SECTORS1=$((1024 * 1024 * 64 / 512))
|
||||||
@@ -52,7 +49,7 @@ sfdisk ${IMG} < ${WORK}/part.sfdisk
|
|||||||
|
|
||||||
sudo kpartx -av ${IMG}
|
sudo kpartx -av ${IMG}
|
||||||
|
|
||||||
LOOPDEV=$(losetup -l | grep ${IMG_NAME} | grep -o 'loop.' | tail -n 1)
|
LOOPDEV=$(losetup -l | grep sd.img | grep -o 'loop.' | tail -n 1)
|
||||||
|
|
||||||
sudo mkfs.fat -n boot -F32 -v -I /dev/mapper/${LOOPDEV}p1
|
sudo mkfs.fat -n boot -F32 -v -I /dev/mapper/${LOOPDEV}p1
|
||||||
sudo mkfs.ext4 -L rootfs /dev/mapper/${LOOPDEV}p2
|
sudo mkfs.ext4 -L rootfs /dev/mapper/${LOOPDEV}p2
|
||||||
@@ -74,13 +71,13 @@ sudo touch "${LILO}/index.din"
|
|||||||
sudo touch "${LILO}/AppMain.cfg"
|
sudo touch "${LILO}/AppMain.cfg"
|
||||||
sudo cp ${REPO}/brainlilo/*.dll "${LILO}/"
|
sudo cp ${REPO}/brainlilo/*.dll "${LILO}/"
|
||||||
sudo cp ${REPO}/brainlilo/BrainLILO.exe "${LILO}/AppMain_.exe"
|
sudo cp ${REPO}/brainlilo/BrainLILO.exe "${LILO}/AppMain_.exe"
|
||||||
gzip -cd ${REPO}/image/exeopener.exe.gz > ${REPO}/image/exeopener.exe
|
gzip -d ${REPO}/image/exeopener.exe.gz
|
||||||
sudo cp ${REPO}/image/exeopener.exe "${LILO}/AppMain.exe"
|
sudo cp ${REPO}/image/exeopener.exe "${LILO}/AppMain.exe"
|
||||||
|
|
||||||
sudo mkdir -p ${WORK}/p1/loader
|
sudo mkdir -p ${WORK}/p1/loader
|
||||||
sudo cp ${WORK}/lilobin/*.bin ${WORK}/p1/loader/
|
sudo cp ${WORK}/lilobin/*.bin ${WORK}/p1/loader/
|
||||||
|
|
||||||
sudo cp -ra ${REPO}/${ROOTFS}/* ${WORK}/p2/
|
sudo cp -ra ${REPO}/brainux/* ${WORK}/p2/
|
||||||
|
|
||||||
sudo umount ${WORK}/p1 ${WORK}/p2
|
sudo umount ${WORK}/p1 ${WORK}/p2
|
||||||
sudo kpartx -d ${IMG}
|
sudo kpartx -d ${IMG}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -11,6 +11,8 @@ 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/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
|
install -g root -o root -m 0644 $SRC/etc/X11/Xsession.d/96calibrate $DST/etc/X11/Xsession.d/96calibrate
|
||||||
|
|
||||||
|
install -g root -o root -m 0644 $SRC/etc/systemd/logind.conf $DST/etc/systemd/logind.conf
|
||||||
|
|
||||||
install -g root -o root -m 0644 -D $SRC/etc/xdg/weston/weston.ini $DST/etc/xdg/weston/weston.ini
|
install -g root -o root -m 0644 -D $SRC/etc/xdg/weston/weston.ini $DST/etc/xdg/weston/weston.ini
|
||||||
|
|
||||||
install -g 1000 -o 1000 -m 0644 $SRC/home/user/.xprofile $DST/home/user/.xprofile
|
install -g 1000 -o 1000 -m 0644 $SRC/home/user/.xprofile $DST/home/user/.xprofile
|
||||||
|
|||||||
41
os-brainux/override/etc/systemd/logind.conf
Normal file
41
os-brainux/override/etc/systemd/logind.conf
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# This file is part of systemd.
|
||||||
|
#
|
||||||
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Entries in this file show the compile time defaults.
|
||||||
|
# You can change settings by editing this file.
|
||||||
|
# Defaults can be restored by simply deleting this file.
|
||||||
|
#
|
||||||
|
# See logind.conf(5) for details.
|
||||||
|
|
||||||
|
[Login]
|
||||||
|
#NAutoVTs=6
|
||||||
|
#ReserveVT=6
|
||||||
|
#KillUserProcesses=no
|
||||||
|
#KillOnlyUsers=
|
||||||
|
#KillExcludeUsers=root
|
||||||
|
#InhibitDelayMaxSec=5
|
||||||
|
#UserStopDelaySec=10
|
||||||
|
HandlePowerKey=suspend
|
||||||
|
#HandleSuspendKey=suspend
|
||||||
|
#HandleHibernateKey=hibernate
|
||||||
|
#HandleLidSwitch=suspend
|
||||||
|
#HandleLidSwitchExternalPower=suspend
|
||||||
|
#HandleLidSwitchDocked=ignore
|
||||||
|
#HandleRebootKey=reboot
|
||||||
|
#PowerKeyIgnoreInhibited=no
|
||||||
|
#SuspendKeyIgnoreInhibited=no
|
||||||
|
#HibernateKeyIgnoreInhibited=no
|
||||||
|
#LidSwitchIgnoreInhibited=yes
|
||||||
|
#RebootKeyIgnoreInhibited=no
|
||||||
|
#HoldoffTimeoutSec=30s
|
||||||
|
#IdleAction=ignore
|
||||||
|
#IdleActionSec=30min
|
||||||
|
#RuntimeDirectorySize=10%
|
||||||
|
#RuntimeDirectoryInodes=400k
|
||||||
|
#RemoveIPC=yes
|
||||||
|
#InhibitorsMax=8192
|
||||||
|
#SessionsMax=8192
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Mount boot partition
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=/dev/mmcblk1p1
|
|
||||||
Where=/boot
|
|
||||||
Options=ro
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Enable RNDIS USB Gadget
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/usr/bin/enable_rndis_gadget
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -136,12 +136,6 @@ ttymxc0
|
|||||||
ttyLP0
|
ttyLP0
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Enable /boot mount
|
|
||||||
systemctl enable boot.mount
|
|
||||||
|
|
||||||
# Enable RNDIS gadget
|
|
||||||
systemctl enable rndis_gadget
|
|
||||||
|
|
||||||
# Get wild
|
# Get wild
|
||||||
cat <<EOF > /etc/apt/sources.list
|
cat <<EOF > /etc/apt/sources.list
|
||||||
deb http://deb.debian.org/debian bullseye main contrib non-free
|
deb http://deb.debian.org/debian bullseye main contrib non-free
|
||||||
|
|||||||
Reference in New Issue
Block a user