Enable USB UART converter drivers
buildbrain
This repository includes:
- linux-brain, u-boot-brain, nkbin_maker and boot4u as submodules
- Useful build targets in Makefile
- r3build.toml to watch changes that occur in submodules
Confirmed environments
- Debian 10 (buster) amd64
- Debian 11 (bullseye) amd64
Getting Started
-
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 -
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 U-Boot
-
Run
make udefconfig-sh*to generate.config.- For Sx1:
make udefconfig-sh1 - For Sx6:
make udefconfig-sh6 - For x1:
make udefconfig-h1
- For Sx1:
-
Run
make ubuildto build whole repository and generateu-boot.sboru-boot.bin.- i.MX283 loads a packed U-Boot executable called
u-boot.sb.
- i.MX283 loads a packed U-Boot executable called
Inject U-Boot into i.MX283 in recovery mode
-
Follow
Build U-Bootprocedure to make U-Boot binary. -
Run
make uuu
Build and make NK.bin
-
Follow
Build U-Bootprocedure to make U-Boot binary. -
Run
make nkbin-maker. -
To make
nk.bin, runmake nk.bin.- nkbin_maker packs
u-boot.binintonk.bin.
- nkbin_maker packs
Build and deploy boot4u
-
Run
make boot4u -
Create index.din and copy AppMain.bin
mkdir /path/to/your/sd/1st/partition/App/boot4utouch /path/to/your/sd/1st/partition/App/boot4u/index.dincp boot4u/AppMain.bin /path/to/your/sd/1st/partition/App/boot4u/
Build Linux
-
Run
make ldefconfigto generate.config. -
Run
make lbuildto generatezImage. -
Confirm that
linux-brain/arch/arm/boot/zImageexists.
Build a Debian rootfs
-
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.
Build a Buildroot rootfs
Buildroot rootfs aims to be the most lightweight rootfs for experimental use. make buildroot_rootfs runs the defconfig target for rootfs-only build and then builds the rootfs tarball and a CPIO archive for initramfs. make image/sd_buildroot.img makes a bootable SD image in image directory like the typical Brainux SD image.
If you want to customize the build of Buildroot, cd into buildroot and use the following targets:
make menuconfigto change the configurationmaketo build the rootfs (-joption might give you extra speed)
image/sd_buildroot.img target expects presence of the tarball at buildroot/output/images/rootfs.tar. You'll have to clean and rebuild every time you change the Buildroot's config before making the SD image.
Known issues
If you use GCC 10 for the 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-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.