From d04a058cd06e644ce4534533b56d7bde13aa66d7 Mon Sep 17 00:00:00 2001 From: pepepper Date: Mon, 18 Oct 2021 15:55:35 +0900 Subject: [PATCH] Ready for new generation --- .gitmodules | 3 +++ Makefile | 23 ++++++++++------------- README.md | 51 ++++++++++++++++++++++---------------------------- boot4u | 1 + linux-brain | 2 +- nkbin_maker | 1 - tools/getcross | 10 ++++++++++ u-boot-brain | 2 +- 8 files changed, 48 insertions(+), 45 deletions(-) create mode 160000 boot4u delete mode 160000 nkbin_maker diff --git a/.gitmodules b/.gitmodules index 4c94f47..172f02e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "nkbin_maker"] path = nkbin_maker url = https://github.com/brain-hackers/nkbin_maker.git +[submodule "boot4u"] + path = boot4u + url = https://github.com/brain-hackers/boot4u diff --git a/Makefile b/Makefile index f628724..def59c7 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ JOBS=$(shell grep -c '^processor' /proc/cpuinfo) UBOOT_CROSS=$(shell ./tools/getcross u-boot) LINUX_CROSS=$(shell ./tools/getcross linux) +ROOTFS_CROSS=$(shell ./tools/getcross rootfs) export ARCH=arm .PHONY: @@ -26,7 +27,7 @@ watch: .PHONY: udefconfig: - make -C ./u-boot-brain pwsh1_defconfig + make -C ./u-boot-brain pwh1_defconfig .PHONY: udefconfig-%: @@ -54,7 +55,7 @@ ubuild: .PHONY: ldefconfig: - make -C ./linux-brain brain_defconfig + make -C ./linux-brain imx_v7_defconfig .PHONY: lmenuconfig: @@ -63,7 +64,7 @@ lmenuconfig: .PHONY: lsavedefconfig: 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: lclean: @@ -74,16 +75,12 @@ lbuild: make CROSS_COMPILE=$(LINUX_CROSS) -j$(JOBS) -C ./linux-brain .PHONY: -uuu: - sudo uuu ./u-boot-brain/u-boot.sb +boot4ubuild: + make -C ./boot4u .PHONY: -nkbin-maker: - make -C ./nkbin_maker - -.PHONY: -nk.bin: - ./nkbin_maker/bsd-ce ./u-boot-brain/u-boot.bin +boot4uclean: + make -C ./boot4u clean brainux: @if [ "$(shell uname)" != "Linux" ]; then \ @@ -93,9 +90,9 @@ brainux: mkdir -p brainux @if [ "$(CI)" = "true" ]; then \ 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 \ - sudo debootstrap --arch=armel --foreign buster brainux/ http://localhost:65432/debian/; \ + sudo debootstrap --arch=$(ROOTFS_CROSS) --foreign buster brainux/ http://localhost:65432/debian/; \ fi sudo cp /usr/bin/qemu-arm-static brainux/usr/bin/ sudo cp ./os-brainux/setup_brainux.sh brainux/ diff --git a/README.md b/README.md index e34301f..dc97f79 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ buildbrain 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 - r3build.toml to watch changes that occur in submodules @@ -20,13 +20,14 @@ Getting Started 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. ``` - $ 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: @@ -35,37 +36,24 @@ Getting Started $ git submodule update --init --recursive ``` -1. Install uuu. - - Follow [the instruction](https://github.com/NXPmicro/mfgtools#linux) 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 +Build U-Boot ----------------------- 1. Run `make udefconfig` to generate `.config`. 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 @@ -89,18 +77,23 @@ Bootstrap Debian 10 (buster) 1. Build and copy the Linux kernel. - 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 `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. +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 ---------------------------------------- diff --git a/boot4u b/boot4u new file mode 160000 index 0000000..3f916a0 --- /dev/null +++ b/boot4u @@ -0,0 +1 @@ +Subproject commit 3f916a0cf7b2516e3eaa720a5c77efbe53527eeb diff --git a/linux-brain b/linux-brain index 114b17b..99b2278 160000 --- a/linux-brain +++ b/linux-brain @@ -1 +1 @@ -Subproject commit 114b17b84a8fad35877f5ba9c1d9ce909f44ef12 +Subproject commit 99b2278100c6ec9a26b8528d79a68f637698b60c diff --git a/nkbin_maker b/nkbin_maker deleted file mode 160000 index 4a97a4e..0000000 --- a/nkbin_maker +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4a97a4e8074cec12ac8989bcfcab9b9f7d47156d diff --git a/tools/getcross b/tools/getcross index 1ae8e5c..0857a4f 100755 --- a/tools/getcross +++ b/tools/getcross @@ -19,8 +19,18 @@ linux() { 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 u-boot) uboot ;; linux) linux ;; + rootfs) rootfs ;; *) exit 1; ;; esac diff --git a/u-boot-brain b/u-boot-brain index 8f3049f..6836ea2 160000 --- a/u-boot-brain +++ b/u-boot-brain @@ -1 +1 @@ -Subproject commit 8f3049f7dc914b2dfbd29e214eb7666717f095e6 +Subproject commit 6836ea2fbcb3b61720272751b1d42561c40ed5b5