-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from radxa-repo/ubuild
Rework lbuild & ubuild into a single tool
- Loading branch information
Showing
174 changed files
with
2,903 additions
and
410 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
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,4 +2,4 @@ | |
.src/ | ||
.root/ | ||
.vscode/ | ||
forks/**/0500-private/ | ||
**/0500-private/ |
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,24 +1,28 @@ | ||
# lbuild - Radxa Linux Kernel Build Tool | ||
# bsp - Radxa BSP Build Tool | ||
|
||
[![Build](https://github.com/radxa-repo/lbuild/actions/workflows/build.yml/badge.svg)](https://github.com/radxa-repo/lbuild/actions/workflows/build.yml) | ||
[![Build](https://github.com/radxa-repo/bsp/actions/workflows/build.yml/badge.svg)](https://github.com/radxa-repo/bsp/actions/workflows/build.yml) | ||
|
||
`lbuild` aims to provide a standardized way to build Linux kernel for Radxa boards, so the resulting file can be easliy included in our image generation pipeline. | ||
`bsp` aims to provide a standardized way to build Linux kernel and U-Boot for Radxa boards, so the build output can be easliy included in our image generation pipeline. | ||
|
||
## Usage | ||
|
||
### Local | ||
### Local | ||
|
||
Please run the following command to check all available options: | ||
|
||
``` | ||
git clone --depth 1 https://github.com/radxa-repo/lbuild.git | ||
lbuild/lbuild | ||
git clone --depth 1 https://github.com/radxa-repo/bsp.git | ||
cd ./bsp | ||
./bsp | ||
``` | ||
|
||
You can then build the bootloader with supported options. The resulting deb package will be stored in your current directory. | ||
You can then build the BSP components with supported options. The resulting deb package will be stored in your current directory. | ||
|
||
### Running in GitHub Action | ||
|
||
Please check out our [GitHub workflows](https://github.com/radxa-repo/lbuild/tree/main/.github/workflows). | ||
Please check out our [GitHub workflows](https://github.com/radxa-repo/bsp/tree/main/.github/workflows). | ||
|
||
## Documentation | ||
Please visit [Radxa Documentation](https://radxa-doc.github.io/). | ||
|
||
Please visit [Radxa Documentation](https://radxa-doc.github.io/). | ||
|
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
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,157 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR="$(dirname "$(realpath "$0")")" | ||
source "$SCRIPT_DIR/lib/utils.sh" | ||
|
||
usage() { | ||
cat >&2 << EOF | ||
Radxa BSP Build Tool | ||
usage: $(basename "$0") [options] <linux|u-boot> <edition> [product] | ||
When building u-boot, you can also provide 'product' argument, | ||
which will only build for that specific image. | ||
Supported package generation options: | ||
-r, --revision [num] | ||
Specify custom revision number, default=1 | ||
--no-prepare-source Allow building against locally modified repos | ||
Alternative functionalities | ||
--json [catagory] Print supported options in json format | ||
Available catagories: $(get_supported_infos) | ||
-h, --help Show this help message | ||
Supported Linux edition: | ||
$(printf_array " %s\n" "$(get_supported_edition linux)") | ||
Supported U-Boot edition: | ||
$(printf_array " %s\n" "$(get_supported_edition u-boot)") | ||
EOF | ||
} | ||
|
||
get_supported_edition() { | ||
if [[ ! -d "$SCRIPT_DIR/$1" ]] || [[ -z "$1" ]] | ||
then | ||
error $EXIT_UNSUPPORTED_OPTION "$1" | ||
fi | ||
|
||
local editions=() | ||
for f in $(ls $SCRIPT_DIR/$1) | ||
do | ||
editions+="$f " | ||
done | ||
echo "${editions[@]}" | ||
} | ||
|
||
get_supported_infos() { | ||
local infos=("edition linux" "edition u-boot") | ||
echo "${infos[@]}" | ||
} | ||
|
||
json() { | ||
local array=( "$(get_supported_infos)" ) | ||
if ! in_array "$@" "${array[@]}" | ||
then | ||
error $EXIT_UNKNOWN_OPTION "$1" | ||
fi | ||
|
||
local output | ||
output=( $(get_supported_$@) ) | ||
if (( $? != 0 )) | ||
then | ||
return 1 | ||
fi | ||
printf_array "json" "${output[@]}" | ||
} | ||
|
||
build() { | ||
prepare_source "$TARGET" | ||
|
||
bsp_prepare | ||
|
||
bsp_make $BSP_DEFCONFIG 2>&1 | tee -a "$SCRIPT_DIR/.src/build.log" | ||
|
||
for d in $(find -L "$SCRIPT_DIR/$TARGET/$FORK" -mindepth 1 -type d | sort) | ||
do | ||
apply_kconfig "$d/kconfig.conf" | ||
done | ||
apply_kconfig "$SCRIPT_DIR/$TARGET/$FORK/kconfig.conf" | ||
|
||
bsp_make olddefconfig $BSP_MAKE_TARGETS 2>&1 | tee -a "$SCRIPT_DIR/.src/build.log" | ||
} | ||
|
||
main() { | ||
local PKG_REVISION="1" | ||
local NO_PREPARE_SOURCE= | ||
|
||
if [[ -e "$SCRIPT_DIR/.src/build.log" ]] | ||
then | ||
rm "$SCRIPT_DIR/.src/build.log" | ||
fi | ||
|
||
while (( $# > 0 )) | ||
do | ||
case "$1" in | ||
-r | --revision) | ||
PKG_REVISION="$2" | ||
shift 2 | ||
;; | ||
--no-prepare-source) | ||
NO_PREPARE_SOURCE="yes" | ||
shift | ||
;; | ||
--json) | ||
shift | ||
json "$@" | ||
return | ||
;; | ||
-h | --help) | ||
usage | ||
return | ||
;; | ||
-*) | ||
error $EXIT_UNKNOWN_OPTION "$1" | ||
;; | ||
linux) | ||
load_edition "$1" "$2" | ||
build | ||
bsp_makedeb | ||
return | ||
;; | ||
u-boot) | ||
load_edition "$1" "$2" | ||
|
||
if [[ -n "$3" ]] | ||
then | ||
if ! in_array "$3" "${SUPPORTED_BOARDS[@]}" | ||
then | ||
error $EXIT_UNKNOWN_OPTION "$1" | ||
fi | ||
local products=("$3") | ||
else | ||
local products=("${SUPPORTED_BOARDS[@]}") | ||
fi | ||
|
||
rm -rf "$SCRIPT_DIR/.root" | ||
|
||
for BOARD in "${products[@]}" | ||
do | ||
load_edition "$1" "$2" | ||
bsp_$BOARD | ||
build | ||
bsp_preparedeb | ||
NO_PREPARE_SOURCE="yes" | ||
done | ||
|
||
SUPPORTED_BOARDS=("${products[@]}") | ||
bsp_makedeb | ||
return | ||
;; | ||
*) break ;; | ||
esac | ||
done | ||
usage | ||
return 1 | ||
} | ||
|
||
main "$@" |
Oops, something went wrong.