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
```
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
-
Install dependencies.
$ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi -
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
-
Install uuu.
- Follow the instruction and build
uuuexecutable. - Put
uuuwhere the PATH executable points to.
- Follow the instruction and build
Build and inject U-Boot
-
Run
make udefconfig-sh*to generate.config.- For Sx1:
make udefconfig-sh1 - For Sx6:
make udefconfig-sh6
- For Sx1:
-
Run
make ubuildto build whole repository and generateu-boot.sb.- i.MX283 loads a packed U-Boot executable called
u-boot.sb.
- i.MX283 loads a packed U-Boot executable called
-
To inject the executable into i.MX283 in recovery mode, run
make uuu.
Build and make NK.bin
-
Run
make udefconfigto generate.config. -
Run
make ubuildto build whole repository and generateu-boot.bin. -
Run
make nkbin-maker. -
To make
nk.bin, runmake nk.bin.- nkbin_maker packs
u-boot.binintonk.bin.
- nkbin_maker packs
Build Linux
-
Run
make ldefconfigto generate.config. -
Run
make lbuildto generatezImage. -
Confirm that
linux-brain/arch/arm/boot/zImageexists.
Bootstrap Debian 10 (buster)
-
Run
make ldefconfig lbuild. -
Run APT cache in background (mandatory):
make aptcache. -
Run
make brainux. -
Run
make image.sd.img -
Confirm that
image/sd.imgis built and burn it to an SD card.
Watch changes in submodules & auto-build
-
Run
make setup-devto 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.