Ready for new generation

This commit is contained in:
Chiharu Shirasaka 2021-10-18 15:55:35 +09:00
parent bb9f17bfeb
commit d04a058cd0
8 changed files with 48 additions and 45 deletions

3
.gitmodules vendored
View File

@ -7,3 +7,6 @@
[submodule "nkbin_maker"]
path = nkbin_maker
url = https://github.com/brain-hackers/nkbin_maker.git
[submodule "boot4u"]
path = boot4u
url = https://github.com/brain-hackers/boot4u

View File

@ -2,6 +2,7 @@ JOBS=$(shell grep -c '^processor' /proc/cpuinfo)
UBOOT_CROSS=$(shell ./tools/getcross u-boot)
LINUX_CROSS=$(shell ./tools/getcross linux)
ROOTFS_CROSS=$(shell ./tools/getcross rootfs)
export ARCH=arm
.PHONY:
@ -26,7 +27,7 @@ watch:
.PHONY:
udefconfig:
make -C ./u-boot-brain pwsh1_defconfig
make -C ./u-boot-brain pwh1_defconfig
.PHONY:
udefconfig-%:
@ -54,7 +55,7 @@ ubuild:
.PHONY:
ldefconfig:
make -C ./linux-brain brain_defconfig
make -C ./linux-brain imx_v7_defconfig
.PHONY:
lmenuconfig:
@ -63,7 +64,7 @@ lmenuconfig:
.PHONY:
lsavedefconfig:
make CROSS_COMPILE=$(LINUX_CROSS) -C ./linux-brain savedefconfig
mv ./linux-brain/defconfig ./linux-brain/arch/arm/configs/brain_defconfig
mv ./linux-brain/defconfig ./linux-brain/arch/arm/configs/imx_v7_defconfig
.PHONY:
lclean:
@ -74,16 +75,12 @@ lbuild:
make CROSS_COMPILE=$(LINUX_CROSS) -j$(JOBS) -C ./linux-brain
.PHONY:
uuu:
sudo uuu ./u-boot-brain/u-boot.sb
boot4ubuild:
make -C ./boot4u
.PHONY:
nkbin-maker:
make -C ./nkbin_maker
.PHONY:
nk.bin:
./nkbin_maker/bsd-ce ./u-boot-brain/u-boot.bin
boot4uclean:
make -C ./boot4u clean
brainux:
@if [ "$(shell uname)" != "Linux" ]; then \
@ -93,9 +90,9 @@ brainux:
mkdir -p brainux
@if [ "$(CI)" = "true" ]; then \
echo "I'm in CI and debootstrap without cache."; \
sudo debootstrap --arch=armel --foreign buster brainux/; \
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign buster brainux/; \
else \
sudo debootstrap --arch=armel --foreign buster brainux/ http://localhost:65432/debian/; \
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign buster brainux/ http://localhost:65432/debian/; \
fi
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
sudo cp ./os-brainux/setup_brainux.sh brainux/

View File

@ -3,7 +3,7 @@ buildbrain
This repository includes:
- linux-brain, u-boot-brain and nkbin_maker as submodules
- linux-brain, u-boot-brain and boot4u as submodules
- Useful build targets in Makefile
- r3build.toml to watch changes that occur in submodules
@ -20,13 +20,14 @@ Getting Started
1. Install dependencies.
```
$ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi
$ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabihf libssl-dev bc lzop
$ pip install pyelftools
```
1. Clone this repository with recursive clone enabled.
```
$ git clone --recursive git@github.com:puhitaku/buildbrain.git
$ git clone --recursive git@github.com:brain-hackers/buildbrain.git
```
- If you've cloned it without `--recursive`, run following command:
@ -35,37 +36,24 @@ Getting Started
$ git submodule update --init --recursive
```
1. Install uuu.
- Follow [the instruction](https://github.com/NXPmicro/mfgtools#linux) and build `uuu` executable.
- Put `uuu` where the PATH executable points to.
Build and inject U-Boot
-----------------------
1. Run `make udefconfig-sh*` to generate `.config`.
- For Sx1: `make udefconfig-sh1`
- For Sx6: `make udefconfig-sh6`
2. Run `make ubuild` to build whole repository and generate `u-boot.sb`.
- i.MX283 loads a packed U-Boot executable called `u-boot.sb`.
3. To inject the executable into i.MX283 in recovery mode, run `make uuu`.
Build and make NK.bin
Build U-Boot
-----------------------
1. Run `make udefconfig` to generate `.config`.
2. Run `make ubuild` to build whole repository and generate `u-boot.bin`.
3. To make `nk.bin`, run `make nkbin`.
- nkbin_maker packs `u-boot.bin` into `nk.bin`.
Build and deploy boot4u
-----------------------
1. Run `make boot4u`
1. Create index.din and copy AppMain.bin
- `mkdir /path/to/your/sd/1st/partition/App/boot4u`
- `touch /path/to/your/sd/1st/partition/App/boot4u/index.din`
- `cp boot4u/AppMain.bin /path/to/your/sd/1st/partition/App/boot4u/`
Build Linux
@ -89,18 +77,23 @@ Bootstrap Debian 10 (buster)
1. Build and copy the Linux kernel.
- Run `make ldefconfig lbuild`.
- Copy `/linux-brain/arch/arm/boot/zImage` and `/linux-brain/arch/arm/boot/dts/imx28-evk.dtb` into the 1st partition.
- Copy `/linux-brain/arch/arm/boot/zImage` and `/linux-brain/arch/arm/boot/dts/imx7ulp-pwh1.dtb` into the 1st partition.
1. Run APT cache in background (mandatory): `make aptcache`.
1. Run `make debian`.
1. Copy all contents in `./debian` into the 2nd partition.
1. Copy all contents in `./brainux` into the 2nd partition.
- `sudo cp -ar ./debian/* /path/to/your/sd/2nd/partition/`
- `sudo cp -ar ./brainux/* /path/to/your/sd/2nd/partition/`
- Please make sure that all attributes are preserved with `-a` flag.
Known issues
----------------------------------------
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;`
Watch changes in submodules & auto-build
----------------------------------------

1
boot4u Submodule

@ -0,0 +1 @@
Subproject commit 3f916a0cf7b2516e3eaa720a5c77efbe53527eeb

@ -1 +1 @@
Subproject commit 114b17b84a8fad35877f5ba9c1d9ce909f44ef12
Subproject commit 99b2278100c6ec9a26b8528d79a68f637698b60c

@ -1 +0,0 @@
Subproject commit 4a97a4e8074cec12ac8989bcfcab9b9f7d47156d

View File

@ -19,8 +19,18 @@ linux() {
esac
}
rootfs() {
. ./linux-brain/.config
case "${CONFIG_CPU_ARM926T}_${CONFIG_ARCH_MULTI_V7}" in
y_) echo -n "armel"; return;;
_y) echo -n "armhf"; return;;
*) exit 1;;
esac
}
case "$1" in
u-boot) uboot ;;
linux) linux ;;
rootfs) rootfs ;;
*) exit 1; ;;
esac

@ -1 +1 @@
Subproject commit 8f3049f7dc914b2dfbd29e214eb7666717f095e6
Subproject commit 6836ea2fbcb3b61720272751b1d42561c40ed5b5