blobutil/extract: simplified main()
parent
1ffb32b78f
commit
1f8ad1e46a
|
@ -19,28 +19,22 @@ main()
|
||||||
board="${1}"
|
board="${1}"
|
||||||
vendor_rom="${2}"
|
vendor_rom="${2}"
|
||||||
|
|
||||||
if [ ! -f "${vendor_rom}" ] ; then
|
Check_board
|
||||||
Print_help
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "resources/coreboot/${board}" ]; then
|
|
||||||
Print_help
|
|
||||||
printf "build/roms %s: target not defined.\n" \
|
|
||||||
"${projectname}" ${board}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
|
|
||||||
Print_help
|
|
||||||
printf "build/roms %s: missing board.cfg.\n" ${board}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
Build_deps
|
Build_deps
|
||||||
Extract_blobs
|
Extract_blobs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Check_board()
|
||||||
|
{
|
||||||
|
if [ ! -f "${vendor_rom}" ] ; then
|
||||||
|
Fail "file does not exist: ${vendor_rom}"
|
||||||
|
elif [ ! -d "resources/coreboot/${board}" ]; then
|
||||||
|
Fail "build/roms ${board}: target not defined"
|
||||||
|
elif [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
|
||||||
|
Fail "build/roms ${board}: missing board.cfg"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
Build_deps(){
|
Build_deps(){
|
||||||
if [ ! -d me_cleaner ]; then
|
if [ ! -d me_cleaner ]; then
|
||||||
printf "downloading me_cleaner\n"
|
printf "downloading me_cleaner\n"
|
||||||
|
@ -106,16 +100,16 @@ Extract_blobs(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
Print_help(){
|
|
||||||
printf "Usage: ./blobutil extract {boardname} {path/to/vendor_rom}\n"
|
|
||||||
printf "Example: ./blobutil extract x230 12mb_flash.bin\n"
|
|
||||||
printf "\nYou need to specify exactly 2 arguments\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
Fail(){
|
Fail(){
|
||||||
Print_help
|
Print_help
|
||||||
printf "\n%s: ERROR: %s\n" ${sname} $@
|
printf "\n%s: ERROR: %s\n" ${sname} $@
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Print_help(){
|
||||||
|
printf "Usage: ./blobutil extract {boardname} {path/to/vendor_rom}\n"
|
||||||
|
printf "Example: ./blobutil extract x230 12mb_flash.bin\n"
|
||||||
|
printf "\nYou need to specify exactly 2 arguments\n"
|
||||||
|
}
|
||||||
|
|
||||||
main $@
|
main $@
|
||||||
|
|
Loading…
Reference in New Issue