Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/brm_shell_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ name: brm_shell_checker
on:
push:
branches: [ main ]
paths:
- '*.sh'
pull_request:
branches: [ main ]
paths:
- '*.sh'
jobs:
build:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 - 2024 Vladimir Roncevic <elektron.ronca@gmail.com>
# Copyright 2021 - 2026 Vladimir Roncevic <elektron.ronca@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,6 +39,7 @@ RUN DEBIAN_FRONTEND=noninteractive \
autotools-dev

RUN mkdir -p /data/dev/build_root/
COPY brm_setup.sh /data/dev/build_root/
COPY brm.sh /data/dev/build_root/
COPY brm_list_projects.sh /data/dev/build_root/
COPY brm_setup_project.sh /data/dev/build_root/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ drwxr-xr-x 3 electux electux 4096 Nov 2 17:43 rpi-firmware
Shell tool structure

```bash
brm.sh
brm_setup.sh
brm_list_projects.sh
brm_setup_project.sh
brm_clone_project.sh
Expand All @@ -371,6 +371,7 @@ brm_menu_configuration.sh
brm_build_project.sh
brm_list_images.sh
brm_clean_project.sh
brm.sh
```

### Docs
Expand All @@ -386,7 +387,7 @@ More documentation and info at

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Copyright (C) 2021 - 2024 by [electux.github.io/brm](https://electux.github.io/brm)
Copyright (C) 2021 - 2026 by [electux.github.io/brm](https://electux.github.io/brm)

**brm** is free software; you can redistribute it and/or modify
it under the same terms as Bash itself, either Bash version 4.2.47 or,
Expand Down
24 changes: 11 additions & 13 deletions brm.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/usr/bin/bash
#
# @brief Build root manager (brm)
# @version ver.1.0
# @version ver.1.1
# @date Sun Nov 21 00:40:40 CET 2021
# @company None, free software to use 2021
# @company None, free software to use 2021 - 2026
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

BUILD_ROOT_REPO="https://github.com/buildroot/buildroot.git"
BUILD_ROOT_DIR="/data/dev/build_root"

. brm_setup.sh
. brm_clone_project.sh
. brm_list_projects.sh
. brm_list_configurations.sh
Expand Down Expand Up @@ -58,32 +56,32 @@ END_HELP_TXT
#
# @brief Buildroot manager handler
# @param Value required option
# @retval Success return 0, else return 127
# @retval Success return SUCCESS, else return NOT_SUCCESS
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
# local OPTION="init" STATUS
# brm_handler $OPTION
# __brm_handler $OPTION
# STATUS=$?
#
# if [ $STATUS -eq 0 ]; then
# # true
# # notify admin | user success opearation
# # exit 0
# # exit $SUCCESS
# else
# # false
# # missing argument | failed operation
# # exit $STATUS
# # exit $NOT_SUCCESS
# fi
#
function brm_handler {
function __brm_handler {
local OPTION=$1 NUMBER_OF_ARGUMENTS=$# STATUS
if [[ "$NUMBER_OF_ARGUMENTS" -ne 1 || ! -n "${OPTION}" ]]; then
__brm_build_root_helper
return 127
return $NOT_SUCCESS
fi
STATUS=128
STATUS=$NOT_SUCCESS
case $OPTION in
"init")
printf "%s: " "[brm] provide project name"
Expand Down Expand Up @@ -125,6 +123,6 @@ function brm_handler {
}

# @brief Main entry point
brm_handler $1
__brm_handler $1
BRM_STATUS=$?
exit $BRM_STATUS
20 changes: 11 additions & 9 deletions brm_build_project.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/bash
#
# @brief Build root manager (brm)
# @version ver.1.0
# @version ver.1.1
# @date Sun Nov 21 00:40:40 CET 2021
# @company None, free software to use 2021
# @company None, free software to use 2021 - 2026
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

. brm_status.sh

#
# @brief Build project configuration
# @param Value required CONFIGURAITON
# @retval Success return 0, else return 127 | 128 | 129
# @retval Success return 0 (SUCCESS), else return 1 (NOT_SUCCESS)
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Expand All @@ -22,31 +24,31 @@
# if [ $STATUS -eq 0 ]; then
# # true
# # notify admin | user success operation
# # return 0
# # return $SUCCESS
# else
# # false
# # missing argument | tool | project dir doesn't exist
# # return 127 | 128 | 129
# # return $NOT_SUCCESS
# fi
#
function __brm_build_project {
local BUILD_CONFIGURATION=$1
if [[ ! -n "${BUILD_CONFIGURATION}" ]]; then
printf "%s\n" "[brm] missing target configuration"
return 127
return $NOT_SUCCESS
fi
local MAKE_PATH=$(which make)
if [[ ! -e ${MAKE_PATH} ]]; then
printf "%s\n" "[brm] check build automation tool: make"
return 128
return $NOT_SUCCESS
fi
if [[ ! -d "${BRM_DIR}/buildroot/" ]]; then
printf "%s\n" "[brm] expected directory: ${BRM_DIR}/buildroot"
return 129
return $NOT_SUCCESS
fi
cd "${BRM_DIR}/buildroot/"
make ${BUILD_CONFIGURATION}
make
cd ..
return 0
return $SUCCESS
}
16 changes: 9 additions & 7 deletions brm_clean_project.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/bash
#
# @brief Build root manager (brm)
# @version ver.1.0
# @version ver.1.1
# @date Sun Nov 21 00:40:40 CET 2021
# @company None, free software to use 2021
# @company None, free software to use 2021 - 2026
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

. brm_status.sh

#
# @brief Clean project structure
# @param None
# @retval Success return 0, else return 127
# @retval Success return 0 (SUCCESS), else return 1 (NOT_SUCCESS)
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Expand All @@ -22,21 +24,21 @@
# if [ $STATUS -eq 0 ]; then
# # true
# # notify admin | user success operation
# # return 0
# # return $SUCCESS
# else
# # false
# # project structure doesn't exist
# # return 127
# # return $NOT_SUCCESS
# fi
#
function __brm_clean_project {
local OUT_DIR="${BRM_DIR}/buildroot/output"
if [[ ! -d "${OUT_DIR}" ]]; then
printf "%s\n" "[brm] expected directory: project_dir/buildroot/output"
printf "%s\n" "[brm] check directory: ${OUT_DIR}"
return 127
return $NOT_SUCCESS
fi
rm -rf "${OUT_DIR}/target"
find "${OUT_DIR}/" -name ".stamp_target_installed" | xargs rm -rf
return 0
return $SUCCESS
}
16 changes: 9 additions & 7 deletions brm_clone_project.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/bash
#
# @brief Build root manager (brm)
# @version ver.1.0
# @version ver.1.1
# @date Sun Nov 21 00:40:40 CET 2021
# @company None, free software to use 2021
# @company None, free software to use 2021 - 2026
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

. brm_setup.sh

#
# @brief Clone git project structure
# @param None
# @retval Success return 0, else return 127
# @retval Success return 0 (SUCCESS), else return 1 (NOT_SUCCESS)
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Expand All @@ -22,19 +24,19 @@
# if [ $STATUS -eq 0 ]; then
# # true
# # notify admin | user success operation
# # return 0
# # return $SUCCESS
# else
# # false
# # missing git tool
# # return 127
# # return $NOT_SUCCESS
# fi
#
function __brm_clone_project {
local GIT_PATH=$(which git)
if [[ ! -e ${GIT_PATH} ]]; then
printf "%s\n" "[brm] check revision tool: git"
return 127
return $NOT_SUCCESS
fi
git clone "${BUILD_ROOT_REPO}"
return 0
return $SUCCESS
}
18 changes: 10 additions & 8 deletions brm_list_configurations.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/bash
#
# @brief Build root manager (brm)
# @version ver.1.0
# @version ver.1.1
# @date Sun Nov 21 00:40:40 CET 2021
# @company None, free software to use 2021
# @company None, free software to use 2021 - 2026
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

. brm_setup.sh

#
# @brief List supported buildroot configurations
# @param None
# @retval Success return 0, else return 127 | 128
# @retval Success return 0 (SUCCESS), else return 1 (NOT_SUCCESS)
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Expand All @@ -22,25 +24,25 @@
# if [ $STATUS -eq 0 ]; then
# # true
# # notify admin | user success operation
# # return 0
# # return $SUCCESS
# else
# # false
# # missing make tool | project structure doesn't exist
# # return 127 | 128
# # return $NOT_SUCCESS
# fi
#
function __brm_list_configurations {
local MAKE_PATH=$(which make)
if [[ ! -e ${MAKE_PATH} ]]; then
printf "%s\n" "[brm] check build automation tool: make"
return 127
return $NOT_SUCCESS
fi
if [[ ! -d "${BRM_DIR}/buildroot/" ]]; then
printf "%s\n" "[brm] expected directory: ${BRM_DIR}/buildroot/"
return 128
return $NOT_SUCCESS
fi
cd "${BRM_DIR}/buildroot/"
make list-defconfigs
cd ..
return 0
return $SUCCESS
}
16 changes: 9 additions & 7 deletions brm_list_images.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/bash
#
# @brief Build root manager (brm)
# @version ver.1.0
# @version ver.1.1
# @date Sun Nov 21 00:40:40 CET 2021
# @company None, free software to use 2021
# @company None, free software to use 2021 - 2026
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#

. brm_status.sh

#
# @brief List build output images
# @param None
# @retval Success return 0, else return 127
# @retval Success return 0 (SUCCESS), else return 1 (NOT_SUCCESS)
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Expand All @@ -22,19 +24,19 @@
# if [ $STATUS -eq 0 ]; then
# # true
# # notify admin | user success operation
# # return 0
# # return $SUCCESS
# else
# # false
# # project image directory doesn't exist
# # return 127
# # return $NOT_SUCCESS
# fi
#
function __brm_list_images {
local PROJECT_IMAGE_DIR="${BRM_DIR}/buildroot/output/images"
if [[ ! -d "${PROJECT_IMAGE_DIR}" ]]; then
printf "%s\n" "[brm] expected directory: ${PROJECT_IMAGE_DIR}"
return 127
return $NOT_SUCCESS
fi
ls -all "${PROJECT_IMAGE_DIR}"
return 0
return $SUCCESS
}
Loading