Add MK404 support
Indentations
This commit is contained in:
parent
86e117679c
commit
de337476cd
135
MK404-build.sh
Executable file
135
MK404-build.sh
Executable file
@ -0,0 +1,135 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# This bash script is used to compile automatically the MK404 simulator
|
||||||
|
#
|
||||||
|
# Supported OS: Linux64 bit
|
||||||
|
#
|
||||||
|
# Linux:
|
||||||
|
# Linux Ubuntu
|
||||||
|
# 1. Follow these instructions
|
||||||
|
# 2. Open Ubuntu bash and get latest updates with 'sudo apt-get update'
|
||||||
|
# 3. Install latest updates with 'sudo apt-get upgrade'
|
||||||
|
# 4.
|
||||||
|
#
|
||||||
|
# Version: 0.1-Build_1
|
||||||
|
# Change log:
|
||||||
|
# 11 Feb 2021, 3d-gussner, Inital
|
||||||
|
# 11 Feb 2021, 3d-gussner, Optional flags to check for updates
|
||||||
|
|
||||||
|
|
||||||
|
while getopts c:u:?h flag
|
||||||
|
do
|
||||||
|
case "${flag}" in
|
||||||
|
c) check_flag=${OPTARG};;
|
||||||
|
u) update_flag=${OPTARG};;
|
||||||
|
?) help_flag=1;;
|
||||||
|
h) help_flag=1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo "$check_flag"
|
||||||
|
echo "$update_flag"
|
||||||
|
|
||||||
|
|
||||||
|
#### Start check if OSTYPE is supported
|
||||||
|
OS_FOUND=$( command -v uname)
|
||||||
|
|
||||||
|
case $( "${OS_FOUND}" | tr '[:upper:]' '[:lower:]') in
|
||||||
|
linux*)
|
||||||
|
TARGET_OS="linux"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
TARGET_OS='unknown'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Linux
|
||||||
|
if [ $TARGET_OS == "linux" ]; then
|
||||||
|
if [ $(uname -m) == "x86_64" ]; then
|
||||||
|
echo "$(tput setaf 2)Linux 64-bit found$(tput sgr0)"
|
||||||
|
Processor="64"
|
||||||
|
#elif [[ $(uname -m) == "i386" || $(uname -m) == "i686" ]]; then
|
||||||
|
# echo "$(tput setaf 2)Linux 32-bit found$(tput sgr0)"
|
||||||
|
# Processor="32"
|
||||||
|
else
|
||||||
|
echo "$(tput setaf 1)Unsupported OS: Linux $(uname -m)"
|
||||||
|
echo "Please refer to the notes of build.sh$(tput sgr0)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$(tput setaf 1)This script doesn't support your Operating system!"
|
||||||
|
echo "Please use Linux 64-bit"
|
||||||
|
echo "Read the notes of build.sh$(tput sgr0)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
#### End check if OSTYPE is supported
|
||||||
|
|
||||||
|
#### Check MK404 dependencies
|
||||||
|
packages=(
|
||||||
|
"libelf-dev"
|
||||||
|
"gcc-7"
|
||||||
|
"gcc-avr"
|
||||||
|
"libglew-dev"
|
||||||
|
"freeglut3-dev"
|
||||||
|
"libsdl-sound1.2-dev"
|
||||||
|
"libpng-dev"
|
||||||
|
"cmake"
|
||||||
|
"zip"
|
||||||
|
"wget"
|
||||||
|
"git"
|
||||||
|
"build-essential"
|
||||||
|
"lcov"
|
||||||
|
"mtools"
|
||||||
|
)
|
||||||
|
|
||||||
|
for check_package in ${packages[@]}; do
|
||||||
|
if dpkg-query -W -f'${db:Status-Abbrev}\n' $check_package 2>/dev/null \
|
||||||
|
| grep -q '^.i $'; then
|
||||||
|
echo "$(tput setaf 2)$check_package: Installed$(tput sgr0)"
|
||||||
|
else
|
||||||
|
echo "$(tput setaf 1)$check_package: Not installed use $(tput setaf 3)'sudo apt install $check_package'$(tput setaf 1) to install missing package$(tput sgr0)"
|
||||||
|
not_installed=1;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$not_installed" = "1" ]; then
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
#### End Check MK404 dependencies
|
||||||
|
|
||||||
|
#### Set build environment
|
||||||
|
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||||
|
MK404_URL="https://github.com/vintagepc/MK404.git"
|
||||||
|
MK404_PATH="$SCRIPT_PATH/../MK404"
|
||||||
|
MK404_BUILD_PATH="$MK404_PATH/build"
|
||||||
|
|
||||||
|
|
||||||
|
# List few useful data
|
||||||
|
echo
|
||||||
|
echo "Script path :" $SCRIPT_PATH
|
||||||
|
echo "OS :" $OS
|
||||||
|
echo "OS type :" $TARGET_OS
|
||||||
|
echo ""
|
||||||
|
echo "MK404 path :" $MK404_PATH
|
||||||
|
|
||||||
|
if [ ! -d $MK404_PATH ]; then
|
||||||
|
git clone $MK404_URL $MK404_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $MK404_PATH
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p $MK404_BUILD_PATH
|
||||||
|
if [ ! -f "$MK404_BUILD_PATH/Makefile" ]; then
|
||||||
|
cmake -B $MK404_BUILD_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $MK404_BUILD_PATH
|
||||||
|
if [ ! -f "$MK404_BUILD_PATH/MK404" ]; then
|
||||||
|
make
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$check_flag" == "1" ]; then
|
||||||
|
current_version=$( command ./MK404 --version | grep "MK404" | cut -f 4 -d " ")
|
||||||
|
echo "Current version: $current_version"
|
||||||
|
fi
|
44
PF-build.sh
44
PF-build.sh
@ -136,6 +136,8 @@
|
|||||||
# 08 Jan 2021, 3d-gussner, Comment out 'sudo' auto installation
|
# 08 Jan 2021, 3d-gussner, Comment out 'sudo' auto installation
|
||||||
# Add '-?' '-h' help option
|
# Add '-?' '-h' help option
|
||||||
# 27 Jan 2021, 3d-gussner, Add `-c`, `-p` and `-n` options
|
# 27 Jan 2021, 3d-gussner, Add `-c`, `-p` and `-n` options
|
||||||
|
# 12 Feb 2021, 3d-gussner, Add MK404-build.sh
|
||||||
|
# 13 Feb 2021, 3d-gussner, Indentations
|
||||||
|
|
||||||
#### Start check if OSTYPE is supported
|
#### Start check if OSTYPE is supported
|
||||||
OS_FOUND=$( command -v uname)
|
OS_FOUND=$( command -v uname)
|
||||||
@ -452,7 +454,7 @@ if type git > /dev/null; then
|
|||||||
git_available="1"
|
git_available="1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts v:l:d:b:o:c:p:n:?h flag
|
while getopts v:l:d:b:o:c:p:n:m:g:?h flag
|
||||||
do
|
do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
v) variant_flag=${OPTARG};;
|
v) variant_flag=${OPTARG};;
|
||||||
@ -463,6 +465,8 @@ while getopts v:l:d:b:o:c:p:n:?h flag
|
|||||||
c) clean_flag=${OPTARG};;
|
c) clean_flag=${OPTARG};;
|
||||||
p) prusa_flag=${OPTARG};;
|
p) prusa_flag=${OPTARG};;
|
||||||
n) new_build_flag=${OPTARG};;
|
n) new_build_flag=${OPTARG};;
|
||||||
|
m) mk404_flag=${OPTARG};;
|
||||||
|
g) grafics_flag=${OPTARG};;
|
||||||
?) help_flag=1;;
|
?) help_flag=1;;
|
||||||
h) help_flag=1;;
|
h) help_flag=1;;
|
||||||
esac
|
esac
|
||||||
@ -492,11 +496,13 @@ echo "$(tput setaf 2)-o$(tput sgr0) Output '$(tput setaf 2)1$(tput sgr0)' force
|
|||||||
echo "$(tput setaf 2)-c$(tput sgr0) Do not clean up lang build'$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes"
|
echo "$(tput setaf 2)-c$(tput sgr0) Do not clean up lang build'$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes"
|
||||||
echo "$(tput setaf 2)-p$(tput sgr0) Keep Configuration_prusa.h '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes"
|
echo "$(tput setaf 2)-p$(tput sgr0) Keep Configuration_prusa.h '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes"
|
||||||
echo "$(tput setaf 2)-n$(tput sgr0) New fresh build '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes"
|
echo "$(tput setaf 2)-n$(tput sgr0) New fresh build '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes"
|
||||||
|
echo "$(tput setaf 2)-m$(tput sgr0) Start MK404 sim '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes '$(tput setaf 2)2$(tput sgr0)' with MMU2"
|
||||||
|
echo "$(tput setaf 2)-g$(tput sgr0) Start MK404 grafics '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' lite '$(tput setaf 2)2$(tput sgr0)' fancy"
|
||||||
echo "$(tput setaf 2)-?$(tput sgr0) Help"
|
echo "$(tput setaf 2)-?$(tput sgr0) Help"
|
||||||
echo "$(tput setaf 2)-h$(tput sgr0) Help"
|
echo "$(tput setaf 2)-h$(tput sgr0) Help"
|
||||||
echo
|
echo
|
||||||
echo "Brief USAGE:"
|
echo "Brief USAGE:"
|
||||||
echo " $(tput setaf 2)./PF-build.sh$(tput sgr0) [-v] [-l] [-d] [-b] [-o] [-c] [-p] [-n]"
|
echo " $(tput setaf 2)./PF-build.sh$(tput sgr0) [-v] [-l] [-d] [-b] [-o] [-c] [-p] [-n] [-m]"
|
||||||
echo
|
echo
|
||||||
echo "Example:"
|
echo "Example:"
|
||||||
echo " $(tput setaf 2)./PF-build.sh -v All -l ALL -d GOLD$(tput sgr0)"
|
echo " $(tput setaf 2)./PF-build.sh -v All -l ALL -d GOLD$(tput sgr0)"
|
||||||
@ -671,6 +677,7 @@ fi
|
|||||||
for v in ${VARIANTS[*]}
|
for v in ${VARIANTS[*]}
|
||||||
do
|
do
|
||||||
VARIANT=$(basename "$v" ".h")
|
VARIANT=$(basename "$v" ".h")
|
||||||
|
PRINTER=$(grep --max-count=1 "\bPRINTER_TYPE\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3 | cut -d '_' -f2)
|
||||||
# Find firmware version in Configuration.h file and use it to generate the hex filename
|
# Find firmware version in Configuration.h file and use it to generate the hex filename
|
||||||
FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g')
|
FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g')
|
||||||
if [ -z "$BUILD" ] ; then
|
if [ -z "$BUILD" ] ; then
|
||||||
@ -756,6 +763,7 @@ do
|
|||||||
|
|
||||||
#List some useful data
|
#List some useful data
|
||||||
echo "$(tput setaf 2)$(tput setab 7) "
|
echo "$(tput setaf 2)$(tput setab 7) "
|
||||||
|
echo "Printer :" $PRINTER
|
||||||
echo "Variant :" $VARIANT
|
echo "Variant :" $VARIANT
|
||||||
echo "Firmware :" $FW
|
echo "Firmware :" $FW
|
||||||
echo "Build # :" $BUILD
|
echo "Build # :" $BUILD
|
||||||
@ -887,6 +895,9 @@ do
|
|||||||
zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex
|
zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex
|
||||||
rm $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex
|
rm $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex
|
||||||
elif [ $TARGET_OS == "linux" ]; then
|
elif [ $TARGET_OS == "linux" ]; then
|
||||||
|
if [ ! -z "$mk404_flag" ]; then
|
||||||
|
cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex
|
||||||
|
fi
|
||||||
zip -m -j ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex
|
zip -m -j ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.zip ../../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-??.hex
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -945,9 +956,36 @@ done
|
|||||||
|
|
||||||
# Switch to hex path and list build files
|
# Switch to hex path and list build files
|
||||||
cd $SCRIPT_PATH
|
cd $SCRIPT_PATH
|
||||||
cd ..
|
|
||||||
echo "$(tput setaf 2) "
|
echo "$(tput setaf 2) "
|
||||||
echo " "
|
echo " "
|
||||||
echo "Build done, please use Slic3rPE > 1.41.0 to upload the firmware"
|
echo "Build done, please use Slic3rPE > 1.41.0 to upload the firmware"
|
||||||
echo "more information how to flash firmware https://www.prusa3d.com/drivers/ $(tput sgr 0)"
|
echo "more information how to flash firmware https://www.prusa3d.com/drivers/ $(tput sgr 0)"
|
||||||
#### End building
|
#### End building
|
||||||
|
ls
|
||||||
|
#### Run MK404 sim
|
||||||
|
if [ ! -z "$mk404_flag" ]; then
|
||||||
|
./MK404-build.sh
|
||||||
|
|
||||||
|
if [ "$mk404_flag" == "2" ]; then
|
||||||
|
PRINTER="${PRINTER}MMU2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MOTHERBOARD" == "BOARD_RAMBO_MINI_1_3" ]; then
|
||||||
|
PRINTER="${PRINTER}_mR13"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$grafics_flag" ]; then
|
||||||
|
options="--colour-extrusion --extrusion Quad_HR -g "
|
||||||
|
if [ "$grafics_flag" == "1" ]; then
|
||||||
|
options="${options}lite"
|
||||||
|
else
|
||||||
|
options="${options}fancy"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
echo "Printer: $PRINTER"
|
||||||
|
echo "Options: $options"
|
||||||
|
cd ../MK404/build
|
||||||
|
|
||||||
|
./MK404 Prusa_$PRINTER -s --terminal $options -f $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT.hex
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user