mirror of
https://github.com/brain-hackers/buildbrain
synced 2025-09-18 07:36:30 +09:00
Ready for new generation
This commit is contained in:
parent
bb9f17bfeb
commit
d04a058cd0
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -7,3 +7,6 @@
|
|||||||
[submodule "nkbin_maker"]
|
[submodule "nkbin_maker"]
|
||||||
path = nkbin_maker
|
path = nkbin_maker
|
||||||
url = https://github.com/brain-hackers/nkbin_maker.git
|
url = https://github.com/brain-hackers/nkbin_maker.git
|
||||||
|
[submodule "boot4u"]
|
||||||
|
path = boot4u
|
||||||
|
url = https://github.com/brain-hackers/boot4u
|
||||||
|
23
Makefile
23
Makefile
@ -2,6 +2,7 @@ JOBS=$(shell grep -c '^processor' /proc/cpuinfo)
|
|||||||
|
|
||||||
UBOOT_CROSS=$(shell ./tools/getcross u-boot)
|
UBOOT_CROSS=$(shell ./tools/getcross u-boot)
|
||||||
LINUX_CROSS=$(shell ./tools/getcross linux)
|
LINUX_CROSS=$(shell ./tools/getcross linux)
|
||||||
|
ROOTFS_CROSS=$(shell ./tools/getcross rootfs)
|
||||||
export ARCH=arm
|
export ARCH=arm
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
@ -26,7 +27,7 @@ watch:
|
|||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
udefconfig:
|
udefconfig:
|
||||||
make -C ./u-boot-brain pwsh1_defconfig
|
make -C ./u-boot-brain pwh1_defconfig
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
udefconfig-%:
|
udefconfig-%:
|
||||||
@ -54,7 +55,7 @@ ubuild:
|
|||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
ldefconfig:
|
ldefconfig:
|
||||||
make -C ./linux-brain brain_defconfig
|
make -C ./linux-brain imx_v7_defconfig
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
lmenuconfig:
|
lmenuconfig:
|
||||||
@ -63,7 +64,7 @@ lmenuconfig:
|
|||||||
.PHONY:
|
.PHONY:
|
||||||
lsavedefconfig:
|
lsavedefconfig:
|
||||||
make CROSS_COMPILE=$(LINUX_CROSS) -C ./linux-brain savedefconfig
|
make CROSS_COMPILE=$(LINUX_CROSS) -C ./linux-brain savedefconfig
|
||||||
mv ./linux-brain/defconfig ./linux-brain/arch/arm/configs/brain_defconfig
|
mv ./linux-brain/defconfig ./linux-brain/arch/arm/configs/imx_v7_defconfig
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
lclean:
|
lclean:
|
||||||
@ -74,16 +75,12 @@ lbuild:
|
|||||||
make CROSS_COMPILE=$(LINUX_CROSS) -j$(JOBS) -C ./linux-brain
|
make CROSS_COMPILE=$(LINUX_CROSS) -j$(JOBS) -C ./linux-brain
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
uuu:
|
boot4ubuild:
|
||||||
sudo uuu ./u-boot-brain/u-boot.sb
|
make -C ./boot4u
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
nkbin-maker:
|
boot4uclean:
|
||||||
make -C ./nkbin_maker
|
make -C ./boot4u clean
|
||||||
|
|
||||||
.PHONY:
|
|
||||||
nk.bin:
|
|
||||||
./nkbin_maker/bsd-ce ./u-boot-brain/u-boot.bin
|
|
||||||
|
|
||||||
brainux:
|
brainux:
|
||||||
@if [ "$(shell uname)" != "Linux" ]; then \
|
@if [ "$(shell uname)" != "Linux" ]; then \
|
||||||
@ -93,9 +90,9 @@ brainux:
|
|||||||
mkdir -p brainux
|
mkdir -p brainux
|
||||||
@if [ "$(CI)" = "true" ]; then \
|
@if [ "$(CI)" = "true" ]; then \
|
||||||
echo "I'm in CI and debootstrap without cache."; \
|
echo "I'm in CI and debootstrap without cache."; \
|
||||||
sudo debootstrap --arch=armel --foreign buster brainux/; \
|
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign buster brainux/; \
|
||||||
else \
|
else \
|
||||||
sudo debootstrap --arch=armel --foreign buster brainux/ http://localhost:65432/debian/; \
|
sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign buster brainux/ http://localhost:65432/debian/; \
|
||||||
fi
|
fi
|
||||||
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
|
sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/
|
||||||
sudo cp ./os-brainux/setup_brainux.sh brainux/
|
sudo cp ./os-brainux/setup_brainux.sh brainux/
|
||||||
|
51
README.md
51
README.md
@ -3,7 +3,7 @@ buildbrain
|
|||||||
|
|
||||||
This repository includes:
|
This repository includes:
|
||||||
|
|
||||||
- linux-brain, u-boot-brain and nkbin_maker as submodules
|
- linux-brain, u-boot-brain and boot4u as submodules
|
||||||
- Useful build targets in Makefile
|
- Useful build targets in Makefile
|
||||||
- r3build.toml to watch changes that occur in submodules
|
- r3build.toml to watch changes that occur in submodules
|
||||||
|
|
||||||
@ -20,13 +20,14 @@ Getting Started
|
|||||||
1. Install dependencies.
|
1. Install dependencies.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi
|
$ sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabihf libssl-dev bc lzop
|
||||||
|
$ pip install pyelftools
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Clone this repository with recursive clone enabled.
|
1. Clone this repository with recursive clone enabled.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git clone --recursive git@github.com:puhitaku/buildbrain.git
|
$ git clone --recursive git@github.com:brain-hackers/buildbrain.git
|
||||||
```
|
```
|
||||||
|
|
||||||
- If you've cloned it without `--recursive`, run following command:
|
- If you've cloned it without `--recursive`, run following command:
|
||||||
@ -35,37 +36,24 @@ Getting Started
|
|||||||
$ git submodule update --init --recursive
|
$ git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Install uuu.
|
|
||||||
|
|
||||||
- Follow [the instruction](https://github.com/NXPmicro/mfgtools#linux) and build `uuu` executable.
|
Build U-Boot
|
||||||
- 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`.
|
1. Run `make udefconfig` to generate `.config`.
|
||||||
|
|
||||||
2. Run `make ubuild` to build whole repository and generate `u-boot.bin`.
|
2. Run `make ubuild` to build whole repository and generate `u-boot.bin`.
|
||||||
|
|
||||||
3. To make `nk.bin`, run `make nkbin`.
|
|
||||||
|
|
||||||
- nkbin_maker packs `u-boot.bin` into `nk.bin`.
|
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/`
|
||||||
|
|
||||||
|
|
||||||
Build Linux
|
Build Linux
|
||||||
@ -89,18 +77,23 @@ Bootstrap Debian 10 (buster)
|
|||||||
1. Build and copy the Linux kernel.
|
1. Build and copy the Linux kernel.
|
||||||
|
|
||||||
- Run `make ldefconfig lbuild`.
|
- Run `make ldefconfig lbuild`.
|
||||||
- Copy `/linux-brain/arch/arm/boot/zImage` and `/linux-brain/arch/arm/boot/dts/imx28-evk.dtb` into the 1st partition.
|
- Copy `/linux-brain/arch/arm/boot/zImage` and `/linux-brain/arch/arm/boot/dts/imx7ulp-pwh1.dtb` into the 1st partition.
|
||||||
|
|
||||||
1. Run APT cache in background (mandatory): `make aptcache`.
|
1. Run APT cache in background (mandatory): `make aptcache`.
|
||||||
|
|
||||||
1. Run `make debian`.
|
1. Run `make debian`.
|
||||||
|
|
||||||
1. Copy all contents in `./debian` into the 2nd partition.
|
1. Copy all contents in `./brainux` into the 2nd partition.
|
||||||
|
|
||||||
- `sudo cp -ar ./debian/* /path/to/your/sd/2nd/partition/`
|
- `sudo cp -ar ./brainux/* /path/to/your/sd/2nd/partition/`
|
||||||
- Please make sure that all attributes are preserved with `-a` flag.
|
- 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
|
Watch changes in submodules & auto-build
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
||||||
|
1
boot4u
Submodule
1
boot4u
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 3f916a0cf7b2516e3eaa720a5c77efbe53527eeb
|
@ -1 +1 @@
|
|||||||
Subproject commit 114b17b84a8fad35877f5ba9c1d9ce909f44ef12
|
Subproject commit 99b2278100c6ec9a26b8528d79a68f637698b60c
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 4a97a4e8074cec12ac8989bcfcab9b9f7d47156d
|
|
@ -19,8 +19,18 @@ linux() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootfs() {
|
||||||
|
. ./linux-brain/.config
|
||||||
|
case "${CONFIG_CPU_ARM926T}_${CONFIG_ARCH_MULTI_V7}" in
|
||||||
|
y_) echo -n "armel"; return;;
|
||||||
|
_y) echo -n "armhf"; return;;
|
||||||
|
*) exit 1;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
u-boot) uboot ;;
|
u-boot) uboot ;;
|
||||||
linux) linux ;;
|
linux) linux ;;
|
||||||
|
rootfs) rootfs ;;
|
||||||
*) exit 1; ;;
|
*) exit 1; ;;
|
||||||
esac
|
esac
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 8f3049f7dc914b2dfbd29e214eb7666717f095e6
|
Subproject commit 6836ea2fbcb3b61720272751b1d42561c40ed5b5
|
Loading…
x
Reference in New Issue
Block a user