Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uboot-mkimage: show help before ERROR message #1

Merged
merged 2 commits into from
Oct 20, 2016
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
36 changes: 36 additions & 0 deletions U-boot/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
============================================================
Title: README

Author: Jose Lopez

Date: 2016-10-13

Email address: joselj@ugr.es

Description: Brief readme file to use uboot-mkimage.sh

============================================================

To make use of uboot-mkimage.sh, you will need a copy of the ugr-scripts
repository which is available at https://github.com/TimingKeepers/ugr-scripts

The script can be found at <repo_directory>/U-boot/uboot-mkimage.sh


First of all, you will need to export an environment variable:

$ export SCRIPT_BASE_FOLDER=/absolute/path/to/repository/ugr-scripts


Then, if you have a uramimage.image.gz file and you want to unpack it to some
location, just run:

$ ./uboot-mkimage.sh -u -r /absolute/path/where/image/will/be/unpacked -i /absolute/path/to/uramdisk.image.gz


Or the other way around (packing rootfs to a file):

$ ./uboot-mkimage.sh -p -r /absolute/path/where/image/will/be/unpacked -i /absolute/path/to/uramdisk.image.gz


Easy!
40 changes: 22 additions & 18 deletions U-boot/uboot-mkimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,29 @@
#

#include util.sh

function help_msg {
echo -e "-------------------------------------------------------------------"
echo -e "$(basename $0) -p -u -r <rootfs> -i <image>"
echo -e ""
echo -e "Options:"
echo -e "\t-m: Mode (pack|unpack)"
echo -e "\t-c: Compress mode (none|gzip)"
echo -e "\t-r: Root filesystem folder"
echo -e "\t-i: Image name without extension"
echo -e "\t-h: Print help message"
echo -e ""
echo -e "Variable SCRIPT_BASE_FOLDER must contain repository parent folder"
echo -e ""
echo -e "-------------------------------------------------------------------"
echo -e "Copyright (C) 2015, University of Granada"
echo -e "Miguel Jimenez Lopez <klyone@ugr.es>"
echo -e "GPLv2 License or later"
echo -e "-------------------------------------------------------------------"
}

if [ -z ${SCRIPT_BASE_FOLDER} ] ; then
help_msg
echo "ERROR: SCRIPT_BASE_FOLDER var not defined!"
exit -1
fi
Expand Down Expand Up @@ -49,24 +71,6 @@ function uboot_image_pack {
esac
}

function help_msg {
echo_norm "-------------------------------------------------------------------"
echo_norm "$(basename $0) -p -u -r <rootfs> -i <image>"
echo_norm ""
echo_norm "Options:"
echo_norm "\t-m: Mode (pack|unpack)"
echo_norm "\t-c: Compress mode (none|gzip)"
echo_norm "\t-r: Root filesystem folder"
echo_norm "\t-i: Image name without extension"
echo_norm "\t-h: Print help message"
echo_norm ""
echo_norm "-------------------------------------------------------------------"
echo_norm "Copyright (C) 2015, University of Granada"
echo_norm "Miguel Jimenez Lopez <klyone@ugr.es>"
echo_norm "GPLv2 License or later"
echo_norm "-------------------------------------------------------------------"
}

while getopts ":m:c:r:i:h" opt; do
case $opt in
m)
Expand Down