mirror of
https://github.com/brain-hackers/buildbrain
synced 2026-03-29 09:11:08 +09:00
Compare commits
27 Commits
2022-04-08
...
emmc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9134d2b25c | ||
|
|
575b450af9 | ||
|
|
5852372b9b | ||
|
|
3817fc5eeb | ||
|
|
462651541a | ||
|
|
5e92df0600 | ||
|
|
e09c0ba017 | ||
|
|
d74ba8a70f | ||
|
|
ec695f99f0 | ||
|
|
22235e8cf0 | ||
|
|
9529327097 | ||
|
|
7e2b04ce18 | ||
|
|
8c7118f0b2 | ||
|
|
7a34055ef3 | ||
|
|
d64a316b1f | ||
|
|
d5ab036801 | ||
|
|
fe480d7b91 | ||
|
|
e15ce44891 | ||
|
|
0509bbbe6f | ||
|
|
a2295ecb55 | ||
|
|
07c32f712f | ||
|
|
89b4c120a2 | ||
|
|
1a4d1cd39a | ||
|
|
d8aa77a29f | ||
|
|
93de849023 | ||
|
|
0eb94960ca | ||
|
|
7299377004 |
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.release_name.outputs.name }}
|
tag_name: ${{ steps.release_name.outputs.name }}-tag
|
||||||
release_name: ${{ steps.release_name.outputs.name }}
|
release_name: ${{ steps.release_name.outputs.name }}
|
||||||
body_path: CHANGES.md
|
body_path: CHANGES.md
|
||||||
draft: false
|
draft: false
|
||||||
@@ -128,20 +128,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- model: g5300
|
||||||
|
nk: edna3exe.bin
|
||||||
|
lilo: gen2.bin
|
||||||
- model: sh1
|
- model: sh1
|
||||||
nk: edsa1exe.bin
|
nk: edsa1exe.bin
|
||||||
|
lilo: gen3_1.bin
|
||||||
- model: sh2
|
- model: sh2
|
||||||
nk: edsa2exe.bin
|
nk: edsa2exe.bin
|
||||||
|
lilo: gen3_2.bin
|
||||||
- model: sh3
|
- model: sh3
|
||||||
nk: edsa3exe.bin
|
nk: edsa3exe.bin
|
||||||
|
lilo: gen3_3.bin
|
||||||
- model: sh4
|
- model: sh4
|
||||||
nk: edsh4exe.bin
|
nk: edsh4exe.bin
|
||||||
|
lilo: gen3_4.bin
|
||||||
- model: sh5
|
- model: sh5
|
||||||
nk: edsh5exe.bin
|
nk: edsh5exe.bin
|
||||||
|
lilo: gen3_5.bin
|
||||||
- model: sh6
|
- model: sh6
|
||||||
nk: edsh6exe.bin
|
nk: edsh6exe.bin
|
||||||
|
lilo: gen3_6.bin
|
||||||
- model: sh7
|
- model: sh7
|
||||||
nk: edsh7exe.bin
|
nk: edsh7exe.bin
|
||||||
|
lilo: gen3_7.bin
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -164,6 +174,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir release
|
mkdir release
|
||||||
cp ./u-boot-brain/u-boot.bin release/u-boot.bin
|
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 ./u-boot-brain/u-boot.sb release/u-boot.sb
|
||||||
cp ./nk.bin release/${{ matrix.nk }}
|
cp ./nk.bin release/${{ matrix.nk }}
|
||||||
zip -r release.zip release/
|
zip -r release.zip release/
|
||||||
@@ -226,6 +237,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
- name: Make /opt writable
|
||||||
|
run: sudo chown "$(whoami):$(whoami)" /opt
|
||||||
|
- name: Install cegcc
|
||||||
|
run: |
|
||||||
|
wget -O cegcc.zip https://github.com/brain-hackers/cegcc-build/releases/download/2022-04-11-133546/cegcc-2022-04-11-133546.zip
|
||||||
|
unzip -q cegcc.zip
|
||||||
|
cp -r cegcc /opt/
|
||||||
- name: Workaround for apt update failure
|
- name: Workaround for apt update failure
|
||||||
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
|
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
|
|||||||
7
.gitmodules
vendored
7
.gitmodules
vendored
@@ -3,10 +3,13 @@
|
|||||||
url = https://github.com/brain-hackers/u-boot-brain.git
|
url = https://github.com/brain-hackers/u-boot-brain.git
|
||||||
[submodule "linux-brain"]
|
[submodule "linux-brain"]
|
||||||
path = linux-brain
|
path = linux-brain
|
||||||
url = https://github.com/brain-hackers/linux-brain
|
url = https://github.com/brain-hackers/linux-brain.git
|
||||||
[submodule "nkbin_maker"]
|
[submodule "nkbin_maker"]
|
||||||
path = nkbin_maker
|
path = nkbin_maker
|
||||||
url = https://github.com/brain-hackers/nkbin_maker.git
|
url = https://github.com/brain-hackers/nkbin_maker.git
|
||||||
[submodule "boot4u"]
|
[submodule "boot4u"]
|
||||||
path = boot4u
|
path = boot4u
|
||||||
url = https://github.com/brain-hackers/boot4u
|
url = https://github.com/brain-hackers/boot4u.git
|
||||||
|
[submodule "brainlilo"]
|
||||||
|
path = brainlilo
|
||||||
|
url = https://github.com/brain-hackers/brainlilo.git
|
||||||
|
|||||||
18
Makefile
18
Makefile
@@ -1,8 +1,8 @@
|
|||||||
JOBS=$(shell grep -c '^processor' /proc/cpuinfo)
|
JOBS=$(shell grep -c '^processor' /proc/cpuinfo)
|
||||||
|
|
||||||
UBOOT_CROSS=$(shell ./tools/getcross u-boot)
|
UBOOT_CROSS?=$(shell ./tools/getcross u-boot)
|
||||||
LINUX_CROSS=$(shell ./tools/getcross linux)
|
LINUX_CROSS?=$(shell ./tools/getcross linux)
|
||||||
ROOTFS_CROSS=$(shell ./tools/getcross rootfs)
|
ROOTFS_CROSS?=$(shell ./tools/getcross rootfs)
|
||||||
export ARCH=arm
|
export ARCH=arm
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
@@ -127,6 +127,15 @@ boot4ubuild:
|
|||||||
boot4uclean:
|
boot4uclean:
|
||||||
make -C ./boot4u clean
|
make -C ./boot4u clean
|
||||||
|
|
||||||
|
.PHONY:
|
||||||
|
lilobuild:
|
||||||
|
make -C ./brainlilo
|
||||||
|
|
||||||
|
.PHONY:
|
||||||
|
liloclean:
|
||||||
|
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!"; \
|
||||||
@@ -148,6 +157,9 @@ brainux:
|
|||||||
image/sd.img: clean_work
|
image/sd.img: clean_work
|
||||||
./image/build_image.sh
|
./image/build_image.sh
|
||||||
|
|
||||||
|
image/emmc.img: clean_work
|
||||||
|
./image/build_image_emmc.sh
|
||||||
|
|
||||||
image/sd_x1.img: clean_work
|
image/sd_x1.img: clean_work
|
||||||
./image/build_image_x1.sh
|
./image/build_image_x1.sh
|
||||||
|
|
||||||
|
|||||||
1
brainlilo
Submodule
1
brainlilo
Submodule
Submodule brainlilo added at c826f2581e
@@ -9,32 +9,44 @@ IMG=${REPO}/image/sd.img
|
|||||||
export CROSS_COMPILE=arm-linux-gnueabi-
|
export CROSS_COMPILE=arm-linux-gnueabi-
|
||||||
|
|
||||||
mkdir -p ${WORK}
|
mkdir -p ${WORK}
|
||||||
|
mkdir -p ${WORK}/lilobin
|
||||||
|
|
||||||
for i in $(seq 1 7); do
|
# for i in "g5300" "sh1" "sh2" "sh3" "sh4" "sh5" "sh6" "sh7"; do
|
||||||
make -C ${REPO}/u-boot-brain pwsh${i}_defconfig
|
for i in "sh1"; do
|
||||||
make -j${JOBS} -C ${REPO}/u-boot-brain u-boot.bin
|
NUM=$(echo $i | sed -E 's/sh//g')
|
||||||
${REPO}/nkbin_maker/bsd-ce ${REPO}/u-boot-brain/u-boot.bin
|
|
||||||
|
make -C ${REPO}/u-boot-brain distclean pw${i}_defconfig
|
||||||
|
make -j${JOBS} -C ${REPO}/u-boot-brain u-boot.sb
|
||||||
|
#${REPO}/nkbin_maker/bsd-ce ${REPO}/u-boot-brain/u-boot.bin
|
||||||
|
|
||||||
case $i in
|
case $i in
|
||||||
1|2|3)
|
"g5300")
|
||||||
mv ${REPO}/nk.bin ${WORK}/edsa${i}exe.bin;;
|
mv ${REPO}/nk.bin ${WORK}/edna3exe.bin
|
||||||
4|5|6|7)
|
mv ${REPO}/u-boot-brain/u-boot.bin ${WORK}/lilobin/gen2.bin;;
|
||||||
mv ${REPO}/nk.bin ${WORK}/edsh${i}exe.bin;;
|
"sh1" | "sh2" | "sh3")
|
||||||
|
# mv ${REPO}/nk.bin ${WORK}/edsa${NUM}exe.bin
|
||||||
|
mv ${REPO}/u-boot-brain/u-boot.sb ${WORK}/lilobin/gen3_${NUM}.sb;;
|
||||||
|
"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"
|
echo "WTF: $i"
|
||||||
exit 1;;
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
dd if=/dev/zero of=${IMG} bs=1M count=3072
|
dd if=/dev/zero of=${IMG} bs=1M count=2048
|
||||||
|
|
||||||
START1=2048
|
START1=2048
|
||||||
SECTORS1=$((1024 * 1024 * 64 / 512))
|
SECTORS1=$((1024 * 1024 * 64 / 512))
|
||||||
START2=$((2048 + ${SECTORS1}))
|
START2=$((2048 + ${SECTORS1}))
|
||||||
|
SECTORS1=$((1024 * 1024 * 8 / 512))
|
||||||
|
START2=$((2048 + ${SECTORS1} + ${SECTORS2}))
|
||||||
|
|
||||||
cat <<EOF > ${WORK}/part.sfdisk
|
cat <<EOF > ${WORK}/part.sfdisk
|
||||||
${IMG}1 : start=${START1}, size=${SECTORS1}, type=b
|
${IMG}1 : start=${START1}, size=${SECTORS1}, type=b
|
||||||
${IMG}2 : start=${START2}, type=83
|
${IMG}2 : start=${START2}, size=${SECTORS2}, type=53
|
||||||
|
${IMG}3 : start=${START3}, type=83
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sfdisk ${IMG} < ${WORK}/part.sfdisk
|
sfdisk ${IMG} < ${WORK}/part.sfdisk
|
||||||
@@ -43,21 +55,40 @@ sudo kpartx -av ${IMG}
|
|||||||
|
|
||||||
LOOPDEV=$(losetup -l | grep sd.img | grep -o 'loop.' | tail -n 1)
|
LOOPDEV=$(losetup -l | grep sd.img | grep -o 'loop.' | tail -n 1)
|
||||||
|
|
||||||
sudo mkfs.fat -F32 -v -I /dev/mapper/${LOOPDEV}p1
|
${REPO}/image/mk_hdr.sh `fdisk -lu /dev/${LOOPDEV} | awk '$6==53 {print $2}'` 1 > ${WORK}/header.bin
|
||||||
sudo mkfs.ext4 /dev/mapper/${LOOPDEV}p2
|
dd if=${WORK}/header.bin of=/dev/${LOOPDEV}p2 ibs=512 conv=sync
|
||||||
|
dd if=${WORK}/lilobin/gen3_1.sb of=/dev/${LOOPDEV}p2 ibs=512 obs=512 seek=1 conv=sync
|
||||||
|
|
||||||
mkdir -p ${WORK}/p1 ${WORK}/p2
|
sudo mkfs.fat -n boot -F32 -v -I /dev/mapper/${LOOPDEV}p1
|
||||||
sudo mount /dev/mapper/${LOOPDEV}p1 ${WORK}/p1
|
sudo mkfs.ext4 -L rootfs /dev/mapper/${LOOPDEV}p3
|
||||||
sudo mount /dev/mapper/${LOOPDEV}p2 ${WORK}/p2
|
|
||||||
|
mkdir -p ${WORK}/p1 ${WORK}/p3
|
||||||
|
sudo mount -o utf8=true /dev/mapper/${LOOPDEV}p1 ${WORK}/p1
|
||||||
|
sudo mount /dev/mapper/${LOOPDEV}p3 ${WORK}/p3
|
||||||
|
|
||||||
sudo cp ${LINUX}/arch/arm/boot/zImage ${WORK}/p1/
|
sudo cp ${LINUX}/arch/arm/boot/zImage ${WORK}/p1/
|
||||||
sudo cp ${LINUX}/arch/arm/boot/dts/imx28-pwsh*.dtb ${WORK}/p1/
|
sudo cp ${LINUX}/arch/arm/boot/dts/imx28-pw*.dtb ${WORK}/p1/
|
||||||
sudo cp ${WORK}/*.bin ${WORK}/p1/
|
# sudo mkdir -p ${WORK}/p1/nk
|
||||||
|
# sudo cp ${WORK}/*.bin ${WORK}/p1/nk/
|
||||||
|
|
||||||
sudo cp -ra ${REPO}/brainux/* ${WORK}/p2/
|
make -C ${REPO}/brainlilo
|
||||||
|
|
||||||
sudo umount ${WORK}/p1 ${WORK}/p2
|
LILO="${WORK}/p1/アプリ/Launch Linux"
|
||||||
|
sudo mkdir -p "${LILO}"
|
||||||
|
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
|
||||||
|
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}/p3/
|
||||||
|
|
||||||
|
sudo umount ${WORK}/p1 ${WORK}/p3
|
||||||
sudo kpartx -d ${IMG}
|
sudo kpartx -d ${IMG}
|
||||||
|
|
||||||
rmdir ${WORK}/p1 ${WORK}/p2
|
rmdir ${WORK}/p1 ${WORK}/p3
|
||||||
|
|
||||||
|
|||||||
57
image/build_image_emmc.sh
Executable file
57
image/build_image_emmc.sh
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/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
|
||||||
|
export CROSS_COMPILE=${CROSS_COMPILE:="arm-linux-gnueabi-"}
|
||||||
|
|
||||||
|
mkdir -p ${WORK}
|
||||||
|
mkdir -p ${WORK}/lilobin
|
||||||
|
|
||||||
|
for i in "sh1"; 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.sb u-boot.bin
|
||||||
|
|
||||||
|
case $i in
|
||||||
|
"sh1" | "sh2" | "sh3")
|
||||||
|
mv ${REPO}/u-boot-brain/u-boot.sb ${WORK}/lilobin/gen3_${NUM}.sb
|
||||||
|
mv ${REPO}/u-boot-brain/u-boot.bin ${WORK}/lilobin/gen3_${NUM}.bin;;
|
||||||
|
*)
|
||||||
|
echo "WTF: $i"
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
dd if=/dev/zero of=${IMG} bs=1M count=96
|
||||||
|
|
||||||
|
START1=2048
|
||||||
|
SECTORS1=$((1024 * 1024 * 64 / 512))
|
||||||
|
START2=$((2048 + ${SECTORS1}))
|
||||||
|
SECTORS2=$((1024 * 1024 * 8 / 512))
|
||||||
|
START3=$((2048 + ${SECTORS1} + ${SECTORS2}))
|
||||||
|
|
||||||
|
cat <<EOF > ${WORK}/part.sfdisk
|
||||||
|
${IMG}1 : start=${START1}, size=${SECTORS1}, type=b
|
||||||
|
${IMG}2 : start=${START2}, size=${SECTORS2}, type=53
|
||||||
|
${IMG}3 : start=${START3}, type=83
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sfdisk ${IMG} < ${WORK}/part.sfdisk
|
||||||
|
|
||||||
|
sudo kpartx -av ${IMG}
|
||||||
|
|
||||||
|
LOOPDEV=$(losetup -l | grep sd.img | grep -o 'loop.' | tail -n 1)
|
||||||
|
${REPO}/image/mk_hdr.sh `fdisk -lu /dev/${LOOPDEV} | awk '$6==53 {print $2}'` 1 > ${WORK}/header.bin
|
||||||
|
dd if=${WORK}/header.bin of=/dev/${LOOPDEV}p2 ibs=512 conv=sync
|
||||||
|
dd if=${WORK}/lilobin/gen3_1.sb of=/dev/${LOOPDEV}p2 ibs=512 obs=512 seek=1 conv=sync
|
||||||
|
|
||||||
|
# sudo mount -o utf8=true /dev/mapper/${LOOPDEV}p1 ${WORK}/p1
|
||||||
|
# sudo mount /dev/mapper/${LOOPDEV}p2 ${WORK}/p2
|
||||||
|
|
||||||
|
sudo kpartx -d ${IMG}
|
||||||
|
|
||||||
BIN
image/exeopener.exe.gz
Normal file
BIN
image/exeopener.exe.gz
Normal file
Binary file not shown.
148
image/mk_hdr.sh
Executable file
148
image/mk_hdr.sh
Executable file
@@ -0,0 +1,148 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# mk_hdr.sh
|
||||||
|
# Redistributed URL: https://github.com/embeddedTS/linux-2.6.35.3-imx28/blob/master/mk_hdr.sh
|
||||||
|
#
|
||||||
|
# This program is distributed with mk_mx28_sd that has the text of 3-Clause BSD License.
|
||||||
|
# Both are considered to be licenced under the same agreement so we put the text here.
|
||||||
|
|
||||||
|
# Copyright (c) 2010 Freescale Semiconductor, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# o Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# o Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
# other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# o Neither the name of Freescale Semiconductor, Inc. nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products derived from this
|
||||||
|
# software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
# Usage: make_boot <base_sector> <num_sb_files>
|
||||||
|
#
|
||||||
|
# where
|
||||||
|
#
|
||||||
|
# <base_sector> is the first sector _of the boot stream partition (i.e. /sd#2 or /sd#3, etc)
|
||||||
|
# <num_sb_files> is the # of boot stream blocks (currently only 1 supported)
|
||||||
|
|
||||||
|
#[ $1 = ] && { echo -e " error - boot partition start sector missing" ; exit };
|
||||||
|
#[ $2 = ] && { echo -e " error - # of bootable images in .sb file missing" ; exit };
|
||||||
|
|
||||||
|
# Future usage: make_boot <dev_partition> <sb_file_tag,sb_sector_offset> <sb_file_tag2, base_addr2> ...
|
||||||
|
#
|
||||||
|
# Where base sector comes from MBR, and sb_sector_offset is an offset from start of boot-partition, not absolute sector.
|
||||||
|
|
||||||
|
|
||||||
|
#Script Vars
|
||||||
|
base_sector=$1
|
||||||
|
numbootstreams=$2
|
||||||
|
primary=0
|
||||||
|
secondary=0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
# out_byte args...
|
||||||
|
#
|
||||||
|
# this function writes the binary value to stdout of each argument in the order given
|
||||||
|
# i.e. out_byte 0 1 2 3 will echo "\x00\x01\x02\x03" to stdout (w/o terminating null )
|
||||||
|
|
||||||
|
function out_byte(){
|
||||||
|
for val in $*
|
||||||
|
do
|
||||||
|
# echo -e "byte=$val"
|
||||||
|
echo -en "\\x$(printf %02x $val)"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function out_u32_le()
|
||||||
|
{
|
||||||
|
for val32 in $*
|
||||||
|
do
|
||||||
|
|
||||||
|
val=$(($val32))
|
||||||
|
b0=$((val % (2**8)))
|
||||||
|
val=$((val / (2**8)))
|
||||||
|
b1=$((val % (2**8)))
|
||||||
|
val=$((val / (2**8)))
|
||||||
|
b2=$((val % (2**8)))
|
||||||
|
val=$((val / (2**8)))
|
||||||
|
b3=$((val % (2**8)))
|
||||||
|
|
||||||
|
### Keep around for debug/verbose output
|
||||||
|
# printf "$val32 ==> %02x%02x%02x%02x\n" $b0 $b1 $b2 $b3
|
||||||
|
|
||||||
|
### Output the bytes in binary form
|
||||||
|
#
|
||||||
|
out_byte $b0 $b1 $b2 $b3
|
||||||
|
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function out_bcb ()
|
||||||
|
{
|
||||||
|
signature=0x00112233
|
||||||
|
primary_tag=$1
|
||||||
|
secondary_tag=$2
|
||||||
|
num_bsb=$3
|
||||||
|
out_u32_le signature primary_tag secondary_tag num_bsb
|
||||||
|
}
|
||||||
|
|
||||||
|
# usage: out_bsb tag base_sector
|
||||||
|
# where base_sector is relative to partition
|
||||||
|
# i.e. if partition starts on lba 63 & first boot stream, base_sector = 1, not 64
|
||||||
|
# This function will automatically compute the absolute base sector.
|
||||||
|
function out_bsb
|
||||||
|
{
|
||||||
|
abs_sector=$(($2 + $base_sector))
|
||||||
|
# unused0
|
||||||
|
out_u32_le 0
|
||||||
|
# unused1
|
||||||
|
out_u32_le 0
|
||||||
|
# tag boot stream tag
|
||||||
|
out_u32_le $1
|
||||||
|
# boot stream base sector (absolute)
|
||||||
|
out_u32_le $abs_sector
|
||||||
|
# unused2
|
||||||
|
out_u32_le 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Send header output to std out
|
||||||
|
###############################
|
||||||
|
|
||||||
|
|
||||||
|
# Output boot stream signature & info
|
||||||
|
# out_u32_le signature primary secondary numbootstreams
|
||||||
|
out_bcb primary secondary numbootstreams
|
||||||
|
|
||||||
|
# Output .sb starting sector info
|
||||||
|
# out_u32_le unused0 unused1 tag base_sector unused2
|
||||||
|
out_bsb primary 1
|
||||||
|
|
||||||
|
# Output bsb for sb #2
|
||||||
|
#out_bsb tag_[p|s] base_sector_2
|
||||||
|
|
||||||
|
# Output bsb for sb #n
|
||||||
|
# out_bsb tag_[p|s] base_sector_n
|
||||||
|
#
|
||||||
|
|
||||||
Submodule linux-brain updated: 90e75bc2c4...09cc34a56d
@@ -33,6 +33,7 @@ APT::Install-Recommends "0";
|
|||||||
APT::Install-Suggests "0";
|
APT::Install-Suggests "0";
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# locales: locale has to be set before going any further
|
||||||
apt update -y
|
apt update -y
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
apt install -y locales
|
apt install -y locales
|
||||||
@@ -50,6 +51,32 @@ rm /etc/localtime
|
|||||||
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
|
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
|
||||||
|
|
||||||
echo "brain" > /etc/hostname
|
echo "brain" > /etc/hostname
|
||||||
|
|
||||||
|
# Install packagecloud repository
|
||||||
|
# Reference: https://packagecloud.io/brainhackers/brainux/install
|
||||||
|
|
||||||
|
# curl: downloads the GPG key from packagecloud
|
||||||
|
# gnupg, debian-archive-keyring: packagecloud verification dependency
|
||||||
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt install -y curl 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 \
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
apt install -y dialog sudo \
|
apt install -y dialog sudo \
|
||||||
libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev \
|
libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev \
|
||||||
@@ -61,10 +88,12 @@ DEBIAN_FRONTEND=noninteractive \
|
|||||||
dbus udev alsa-utils usbutils iw fake-hwclock\
|
dbus udev alsa-utils usbutils iw fake-hwclock\
|
||||||
build-essential flex bison pkg-config autotools-dev libtool autoconf automake device-tree-compiler \
|
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 \
|
python3 python3-dev python3-setuptools python3-wheel python3-pip python3-smbus \
|
||||||
resolvconf net-tools ssh openssh-client avahi-daemon curl wget git
|
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 \
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
apt install -y --install-recommends fcitx-anthy
|
apt install -y --install-recommends brain-config
|
||||||
|
|
||||||
systemctl enable fake-hwclock
|
systemctl enable fake-hwclock
|
||||||
|
|
||||||
|
|||||||
Submodule u-boot-brain updated: 0449ff1430...2696eb4b8d
Reference in New Issue
Block a user