Merge pull request #54 from brain-hackers/ci-buildroot

Add buildroot rootfs target and SD image target
This commit is contained in:
Takumi Sueda 2023-07-29 01:17:07 +09:00 committed by GitHub
commit 3479812f91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 8 deletions

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!"; \
@ -155,11 +154,21 @@ brainux:
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:

1
buildroot Submodule

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

View File

@ -5,7 +5,10 @@ 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}
@ -34,7 +37,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))
@ -49,7 +52,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 +74,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}