Adding updates to repo from last fork on github

This commit is contained in:
Paul Swenson 2025-07-05 18:11:15 -04:00
parent 8398936ead
commit 288e7bd5cd
19 changed files with 375 additions and 32 deletions

4
.gitattributes vendored Normal file
View file

@ -0,0 +1,4 @@
* text=auto eol=lf
*.sh text eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

3
.gitignore vendored
View file

@ -6,7 +6,6 @@ unpacked/*
installed_options.log
auto_install.cfg
printer*.cfg
!options.cfg
/*.cfg
options.cfg
/emmc_dump
auto_install.sh

View file

@ -1,19 +1,15 @@
# ATTENTION: Outdated Version!
### This is an old fork of the original GitHub repository which isn't maintained / up to date!
## The original repository is no longer existent at GitHub, but the author offers the latest version of his original repository here: https://codeberg.org/hedgehogform/Anycubic-Kobra-2-Series-Tools
---
## Anycubic Kobra 2 Series Tools
This repository contains tools for the Anycubic Kobra 2 Series 3D printers.
> [!WARNING]
> This repository is unmaintained. I'm not using the printer anymore and I don't have the time to maintain it. I'm archiving this repository and will delete it in 1 year. So if you want to use it, you need to fork it and maintain it yourself. Same goes for the firmware repository.
### Documentation
Documentation can be found in the `docs` directory.
- [VERSIONS.md](docs/VERSIONS.md) - Known firmware versions.
- [LINKS.md](docs/LINKS.md) - Useful things/addons for the printer.
- [OPTIONS.md](docs/OPTIONS.md) - Options for the firmware.
- [GCODE_COMMANDS.md](docs/GCODE_COMMANDS.md) - GCODE commands.
@ -27,27 +23,31 @@ Documentation can be found in the `docs` directory.
- [OLD_INFO.md](docs/OLD_INFO.md) - Old information.
- [CREDITS.md](docs/CREDITS.md) - Credits.
This [flashforge](https://github.com/FlashforgeOfficial/AD5M_Series_Klipper) is similar to the Anycubic Kobra 2 Series. So we need to investigate it.
## Usage
### NOTE!!!
> [!IMPORTANT]
> Please backup all files in `/user` so you don't lose access to anycubic cloud and OTA updates. You can use the [EMMC_BACKUP.md](./EMMC_BACKUP.md) guide to backup the whole system. But backing up `/user` is enough to keep access to anycubic cloud and OTA updates.
>
> You could use `dd` command to backup also.
Please backup all files in `/user` so you don't lose access to anycubic cloud and OTA updates. You can use the [EMMC_BACKUP.md](./EMMC_BACKUP.md) guide to backup the whole system. But backing up `/user` is enough to keep access to anycubic cloud and OTA updates.
> [!CAUTION] > **IF YOU DO NOT BACKUP OR DELETE THE FILES IN `/user` YOU WILL LOSE ACCESS TO ANYCUBIC CLOUD AND OTA UPDATES. YOU HAVE BEEN WARNED.**
>
> Everything you do is on **your** own risk. I am **not** responsible for any damage you do to your printer.
You could use `dd` command to backup also.
#### Everything you do is on you. I'm not responsible for any damage you do to your printer.
> [!IMPORTANT]
> For python scripts to work you need to have installed `python3` and `pip3` and then install the required packages with `pip3 install -r requirements.txt`.
#### 1. Clone the repository.
#### 2. Make sure you have uart cable connected and have downgraded to version `2.3.9` so you can continue with the next steps.
If not you may not get any uart output at all. To downgrade just put the `2.3.9` version on usb like you always do.
> [!NOTE]
> If not you may not get any uart output at all. To downgrade just put the `2.3.9` version on usb like you always do.
#### 3. Place the `.bin .zip .swu` firmware files in the `FW` directory.
If you don't have firmware files, you can use the script `fwdl.sh <model> <version>` to download in the folder `FW` the version for the printer model you need. The supported models are `K2Pro`, `K2Plus` and `K2Max`. The version is given in the format `X.Y.Z` like `3.0.9`.
> [!TIP]
> If you don't have firmware files, you can use the script `fwdl.sh <model> <version>` to download in the folder `FW` the version for the printer model you need. The supported models are `K2Pro`, `K2Plus` and `K2Max`. The version is given in the format `X.Y.Z` like `3.0.9`.
#### 4. Run `unpack.sh <update_file>` to unpack the selected firmware update file.
@ -55,11 +55,11 @@ The supported file extensions are `bin`, `zip` and `swu`. The result is in the f
#### 5. Modify the options file `options.cfg`.
To select the options you need and run `patch.sh` to patch the firmware files in the `unpacked` folder.
To select the options you need and run `patch.sh` to patch the firmware files in the `unpacked` folder.
The result is still in the folder `unpacked`. You may manually modify the current state of the files if needed. You can also prepare different configuration files for different needs based on the default file `options.cfg`. The custom configuration file is provided as parameter: `patch.sh <custom_configuration_file>`. If no parameter is provided, the file `options.cfg` will be used.
#### 6. Run `pack.sh` to pack the firmware files from the folder `unpacked`.
#### 6. Run `pack.sh` to pack the firmware files from the folder `unpacked`.
The result is the file `update/update.swu`.
@ -73,22 +73,31 @@ Then apply the newly generated custom software `update/update.swu` by USB update
To do all this a little easier you can just use `build.sh` and it will run all the steps for you.
### Notes
> [!WARNING]
> This repository is a work in progress and may contain bugs or may not work as expected any pull requests are welcome.
This repository is a work in progress and may contain bugs or may not work as expected any pull requests are welcome.
> [!NOTE]
> Default password for the root access (custom firmware with UART and SSH) is `toor` but it can be changed in the `options.cfg` file.
Default password for the root access (UART and SSH) is `toor` but it can be changed in the `options.cfg` file.
> [!IMPORTANT]
> Start the scripts directly by `./script_name.sh <parameters>` to be started by the requested `bash` shell. Shells like `sh` are not compatible at this time.
Start the scripts directly by `./script_name.sh <parameters>` to be started by the requested `bash` shell. Shells like `sh` are not compatible at this time.
> [!IMPORTANT]
> Use only FAT32 formatted USB disk and place the file `update.swu` inside a folder `update` created at the root of the USB disk. You don't have to have a 4 GB usb. It can be 64 or 128 GB or more. You only need to format 1 partition to max 4 GB. Then FAT32 will be available.
Use only FAT32 formatted USB disk and place the file `update.swu` inside a folder `update` created at the root of the USB disk. You don't have to have a 4 GB usb. It can be 64 or 128 GB or more. You only need to format 1 partition to max 4 GB. Then FAT32 will be available.
> [!TIP]
> In order for the auto update upload to work properly, you need to setup in advance the configuration file `auto_install.cfg`. It requires one line of text with the following information:
> `host_ip`,`user_name`,`printer_ip`,`ssh_port`
> Example:
> `192.168.1.234,root,192.168.1.242,22`
>
> Only applies if you have already rooted and installed ssh on the printer.
In order for the auto update upload to work properly, you need to setup in advance the configuration file `auto_install.cfg`. It requires one line of text with the following information:
`host_ip`,`user_name`,`printer_ip`,`ssh_port`
Example:
`192.168.1.234,root,192.168.1.242,22`
### Advanced usage
Only applies if you have already rooted and installed ssh on the printer.
Partition map of the printer:
![Partition map](./docs/images/partition.jpg)
### Information

View file

@ -12,7 +12,7 @@ This will make the printer boot into FEL mode.
Or you can short the pads on the main board. The pads are located near the EMMC chip. You need to short the pads like in the picture below and then power on the printer and it will boot into FEL mode due to the shorted pads.
![photo_2024-02-05_02-46-45](https://github.com/ultimateshadsform/Anycubic-Kobra-2-Series-Tools/assets/151234273/be75b895-d655-440e-92d7-b9804da16f05)
![enter_fel_mode](./images/enter_fel_mode.jpg)
To be able to properly use the xfel tool, you need to install the driver which can be found in the [zadig](https://github.com/xboot/xfel/releases/) tool.

View file

@ -1,5 +1,8 @@
# Hidden Gcode commands
> [!WARNING]
> Changing the wrong setting might make your printer unbootable and will need to be recovered from a backup.
To run these custom gcode commands you need to pass
```gcode

View file

@ -7,3 +7,5 @@ This is old information and is no longer relevant. Please refer to the [README.m
https://gitlab.com/weidongshan/tina-d1-h
https://d1.docs.aw-ol.com/study/study_3getsdktoc/#sdk_3
This [flashforge](https://github.com/FlashforgeOfficial/AD5M_Series_Klipper) is similar to the Anycubic Kobra 2 Series. So we need to investigate it.

32
docs/VERSIONS.md Normal file
View file

@ -0,0 +1,32 @@
# Firmware Links
This is a list of known firmware versions for the K2 Max, K2 Pro, and K2 Plus.
## K2 Max
- 3.1.4 https://cdn.cloud-universe.anycubic.com/attachment/1872443076557496322_j3vwnimq.bin
- 3.1.2 https://cdn.cloud-universe.anycubic.com/ota/K2Max/ChituUpgrade_k2+Max_V3.1.2.bin
- 3.1.0 https://cdn.cloud-universe.anycubic.com/ota/prod/20023/AC104_k2MAX_V3.1.0.bin
- 3.0.9 https://cdn.cloud-universe.anycubic.com/ota/K2Max/AC104_K2Max_1.1.0_3.0.9_update.bin
- 3.0.5 https://cdn.cloud-universe.anycubic.com/ota/K2Max/AC104_K2Max_1.1.0_3.0.5_update.bin
- 3.0.3 https://cdn.cloud-universe.anycubic.com/ota/K2Max/AC104_K2Max_1.1.0_3.0.3_update.zip
- 2.3.9 https://cdn.cloud-universe.anycubic.com/ota/K2Max/AC104_K2Max_1.1.0_2.3.9_update.zip
## K2 Pro
- 3.1.2 https://cdn.cloud-universe.anycubic.com/ota/K2Pro/ChituUpgrade_k2+Pro_V3.1.2.bin
- 3.1.0 https://cdn.cloud-universe.anycubic.com/ota/prod/20021/AC104_k2PRO_V3.1.0.bin
- 3.0.9 https://cdn.cloud-universe.anycubic.com/ota/K2Pro/AC104_K2Pro_1.1.0_3.0.9_update.bin
- 3.0.5 https://cdn.cloud-universe.anycubic.com/ota/K2Pro/AC104_K2Pro_1.1.0_3.0.5_update.bin
- 3.0.3 https://cdn.cloud-universe.anycubic.com/ota/K2Pro/AC104_K2Pro_1.1.0_3.0.3_update.zip
- 2.3.9 https://cdn.cloud-universe.anycubic.com/ota/K2Pro/AC104_K2Pro_1.1.0_2.3.9_update.zip
## K2 Plus
- 3.1.2 https://cdn.cloud-universe.anycubic.com/ota/K2Plus/ChituUpgrade_k2+Plus_V3.1.2.bin
- 3.1.0 https://cdn.cloud-universe.anycubic.com/ota/prod/20022/AC104_k2PLUS_V3.1.0.bin
- 3.0.9 https://cdn.cloud-universe.anycubic.com/ota/K2Plus/AC104_K2Plus_1.1.0_3.0.9_update.bin
- 3.0.5 https://cdn.cloud-universe.anycubic.com/ota/K2Plus/AC104_K2Plus_1.1.0_3.0.5_update.bin
- 3.0.3 https://cdn.cloud-universe.anycubic.com/ota/K2Plus/AC104_K2Plus_1.1.0_3.0.3_update.zip
- 2.3.9 https://cdn.cloud-universe.anycubic.com/ota/K2Plus/AC104_K2Plus_1.1.0_2.3.9_update.zip

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
docs/images/partition.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

0
extra-stuff/emmc/restore.txt Executable file → Normal file
View file

Binary file not shown.

View file

@ -0,0 +1,78 @@
echo ----------------------------------------------
echo --- EMMC SYSTEM BACKUP ON A USB DISK ---
echo ----------------------------------------------
echo
sleep 5
echo
echo ----------------------------------------------
echo REMOVE ALL USB DEVICES AND ISERT 2GB+ USB DISK
echo ----------------------------------------------
echo 10...
sleep 2
echo 9...
sleep 2
echo 8...
sleep 2
echo 7...
sleep 2
echo 6...
sleep 2
echo 5...
sleep 2
echo 4...
sleep 2
echo 3...
sleep 2
echo 2...
sleep 2
echo 1...
sleep 2
echo 0...
sleep 2
echo --------------------------------- INITIALIZING -------------------------------
sunxi_card0_probe
mmc dev 0
usb reset
usb dev 0
echo --------------------------------- EMMC >>> USB -------------------------------
mmc read 40000000 00000000 10000
usb write 40000000 00000000 10000
mmc read 40000000 00010000 10000
usb write 40000000 00010000 10000
mmc read 40000000 00020000 10000
usb write 40000000 00020000 10000
mmc read 40000000 00030000 10000
usb write 40000000 00030000 10000
mmc read 40000000 00040000 10000
usb write 40000000 00040000 10000
echo ------------------------------------ 25% -------------------------------------
mmc read 40000000 00050000 10000
usb write 40000000 00050000 10000
mmc read 40000000 00060000 10000
usb write 40000000 00060000 10000
mmc read 40000000 00070000 10000
usb write 40000000 00070000 10000
mmc read 40000000 00080000 10000
usb write 40000000 00080000 10000
mmc read 40000000 00090000 10000
usb write 40000000 00090000 10000
echo ------------------------------------ 50% -------------------------------------
mmc read 40000000 000a0000 10000
usb write 40000000 000a0000 10000
mmc read 40000000 000b0000 10000
usb write 40000000 000b0000 10000
mmc read 40000000 000c0000 10000
usb write 40000000 000c0000 10000
mmc read 40000000 000d0000 10000
usb write 40000000 000d0000 10000
echo ------------------------------------ 75% -------------------------------------
mmc read 40000000 000e0000 10000
usb write 40000000 000e0000 10000
mmc read 40000000 000f0000 10000
usb write 40000000 000f0000 10000
mmc read 40000000 00100000 10000
usb write 40000000 00100000 10000
mmc read 40000000 00110000 5420
usb write 40000000 00110000 5420
echo ------------------------------------ 100% ------------------------------------

Binary file not shown.

View file

@ -0,0 +1,84 @@
echo -----------------------------------------------
echo --- EMMC SYSTEM RESTORE FROM USB DISK ---
echo -----------------------------------------------
echo
sleep 5
echo
echo -----------------------------------------------
echo REMOVE ALL USB DEVICES AND INSERT 2GB+ USB DISK
echo WITH THE SYSTEM IMAGE YOU WANT TO RESTORE
echo
echo IT WILL COPY THE USB BLOCKS TO THE EMMC BLOCKS!
echo
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo !TURN OFF THE PRINTER NOW IF YOU ARE NOT READY!
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo -----------------------------------------------
echo 10...
sleep 2
echo 9...
sleep 2
echo 8...
sleep 2
echo 7...
sleep 2
echo 6...
sleep 2
echo 5...
sleep 2
echo 4...
sleep 2
echo 3...
sleep 2
echo 2...
sleep 2
echo 1...
sleep 2
echo 0...
sleep 2
echo --------------------------------- INITIALIZING -------------------------------
sunxi_card0_probe
mmc dev 0
usb reset
usb dev 0
echo --------------------------------- USB >>> EMMC -------------------------------
usb read 40000000 00000000 10000
mmc write 40000000 00000000 10000
usb read 40000000 00010000 10000
mmc write 40000000 00010000 10000
usb read 40000000 00020000 10000
mmc write 40000000 00020000 10000
usb read 40000000 00030000 10000
mmc write 40000000 00030000 10000
usb read 40000000 00040000 10000
mmc write 40000000 00040000 10000
echo ------------------------------------ 25% -------------------------------------
usb read 40000000 00050000 10000
mmc write 40000000 00050000 10000
usb read 40000000 00060000 10000
mmc write 40000000 00060000 10000
usb read 40000000 00070000 10000
mmc write 40000000 00070000 10000
usb read 40000000 00080000 10000
mmc write 40000000 00080000 10000
usb read 40000000 00090000 10000
mmc write 40000000 00090000 10000
echo ------------------------------------ 50% -------------------------------------
usb read 40000000 000a0000 10000
mmc write 40000000 000a0000 10000
usb read 40000000 000b0000 10000
mmc write 40000000 000b0000 10000
usb read 40000000 000c0000 10000
mmc write 40000000 000c0000 10000
usb read 40000000 000d0000 10000
mmc write 40000000 000d0000 10000
echo ------------------------------------ 75% -------------------------------------
usb read 40000000 000e0000 10000
mmc write 40000000 000e0000 10000
usb read 40000000 000f0000 10000
mmc write 40000000 000f0000 10000
usb read 40000000 00100000 10000
mmc write 40000000 00100000 10000
usb read 40000000 00110000 5420
mmc write 40000000 00110000 5420
echo ------------------------------------ 100% ------------------------------------

BIN
extra-stuff/xfel/xfel_sdmmc_t113_21-02-24.zip Executable file → Normal file

Binary file not shown.

Binary file not shown.

129
options-example.cfg Normal file
View file

@ -0,0 +1,129 @@
#------------------------------------------------------------------------------------------------
# 'options.cfg' is the default configuration file used by 'patch.sh'
# You can provide another configuration file as a parameter to 'patch.sh'
# All available patching options are listed below
# Disable patching an option by using '#' or ';' as a first character in the option line
# Use single or double quotes for the option value. Do not use spaces inside the quotes.
# Use list of values separated by a space if needed because duplicated option are not supported
# In square brackets you may place the name(s) of other option(s) required by a given option.
# This will not auto include the required option(s) but will be used to validate the option integrity.
# IMPORTANT!!! Copy and rename this file to 'options.cfg' and remove the 'example' from the filename.
#-------------------------------------------------------------------------------------------------
# For used with build.sh only!
# Select the input firmware file to be used for this configuration file
#build_input="@/FW/310/update.swu"
# For used with build.sh only!
# Compatible to versions 3.0.5+ only!
# Select the output update file copy of the encrypted result update.bin
#build_output="/data/kobra-unleashed/uploads/updates/20021/310.bin"
# Enable the custom updates by using the provided public key
# When enabled, the new custom update will allow next custom updates to be directly done by USB update
# @ will be replaced by the working folder root
# Use the provided example of public and private keys or generate your own:
# Use 'openssl genrsa -out swupdate_private.pem' to generate a private key
# Use 'openssl rsa -in swupdate_private.pem -out swupdate_public.pem -outform PEM -pubout' to export the public key
# Place both keys (swupdate_private.pem and swupdate_public.pem) in the folder RESOURCES/KEYS
# Available for all firmware versions (recommended)
custom_update="@/RESOURCES/KEYS/swupdate_public.pem"
# Enable root access by providing a custom root password hash (default password 'toor')
# Providing an empty string will allow root access without a password (not recommended)
# If disabled, you will have no root access until you find out what is the AC original root password
# Available for all firmware versions (recommended)
root_access="$1$///xTLYF$krWXTe62/dm.crd6CH4HW0"
# Enable the UART at boot for access the uboot shell and for root login
# UART access is needed for backup/restore and for root login when you don't have ssh
# Use "2.3.9" uboot from version '2.3.9' (recommended)
# From version 3.0.3 the UART is disabled
# Can be used for version 3.0.3 and above
uart="2.3.9"
# Enable opkg (+5MB to the update, +10MB to the rootfs)
# Use it only when you plan to install more packages from the printer
# Available for all firmware versions
opkg="default"
# Enable the SSH server, use 'dropbear' type ssh
# Available for all firmware versions (recommended)
ssh="dropbear"
# Set the authorized keys file for the ssh remote access with keys (instead of a password)
# Provide the file with your public key(s). You must have the private key set in your ssh client
# Available for all firmware versions (recommended)
# authorized_keys="@/RESOURCES/KEYS/authorized_keys" [ssh]
# Enable custom web server
# Use "webfs-v5" with default port 8000 or "webfs-v5:port" for a custom port
# "webfs-v5" uses static libraries with memory footprint less than 400kb (0.4% RAM), no dependencies
# Browse http://printer_ip:8000 to the home page of the custom webserver
# More web pages will be added soon
# Depends on the option "app_nocamera" only for versions 3.0.5+
# No dependency for versions below 3.0.5
# Available for versions 2.3.9 ... 3.1.0 (recommended)
webserver="webfs-v5:8000" [app_nocamera]
# Enable Python 3 (+14MB to the update, +25MB to the rootfs)
# Select the version you need. Python might be required by some other options
# Available for all firmware versions
# python="3.11"
# Change the banner to a custom one. (Recommended when using custom firmware)
# Available for all firmware versions
banner="banner"
# Redirect the MQTT communication
# This option will disable the use of the original AC cloud service
# and the mobile app will stop working
# Can be used when a custom cloud service is needed.
# Example of a custom cloud service with web interface is Kobra Unleashed
# More information: https://github.com/anjomro/kobra-unleashed
# Replace the URL below with the URL of your MQTT server
# You also need to transfer to the printer your keys in
# the /user folder by ssh as explained in the project page
# Always keep a copy of the original keys in case you want to go back to AC cloud
# Available for all firmware versions
modify_mqtt="localhost.mr-a.de"
# localhost.mr-a.de will just redirect the MQTT to the localhost 127.0.0.1 to be used with a local MQTT server
# Delete the Bluetooth support because it's not used by Kobra Unleashed
# and can't be used since we replace mqtt anyways
# Available for versions 3.0.5+
bluetooth="default"
# Patch the app to check the captive portal URLs less often (originally every 2s)
# It is used to detect if the internet connection is established and alive
# This patch will produce less unwanted web traffic if enabled
# Available settings are: 5s, 10s, 20s, 30s and 60s
# Available for versions 3.0.5+
app_net_ready="30s"
# Modify the hardcoded app DNS
# For parameter(s) provide "old_dns|new_dns"
# Available hardcoded DNS in the app:
# "8.8.8.8", "208.67.222.222", "114.114.114.114", "223.5.5.5"
# You can replace one, more or all of them
# Example: app_dns="208.67.222.222|4.4.4.4" "223.5.5.5|8.8.4.4"
app_dns="208.67.222.222|1.1.1.1"
# Patch the app to stop supporting webcams. This allows a custom camera support
# Available for versions 3.0.5+ (recommended if webcam is used)
app_nocamera="default"
# Add a script for custom initializations at startup
# like starting a custom MQTT server, webcam steaming, etc.
# Place startup scripts inside this script.
#startup_script="startup.sh"
# Enable kobra unleashed prod version test
# https://github.com/anjomro/kobra-unleashed/tree/go-server
#kobra_unleashed="kobra_unleashed-v1"
# Enable this option if you want to be executed after the packing script completes
# if you want to install the generated update by ssh
# You have to have ssh and root_access enabled, and setup the auto_install.cfg
#auto_install="@/TOOLS/custom_install.sh"
#auto_install="@/TOOLS/auto_install.py"

3
requirements.txt Normal file
View file

@ -0,0 +1,3 @@
pycryptodome==3.21.0
paramiko==3.5.0
scp==0.15.0