Improve MK404-build.sh check, update
This commit is contained in:
parent
4e6fd2a92d
commit
1a5898c673
@ -17,23 +17,27 @@
|
|||||||
# 12 Feb 2021, 3d-gussner, Update cmake
|
# 12 Feb 2021, 3d-gussner, Update cmake
|
||||||
# 13 Feb 2021, 3d-gussner, Auto build SD cards
|
# 13 Feb 2021, 3d-gussner, Auto build SD cards
|
||||||
|
|
||||||
while getopts c:u:f:?h flag
|
while getopts c:u:f:m:g:?h flag
|
||||||
do
|
do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
c) check_flag=${OPTARG};;
|
c) check_flag=${OPTARG};;
|
||||||
u) update_flag=${OPTARG};;
|
u) update_flag=${OPTARG};;
|
||||||
f) force_flag=${OPTARG};;
|
f) force_flag=${OPTARG};;
|
||||||
|
m) mk404_flag=${OPTARG};;
|
||||||
|
g) graphics_flag=${OPTARG};;
|
||||||
?) help_flag=1;;
|
?) help_flag=1;;
|
||||||
h) help_flag=1;;
|
h) help_flag=1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo "$check_flag"
|
echo "$check_flag"
|
||||||
echo "$update_flag"
|
echo "$update_flag"
|
||||||
|
echo "$force_flag"
|
||||||
|
echo "$mk404_flag"
|
||||||
|
echo "$graphics_flag"
|
||||||
|
|
||||||
|
|
||||||
#### Start check if OSTYPE is supported
|
#### Start check if OSTYPE is supported
|
||||||
OS_FOUND=$( command -v uname)
|
OS_FOUND=$( command -v uname)
|
||||||
|
|
||||||
case $( "${OS_FOUND}" | tr '[:upper:]' '[:lower:]') in
|
case $( "${OS_FOUND}" | tr '[:upper:]' '[:lower:]') in
|
||||||
linux*)
|
linux*)
|
||||||
TARGET_OS="linux"
|
TARGET_OS="linux"
|
||||||
@ -122,14 +126,82 @@ if [ ! -d $MK404_PATH ]; then
|
|||||||
git clone $MK404_URL $MK404_PATH
|
git clone $MK404_URL $MK404_PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Init and update submodules
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
cd $MK404_PATH
|
cd $MK404_PATH
|
||||||
git submodule init
|
|
||||||
git submodule update
|
# Check for updates ... WIP
|
||||||
|
|
||||||
|
# Check MK404
|
||||||
|
if [ "$force_flag" == "1" ]; then
|
||||||
|
check_flag=1
|
||||||
|
update_flag=1
|
||||||
|
fi
|
||||||
|
if [ "$update_flag" == "1" ]; then
|
||||||
|
check_flag=1
|
||||||
|
fi
|
||||||
|
if [ "$check_flag" == "1" ]; then
|
||||||
|
if [ -d $MK404_BUILD_PATH ]; then
|
||||||
|
cd $MK404_BUILD_PATH
|
||||||
|
MK404_current_version=$( command ./MK404 --version | grep "MK404" | cut -f 4 -d " ")
|
||||||
|
cd $MK404_PATH
|
||||||
|
else
|
||||||
|
echo "Cannot check current version as it has not been build."
|
||||||
|
fi
|
||||||
|
# Get local Commit_Hash
|
||||||
|
MK404_local_GIT_COMMIT_HASH=$(git log --pretty=format:"%H" -1)
|
||||||
|
# Get local Commit_Number
|
||||||
|
MK404_local_GIT_COMMIT_NUMBER=$(git rev-list HEAD --count)
|
||||||
|
# Get remote Commit_Hash
|
||||||
|
MK404_remote_GIT_COMMIT_HASH=$(git ls-remote --heads $(git config --get remote.origin.url) | grep "refs/heads/master" | cut -f 1)
|
||||||
|
# Get remote Commit_Number
|
||||||
|
MK404_remote_GIT_COMMIT_NUMBER=$(git rev-list origin/master --count)
|
||||||
|
# Output
|
||||||
|
echo "Current version : $MK404_current_version"
|
||||||
|
echo ""
|
||||||
|
echo "Current local hash : $MK404_local_GIT_COMMIT_HASH"
|
||||||
|
echo "Current local commit nr : $MK404_local_GIT_COMMIT_NUMBER"
|
||||||
|
if [ "$MK404_local_GIT_COMMIT_HASH" != "$MK404_remote_GIT_COMMIT_HASH" ]; then
|
||||||
|
echo "$(tput setaf 1)"
|
||||||
|
else
|
||||||
|
echo "$(tput sgr 0)"
|
||||||
|
fi
|
||||||
|
echo "Current remote hash : $MK404_remote_GIT_COMMIT_HASH"
|
||||||
|
echo "Current remote commit nr: $MK404_remote_GIT_COMMIT_NUMBER"
|
||||||
|
echo "$(tput sgr 0)"
|
||||||
|
|
||||||
|
# Check for updates
|
||||||
|
if [[ "$MK404_local_GIT_COMMIT_HASH" != "$MK404_remote_GIT_COMMIT_HASH" && -z "$update_flag" ]]; then
|
||||||
|
echo "$(tput setaf 2)Update is availible.$(tput sgr 0)"
|
||||||
|
read -t 10 -n 1 -p "$(tput setaf 3)Update now Y/n$(tput sgr 0)" update_answer
|
||||||
|
if [ "$update_answer" == "Y" ]; then
|
||||||
|
update_flag=1
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Check for updates
|
||||||
|
if [ "$update_flag" == "1" ]; then
|
||||||
|
if [ "$MK404_local_GIT_COMMIT_HASH" != "$MK404_remote_GIT_COMMIT_HASH" ]; then
|
||||||
|
echo ""
|
||||||
|
git fetch --all
|
||||||
|
read -t 10 -p "$(tput setaf 2)Updating MK404 !$(tput sgr 0)"
|
||||||
|
echo ""
|
||||||
|
git reset --hard origin/master
|
||||||
|
read -t 10 -p "$(tput setaf 2)Compiling MK404 !$(tput sgr 0)"
|
||||||
|
echo ""
|
||||||
|
force_flag=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Prepare MK404
|
# Prepare MK404
|
||||||
mkdir -p $MK404_BUILD_PATH
|
mkdir -p $MK404_BUILD_PATH
|
||||||
if [[ ! -f "$MK404_BUILD_PATH/Makefile" || "$force_flag" == "1" ]]; then
|
if [[ ! -f "$MK404_BUILD_PATH/Makefile" || "$force_flag" == "1" ]]; then
|
||||||
|
# Init and update submodules
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
cmake -B$MK404_BUILD_PATH -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
|
cmake -B$MK404_BUILD_PATH -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -149,8 +221,3 @@ if [[ ! -f "$MK404_BUILD_PATH/Prusa_MK3S_SDcard.bin" || "$force_flag" == "1" ]];
|
|||||||
cmake --build $MK404_BUILD_PATH --config Release --target Prusa_MK3MMU2_SDcard.bin
|
cmake --build $MK404_BUILD_PATH --config Release --target Prusa_MK3MMU2_SDcard.bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for updates ... WIP
|
|
||||||
if [ "$check_flag" == "1" ]; then
|
|
||||||
current_version=$( command ./MK404 --version | grep "MK404" | cut -f 4 -d " ")
|
|
||||||
echo "Current version: $current_version"
|
|
||||||
fi
|
|
18
PF-build.sh
18
PF-build.sh
@ -886,9 +886,9 @@ do
|
|||||||
if [ "$MOTHERBOARD" = "BOARD_EINSY_1_0a" ]; then
|
if [ "$MOTHERBOARD" = "BOARD_EINSY_1_0a" ]; then
|
||||||
echo "$(tput setaf 2)Copying multi language firmware for MK3/Einsy board to PF-build-hex folder$(tput sgr 0)"
|
echo "$(tput setaf 2)Copying multi language firmware for MK3/Einsy board to PF-build-hex folder$(tput sgr 0)"
|
||||||
# Make a copy of "lang.bin" for MK404 MK3 and MK3S
|
# Make a copy of "lang.bin" for MK404 MK3 and MK3S
|
||||||
#if [ ! -z "$mk404_flag" ]; then
|
if [ ! -z "$mk404_flag" ]; then
|
||||||
#cp -f lang.bin $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-lang.bin
|
cp -f lang.bin $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-lang.bin
|
||||||
#fi
|
fi
|
||||||
# End of "lang.bin" for MK3 and MK3S copy
|
# End of "lang.bin" for MK3 and MK3S copy
|
||||||
cp -f firmware.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex
|
cp -f firmware.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex
|
||||||
else
|
else
|
||||||
@ -977,7 +977,7 @@ echo "more information how to flash firmware https://www.prusa3d.com/drivers/ $(
|
|||||||
|
|
||||||
# Check/compile MK404 sim
|
# Check/compile MK404 sim
|
||||||
if [ ! -z "$mk404_flag" ]; then
|
if [ ! -z "$mk404_flag" ]; then
|
||||||
./MK404-build.sh
|
./MK404-build.sh -c1
|
||||||
|
|
||||||
# For Prusa MK2, MK2.5/S
|
# For Prusa MK2, MK2.5/S
|
||||||
if [ "$MOTHERBOARD" == "BOARD_RAMBO_MINI_1_3" ]; then
|
if [ "$MOTHERBOARD" == "BOARD_RAMBO_MINI_1_3" ]; then
|
||||||
@ -1009,11 +1009,11 @@ if [ ! -z "$mk404_flag" ]; then
|
|||||||
cd ../MK404/master/build
|
cd ../MK404/master/build
|
||||||
|
|
||||||
# Copy language bin file for MK3 and MK3S to xflash
|
# Copy language bin file for MK3 and MK3S to xflash
|
||||||
#if [ -f $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-lang.bin ]; then
|
if [ -f $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-lang.bin ]; then
|
||||||
#echo "Copy 'FW$FW-Build$BUILD-$VARIANT-lang.bin' to 'Prusa_${PRINTER}_xflash.bin'"
|
echo "Copy 'FW$FW-Build$BUILD-$VARIANT-lang.bin' to 'Prusa_${PRINTER}_xflash.bin'"
|
||||||
#dd if=/dev/zero bs=1 count=262145 | tr "\000" "\377" >Prusa_${PRINTER}_xflash.bin
|
dd if=/dev/zero bs=1 count=262145 | tr "\000" "\377" >Prusa_${PRINTER}_xflash.bin
|
||||||
#dd if=$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-lang.bin of=Prusa_${PRINTER}_xflash.bin conv=notrunc
|
dd if=$SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-lang.bin of=Prusa_${PRINTER}_xflash.bin conv=notrunc
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
# Start MK404
|
# Start MK404
|
||||||
# default with serial output and terminal to manipulate it via terminal
|
# default with serial output and terminal to manipulate it via terminal
|
||||||
|
Loading…
Reference in New Issue
Block a user