First commit
This commit is contained in:
commit
43eb1eaa64
4 changed files with 174 additions and 0 deletions
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
|
RUN apt update \
|
||||||
|
&& apt install -y --no-install-recommends \
|
||||||
|
gcc-aarch64-linux-gnu \
|
||||||
|
device-tree-compiler \
|
||||||
|
make \
|
||||||
|
bc \
|
||||||
|
build-essential \
|
||||||
|
bison \
|
||||||
|
flex \
|
||||||
|
bash \
|
||||||
|
git \
|
||||||
|
ca-certificates
|
||||||
|
|
||||||
|
COPY docker/entrypoint.sh /tmp
|
||||||
|
COPY src/ /tmp
|
||||||
|
WORKDIR /tmp
|
||||||
|
CMD /tmp/entrypoint.sh
|
64
README.md
Normal file
64
README.md
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
u-boot for MNT Reform build script
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
Work in progress script for building uboot for the MNT Refom 2 computer.
|
||||||
|
|
||||||
|
## Howto
|
||||||
|
|
||||||
|
To compile the script, you'll need to install some packages. On Debian :
|
||||||
|
|
||||||
|
```
|
||||||
|
apt install -y --no-install-recommends gcc-aarch64-linux-gnu \
|
||||||
|
device-tree-compiler \
|
||||||
|
make \
|
||||||
|
bc \
|
||||||
|
build-essential \
|
||||||
|
bison \
|
||||||
|
flex \
|
||||||
|
bash \
|
||||||
|
git \
|
||||||
|
ca-certificates
|
||||||
|
```
|
||||||
|
|
||||||
|
You just need to launch `make_uboot.sh`. By default, script build uboot with
|
||||||
|
sdcard support. to build it with emmc support you need to pass the `emmc`
|
||||||
|
argument:
|
||||||
|
|
||||||
|
```
|
||||||
|
./make_uboot.sh emmc
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also define `UBOOT_BUILD` environment variable with `emmc` or `sdcard`
|
||||||
|
variable.
|
||||||
|
|
||||||
|
The `flash.bin` is located in the `u-boot/` directory.
|
||||||
|
|
||||||
|
## Build with docker
|
||||||
|
|
||||||
|
Build the image :
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t reform_kernel_build .
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run the container with with a directory mapped to `/output`:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -v /home/docker/output:/output --env UBOOT_BUILD=sdcard --rm reform_kernel_build
|
||||||
|
```
|
||||||
|
|
||||||
|
You could pass the `UBOOT_BUILD` environment variable to your container do tell
|
||||||
|
`make_uboot.sh` which version to compile :
|
||||||
|
|
||||||
|
* `sdcard` or not defined if you'll install to the SDCard
|
||||||
|
* `emmc` for the internal memomry of the IMX card
|
||||||
|
|
||||||
|
Flash.bin file will be in the directory mapped to `/output` in the
|
||||||
|
container.
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
This work is derivated from MNT script found [here][l_mnt_image] and licenced
|
||||||
|
under the GPLv3 Licence
|
||||||
|
|
||||||
|
[l_mnt_image]:https://source.mnt.re/reform/reform-system-image/
|
18
docker/entrypoint.sh
Executable file
18
docker/entrypoint.sh
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Entrypoint for reform-build-kernel docker image
|
||||||
|
|
||||||
|
if [ -f /output/flash.bin ]
|
||||||
|
then
|
||||||
|
printf "Kernel image exist in destination aborting compilation.\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ./make_uboot.sh
|
||||||
|
then
|
||||||
|
cp u-boot/flash.bin /output/flash.bin
|
||||||
|
else
|
||||||
|
printf "Error when building uBoot\n" >&2
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
exit 0
|
73
src/make_uboot.sh
Executable file
73
src/make_uboot.sh
Executable file
|
@ -0,0 +1,73 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Compile uboot for MNT Reform
|
||||||
|
---
|
||||||
|
This script compile uboot for the MNT Reform2 laptop.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
make_uboot.sh <target>
|
||||||
|
|
||||||
|
where <target> can be:
|
||||||
|
|
||||||
|
sdcard: build uboot for sdcard (default)
|
||||||
|
emmc: build uboot for emmc
|
||||||
|
|
||||||
|
The <target> arguments can be replaced by UBOOT_BUILD environment variable
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function error {
|
||||||
|
>&2 printf "\e[31mE\e[0m %s\n" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
export ARCH=arm64
|
||||||
|
export CROSS_COMPILE=aarch64-linux-gnu-
|
||||||
|
GIT_URL="https://source.mnt.re/reform/reform-boundary-uboot"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$1" ]
|
||||||
|
then
|
||||||
|
UBOOT_BUILD="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$UBOOT_BUILD" ]
|
||||||
|
then
|
||||||
|
UBOOT_BUILD="sdcard"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d u-boot ]
|
||||||
|
then
|
||||||
|
printf "Cloning uboot form MNTMN repo...\n"
|
||||||
|
if ! git clone --depth 1 "$GIT_URL" u-boot
|
||||||
|
then
|
||||||
|
error "Can't clone uboot from MNT, check version"
|
||||||
|
exit 11
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp u-boot/mntreform-config u-boot/.config
|
||||||
|
|
||||||
|
cd u-boot
|
||||||
|
|
||||||
|
case $UBOOT_BUILD in
|
||||||
|
" emmc")
|
||||||
|
make -j$(nproc) flash.bin KCPPFLAGS='-DMNTREFORM_BOOT_EMMC'
|
||||||
|
;;
|
||||||
|
"sdcard")
|
||||||
|
make -j$(nproc) flash.bin
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "${UBOOT_BUILD} is not a valid option"
|
||||||
|
esac
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue