-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[u-boot-builder] Adding support for patches and config fragments (#29)
- Bumped to 2022.07 - Updated Readme with usage information and explanations - Created entry point script which handles patches and fragments
- Loading branch information
1 parent
f484a90
commit 39587f7
Showing
3 changed files
with
91 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ FROM robotpajamas/gcc-arm-linux-gnueabihf:10.3-2021.07 as builder | |
|
||
LABEL maintainer="[email protected]" | ||
|
||
ARG UBOOT_TAG=v2022.04 | ||
ARG UBOOT_TAG=v2022.07 | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
ARG DEBIAN_FRONTEND=non-interactive | ||
|
@@ -30,4 +30,8 @@ RUN apt-get update \ | |
USER armothy | ||
WORKDIR /app | ||
|
||
CMD ["bash"] | ||
COPY docker-entrypoint.sh / | ||
ENV DEFCONFIG="qemu_arm_defconfig" | ||
|
||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
CMD ["make"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,72 @@ | ||
# u-boot-builder | ||
|
||
## TODO | ||
A development environment containing an ARM gcc toolchain which can build u-boot for ARM devices. | ||
|
||
- Notes: Use a volume to host the git repo + changes, so it's not accidentally lost on container removal. | ||
Optionally bind mount `ccache`, so that it can be shared across builds or containers - and probably put it in a tmp folder so the OS can manage it. | ||
- These should probably be re-done with the `--mount` syntax, as it's clearer for documentation purposes. `-v` is a shortcut. | ||
- Confirm this runs with `Podman` as well. | ||
- Test by passing in a bash command | ||
- Show git diff/patch example | ||
## Usage | ||
|
||
Given some input paramters, this container will automatically download u-boot, apply patches, and use configuration fragments to setup and then build u-boot. | ||
|
||
Below is the typical, non-interactive build command. | ||
|
||
```bash | ||
docker run --rm \ | ||
-e DEFCONFIG=am335x_evm_defconfig \ | ||
-v uboot-2022.07:/app \ | ||
-v ccache:/ccache \ | ||
-v $(pwd)/mykconfig.fragment:/u-boot.fragment:ro \ | ||
-v $(pwd)/mygit.patch:/u-boot.patch:ro \ | ||
robotpajamas/u-boot-builder:2022.07 | ||
``` | ||
|
||
- `-e DEFCONFIG=am335x_evm_defconfig` is an environment variable specifying which defconfig to use, it defaults to `qemu_arm_defconfig`. | ||
- `-v uboot-2022.07:/app` is a named volume to store u-boot sources, and to persist modifications when using this container as a develop environment. Additionally, using a named volume instead of a bind mount skips permission and performance problems on non-Linux host OSes. | ||
- `-v ccache:/ccache` is a named volume to store `ccache` objects. | ||
- `-v $(pwd)/mykconfig.fragment:/u-boot.fragment:ro` is an optional volume mapping a `Kconfig` fragment, which is applied via `scripts/kconfig/merge_configs.sh` after making the u-boot defconfig. | ||
- `-v $(pwd)/mygit.patch:/u-boot.patch:ro` is an optional volume mapping a git patch file, which is applied via `git apply u-boot.patch`. | ||
|
||
The `entrypoint` for this container automatically attempts to apply patches, `make` the defconfig, and then apply the configuration fragment on each invocation. The default `cmd` runs `make`. | ||
|
||
In order to run this as an interactive container, and to manually run the `make` process - you can use something like the following: | ||
|
||
```bash | ||
docker run --rm -it \ | ||
-e DEFCONFIG=am335x_evm_defconfig \ | ||
-v uboot-2022.07:/app \ | ||
-v ccache:/ccache \ | ||
robotpajamas/u-boot-builder:2022.07 bash | ||
``` | ||
|
||
## Snippets | ||
|
||
### Configuration Fragment | ||
|
||
```bash | ||
# mykconfig.fragment | ||
|
||
CONFIG_SYS_REDUNDAND_ENVIRONMENT=y | ||
CONFIG_ENV_SIZE=0x8000 | ||
CONFIG_ENV_OFFSET=0x100000 | ||
CONFIG_ENV_OFFSET_REDUND=0x200000 | ||
``` | ||
|
||
### Git Patch | ||
|
||
```bash | ||
docker run --rm -v uboot-2022.04:/app -v ccache:/ccache -it robotpajamas/u-boot-builder:latest bash | ||
diff --git a/README b/README | ||
index b7ab6e50..b36b6e99 100644 | ||
--- a/README | ||
+++ b/README | ||
@@ -1,6 +1,6 @@ | ||
# SPDX-License-Identifier: GPL-2.0+ | ||
# | ||
-# (C) Copyright 2000 - 2013 | ||
+# (C) Copyright 2000 - 2022 | ||
# Wolfgang Denk, DENX Software Engineering, [email protected]. | ||
|
||
make am335x_evm_defconfig | ||
make | ||
Summary: | ||
``` | ||
|
||
## TODO | ||
|
||
- These should probably be re-done with the `--mount` syntax, as it's clearer for documentation purposes. `-v` is a shortcut. | ||
- Check if `git apply` can be ignored once applied, or if the error can be ignored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /bin/sh | ||
|
||
# Working directory is /app (i.e. u-boot directory) | ||
|
||
# Apply u-boot fragment to configuration | ||
if test -f "/u-boot.patch"; then | ||
echo "***** Applying patch at /u-boot.patch *****" | ||
git apply /u-boot.patch | ||
fi | ||
|
||
echo "***** Making defconfig: ${DEFCONFIG} *****" | ||
KBUILD_VERBOSE=1 make ${DEFCONFIG} | ||
|
||
# Apply u-boot patch, if present | ||
if test -f "/u-boot.fragment"; then | ||
echo "***** Applying fragment at /u-boot.fragment *****" | ||
/app/scripts/kconfig/merge_config.sh /app/.config /u-boot.fragment | ||
fi | ||
|
||
exec "$@" |