buildbrain/README.md

130 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2020-09-28 00:49:26 +09:00
buildbrain
==========
This repository includes:
2021-03-06 20:19:11 +09:00
- linux-brain, u-boot-brain, nkbin_maker and boot4u as submodules
2020-09-28 00:49:26 +09:00
- Useful build targets in Makefile
- r3build.toml to watch changes that occur in submodules
2020-10-18 13:52:20 +09:00
Confirmed environments
----------------------
- Debian 10 (buster) amd64
- Debian 11 (bullseye) amd64
2020-10-18 13:52:20 +09:00
2020-09-28 00:49:26 +09:00
Getting Started
---------------
2020-09-28 01:04:07 +09:00
1. Install dependencies.
```
$ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf libssl-dev bc lzop qemu-user-static debootstrap kpartx libyaml-dev python3-pyelftools
2020-09-28 01:04:07 +09:00
```
2020-09-28 00:49:26 +09:00
1. Clone this repository with recursive clone enabled.
```
$ git clone --recursive git@github.com:brain-hackers/buildbrain.git
2020-09-28 00:49:26 +09:00
```
- If you've cloned it without `--recursive`, run following command:
```
$ git submodule update --init --recursive
```
2020-09-28 01:04:07 +09:00
1. Install uuu.
2020-09-28 00:49:26 +09:00
- Follow [the instruction](https://github.com/NXPmicro/mfgtools#linux) and build `uuu` executable.
- Put `uuu` where the PATH executable points to.
2021-03-06 20:19:11 +09:00
Build U-Boot
2020-09-28 00:49:26 +09:00
-----------------------
1. Run `make udefconfig-sh*` to generate `.config`.
- For Sx1: `make udefconfig-sh1`
- For Sx6: `make udefconfig-sh6`
2021-03-06 20:19:11 +09:00
- For x1: `make udefconfig-h1`
2020-09-28 00:49:26 +09:00
2021-03-06 20:19:11 +09:00
2. Run `make ubuild` to build whole repository and generate `u-boot.sb` or `u-boot.bin`.
2020-09-28 00:49:26 +09:00
- i.MX283 loads a packed U-Boot executable called `u-boot.sb`.
2021-03-06 20:19:11 +09:00
Inject U-Boot into i.MX283 in recovery mode
-----------------------
1. Follow `Build U-Boot` procedure to make U-Boot binary.
1. Run `make uuu`
2020-09-28 00:49:26 +09:00
2020-10-18 15:27:28 +09:00
Build and make NK.bin
-----------------------
2021-03-06 20:19:11 +09:00
1. Follow `Build U-Boot` procedure to make U-Boot binary.
2020-10-18 15:27:28 +09:00
2021-03-06 20:19:11 +09:00
1. Run `make nkbin-maker`.
2021-03-06 20:19:11 +09:00
1. To make `nk.bin`, run `make nk.bin`.
2020-10-18 15:27:28 +09:00
2020-10-18 17:22:06 +09:00
- nkbin_maker packs `u-boot.bin` into `nk.bin`.
2021-03-06 20:19:11 +09:00
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/`
2020-10-18 15:27:28 +09:00
2020-09-28 00:49:26 +09:00
Build Linux
-----------
1. Run `make ldefconfig` to generate `.config`.
1. Run `make lbuild` to generate `zImage`.
1. Confirm that `linux-brain/arch/arm/boot/zImage` exists.
2021-08-26 21:57:59 +09:00
Bootstrap Debian 11 (bullseye)
2021-08-26 22:05:29 +09:00
------------------------------
1. Run `make ldefconfig lbuild`.
2020-10-28 01:12:42 +09:00
1. Run APT cache in background (mandatory): `make aptcache`.
1. Run `make brainux`.
2021-05-05 22:14:03 +09:00
1. Run `make image/sd.img`
1. Confirm that `image/sd.img` is built and burn it to an SD card.
2021-03-06 20:19:11 +09:00
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;`
2020-09-28 00:49:26 +09:00
Watch changes in submodules & auto-build
----------------------------------------
2020-10-18 13:52:20 +09:00
1. Run `make setup-dev` to prepare a Python venv to watch code changes. Namely;
- Python 3 venv in `env`
- r3build command in the env
2020-09-28 00:49:26 +09:00
1. Run `r3build`. It'll detect the changes you make and builds the corresponding executable automatically.
What's r3build?
---------------
[r3build](https://github.com/puhitaku/r3build) is a smart file watcher that aims to provide hot-reloading feature like Web frontend development.