2.8 KiB
buildbrain
This repository includes:
- linux-brain, u-boot-brain and boot4u as submodules
- Useful build targets in Makefile
- r3build.toml to watch changes that occur in submodules
Confirmed environments
- Debian 10 (buster) amd64
Getting Started
-
Install dependencies.
$ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabihf libssl-dev bc lzop $ pip install pyelftools
-
Clone this repository with recursive clone enabled.
$ git clone --recursive git@github.com:brain-hackers/buildbrain.git
- If you've cloned it without
--recursive
, run following command:
$ git submodule update --init --recursive
- If you've cloned it without
Build U-Boot
-
Run
make udefconfig
to generate.config
. -
Run
make ubuild
to build whole repository and generateu-boot.bin
.
Build and deploy boot4u
-
Run
make boot4u
-
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
-
Run
make ldefconfig
to generate.config
. -
Run
make lbuild
to generatezImage
. -
Confirm that
linux-brain/arch/arm/boot/zImage
exists.
Bootstrap Debian 10 (buster)
-
Partition an SD card into two partitions.
- 1st: FAT32 (vfat), about 100MB
- 2st: ext4, fill the remaining area
-
Build and copy the Linux kernel.
- Run
make ldefconfig lbuild
. - Copy
/linux-brain/arch/arm/boot/zImage
and/linux-brain/arch/arm/boot/dts/imx7ulp-pwh1.dtb
into the 1st partition.
- Run
-
Run APT cache in background (mandatory):
make aptcache
. -
Run
make debian
. -
Copy all contents in
./brainux
into the 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
-
Run
make setup-dev
to prepare a Python venv to watch code changes. Namely;- Python 3 venv in
env
- r3build command in the env
- Python 3 venv in
-
Run
r3build
. It'll detect the changes you make and builds the corresponding executable automatically.
What's r3build?
r3build is a smart file watcher that aims to provide hot-reloading feature like Web frontend development.