This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:3dprinting:flashforge_creator_3_pro_fan_fix:dropbear [2024/10/23 12:36] – admin | projects:3dprinting:flashforge_creator_3_pro_fan_fix:dropbear [2025/04/11 15:47] (current) – [Create a USB stick] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Flashforge | + | ====== Flashforge |
- | This page will describe how to install dropbear on the printer. | + | |
+ | | [[projects: | ||
- | Buildroot options: | + | This page will show a method how to install and get ssh access using dropbear. |
- | * BR2_SHARED_STATIC_LIBS=y | + | |
- | Also see [[https:// | + | ==== Prerequisites ==== |
+ | The steps below require the following dependencies. Install them first: | ||
+ | |||
+ | sudo apt-get install git build-essential libncurses-dev | ||
+ | |||
+ | |||
+ | ==== buildroot + dropbear ==== | ||
+ | The dropbear binary can be easily built using [[https:// | ||
+ | |||
+ | git clone https:// | ||
+ | cd buildroot-at91 | ||
+ | |||
+ | Since we do not have the same build environment as flashforge had, we will create a static build of dropbear. This requires to modify the dropbear package file in buildroot: | ||
+ | |||
+ | sed -i " | ||
+ | |||
+ | Then we need to configure buildroot for the right processor architecture and target software. Either download the configuration to build dropbear or configure manually, as shown further below: | ||
+ | |||
+ | mv .config .config_ORIG | ||
+ | wget -O .config https:// | ||
+ | |||
+ | === Configure buildroot manually === | ||
+ | |||
+ | make menuconfig | ||
+ | |||
+ | Then set the following options accordingly: | ||
+ | |||
+ | < | ||
+ | Target options: | ||
+ | Target Architecture (Arm (little endian)) | ||
+ | Target Architecture Variant (cortex-A7) | ||
+ | Target ABI (EABI) | ||
+ | Floating point strategy (VFPv4) | ||
+ | ARM instruction set (ARM) | ||
+ | Target Binary Format (ELF) | ||
+ | |||
+ | Toolchain: | ||
+ | C library (glibc) | ||
+ | Kernel Headers (Linux 6.1.x kernel headers) | ||
+ | *** Glibc Options *** -> Enable compatibility shims to run on older kernels (enable this option) | ||
+ | |||
+ | Build options: | ||
+ | strip target binaries (Enable this option) | ||
+ | libraries (both static and shared) | ||
+ | for dropbear, together with patching | ||
+ | packages/ | ||
+ | Target packages: | ||
+ | Networking applications ---> | ||
+ | * dropbear | ||
+ | * client programs | ||
+ | * optimize for size (enable this option) | ||
+ | </ | ||
+ | |||
+ | Go back to the main screen (click twice on exit) and click on Save | ||
+ | |||
+ | |||
+ | ==== Start building cross compiler and dropbear ==== | ||
+ | |||
+ | make | ||
+ | |||
+ | This step may take about 20 minutes (core i7-1370P x 20). When done, verify if dropbear is correctly built: | ||
+ | |||
+ | file output/ | ||
+ | |||
+ | We should see the following: | ||
+ | |||
+ | dropbear: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/ | ||
+ | |||
+ | |||
+ | ===== Create a USB stick ===== | ||
+ | To get SSH on the printer, we need to put some files on a USB stick, mimicking as if the printer would do a firmware update. Insert an empty FAT formatted USB stick in your PC and copy dropbear to the main directory: | ||
+ | |||
+ | cp output/ | ||
+ | |||
+ | Replace USBSTOR with the name of the USB stick. | ||
+ | |||
+ | Write following script to the main directory of the USB stick with the name flashforge_init.sh | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | set -x | ||
+ | |||
+ | WORK_DIR=`dirname $0` | ||
+ | |||
+ | MACHINE=Creator3Pro | ||
+ | PID=0014 | ||
+ | |||
+ | #Test the machine' | ||
+ | CHECK_ARCH=`uname -m` | ||
+ | if [ " | ||
+ | echo " | ||
+ | echo ${CHECK_ARCH} | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | |||
+ | cat $WORK_DIR/ | ||
+ | |||
+ | # | ||
+ | # 1. copy dropbear to / | ||
+ | cp $WORK_DIR/ | ||
+ | chmod 755 / | ||
+ | |||
+ | # 2. create a symlink dropbearkey and dropbearconvert to dropbear in /usr/sbin | ||
+ | ln -s / | ||
+ | ln -s / | ||
+ | |||
+ | # 3. create a symlink scp to dropbear in /usr/bin | ||
+ | ln -s / | ||
+ | |||
+ | # 4. create rsa key in / | ||
+ | mkdir -p / | ||
+ | dropbearkey -t rsa -f / | ||
+ | |||
+ | # 5. Add dropbear as an init.d script | ||
+ | cat << ' | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # S50dropbear | ||
+ | # | ||
+ | # please note: if not added in rcS like: | ||
+ | # ifconfig eth0 hw ether 88: | ||
+ | # the MAC address may change everytime when the board restarts. | ||
+ | |||
+ | # Make sure dropbearkey exists | ||
+ | [ -f / | ||
+ | |||
+ | # Make sure dropbear exists | ||
+ | [ -f / | ||
+ | |||
+ | SSH_HOST_KEY=/ | ||
+ | |||
+ | umask 077 | ||
+ | |||
+ | start() { | ||
+ | # check for public key, ssh-rsa type and for fingerprint | ||
+ | if / | ||
+ | / | ||
+ | / | ||
+ | printf " | ||
+ | / | ||
+ | touch / | ||
+ | echo " | ||
+ | else | ||
+ | # Create any missing keys | ||
+ | printf " | ||
+ | mkdir -p / | ||
+ | / | ||
+ | start | ||
+ | fi | ||
+ | } | ||
+ | stop() { | ||
+ | printf " | ||
+ | killall dropbear | ||
+ | rm -f / | ||
+ | echo " | ||
+ | } | ||
+ | restart() { | ||
+ | stop | ||
+ | start | ||
+ | } | ||
+ | |||
+ | case " | ||
+ | start) | ||
+ | start | ||
+ | ;; | ||
+ | stop) | ||
+ | stop | ||
+ | ;; | ||
+ | restart|reload) | ||
+ | restart | ||
+ | ;; | ||
+ | *) | ||
+ | echo " | ||
+ | exit 1 | ||
+ | esac | ||
+ | |||
+ | exit $? | ||
+ | EOF | ||
+ | |||
+ | # 6. set file permissions | ||
+ | chmod 755 / | ||
+ | |||
+ | sync | ||
+ | cat $WORK_DIR/ | ||
+ | |||
+ | $WORK_DIR/ | ||
+ | |||
+ | exit 0 | ||
+ | EOF | ||
+ | |||
+ | # 6. set file permissions for S50dropbear | ||
+ | chmod 755 / | ||
+ | |||
+ | sync | ||
+ | cat $WORK_DIR/ | ||
+ | |||
+ | $WORK_DIR/ | ||
+ | |||
+ | exit 0 | ||
+ | </ | ||
+ | |||
+ | |||
+ | After copying dropbear and flashforge_init.sh to a USB stick, download the following files from [[https:// | ||
+ | * 0014 | ||
+ | * end.img | ||
+ | * play | ||
+ | * start.img | ||
+ | * version.cfg | ||
+ | |||
+ | Alternatively you may download all the files together | ||
+ | |||
+ | ===== Install dropbear | ||
+ | - Power off the printer | ||
+ | - Insert the stick in the printer and power it on again. | ||
+ | - After a few seconds dropbear should be installed. | ||
+ | - Switch off the printer once again, remove the USB stick | ||
+ | - Power on again. Dropbear should now be ready for use. | ||
+ | |||
+ | Test the ssh connection to the printer with following user: root\\ | ||
+ | The password for user root you should have already modified as described in the [[projects: |