Go to file
Yusuke Nakamura 6fa865562d Use last loop device from loopdev -l
In my env, `make image/sd.img` failed by following error.

```
+ sudo kpartx -av /home/unasuke/src/github.com/brain-hackers/buildbrain/image/sd.img
add map loop6p1 (253:8): 0 131072 linear 7:6 2048
add map loop6p2 (253:9): 0 12154880 linear 7:6 133120
++ losetup -l
++ grep -o loop.
++ grep sd.img
+ LOOPDEV='loop6
loop4
loop5
loop3'
+ sudo mkfs.fat -F32 -v -I /dev/mapper/loop6 loop4 loop5 loop3p1
mkfs.fat 4.1 (2017-01-24)
Bad block count : loop4
Usage: mkfs.fat [-a][-A][-c][-C][-v][-I][-l bad-block-file][-b backup-boot-sector]
       [-m boot-msg-file][-n volume-name][-i volume-id]
       [-s sectors-per-cluster][-S logical-sector-size][-f number-of-FATs]
       [-h hidden-sectors][-F fat-size][-r root-dir-entries][-R reserved-sectors]
       [-M FAT-media-byte][-D drive_number]
       [--invariant]
       [--help]
       /dev/name [blocks]
make: *** [Makefile:126: image/sd.img] エラー 1
```
2021-05-05 22:05:49 +09:00
.github/workflows Generate changelog 2021-03-22 22:55:05 +09:00
cache Add APT cache 2020-10-27 19:52:59 +09:00
image Use last loop device from loopdev -l 2021-05-05 22:05:49 +09:00
linux-brain@7738c0a9ce Update linux-brain 2021-04-05 03:06:08 +09:00
nkbin_maker@4a97a4e807 update nkbin_maker 2020-10-19 04:56:48 +09:00
os-brainux Fix wrong owner and group 2021-04-19 01:38:28 +09:00
tools Add version script 2021-02-24 00:02:07 +09:00
u-boot-brain@6390f0ed58 Update u-boot-brain 2021-03-22 23:38:59 +09:00
.clang-format Add .clang-format 2020-10-26 04:20:30 +09:00
.gitchangelog.rc Generate changelog 2021-03-22 22:55:05 +09:00
.gitignore Update misc 2021-03-22 22:41:50 +09:00
.gitmodules add nkbin_maker 2020-10-18 15:27:28 +09:00
LICENSE Add files 2020-09-28 00:49:26 +09:00
Makefile Add linux packaging targets 2021-04-21 03:27:29 +09:00
r3build.toml Add files 2020-09-28 00:49:26 +09:00
README.md Update README.md 2021-03-12 19:51:35 +09:00

buildbrain

This repository includes:

  • linux-brain, u-boot-brain and nkbin_maker as submodules
  • Useful build targets in Makefile
  • r3build.toml to watch changes that occur in submodules

Confirmed environments

  • Debian 10 (buster) amd64

Getting Started

  1. Install dependencies.

    $ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi
    
  2. 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
    
  3. Install uuu.

    • Follow the instruction 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

  1. Run make udefconfig to generate .config.

  2. Run make ubuild to build whole repository and generate u-boot.bin.

  3. Run make nkbin-maker.

  4. To make nk.bin, run make nk.bin.

    • nkbin_maker packs u-boot.bin into nk.bin.

Build Linux

  1. Run make ldefconfig to generate .config.

  2. Run make lbuild to generate zImage.

  3. Confirm that linux-brain/arch/arm/boot/zImage exists.

Bootstrap Debian 10 (buster)

  1. Run make ldefconfig lbuild.

  2. Run APT cache in background (mandatory): make aptcache.

  3. Run make brainux.

  4. Run make image.sd.img

  5. Confirm that image/sd.img is built and burn it to an SD card.

Watch changes in submodules & auto-build

  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
  2. 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.