Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion firmware-editions/klipper-pi
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ OC_APP_GADGET=/dev/ttyACM0
UBOOT=true
UART=true
KLIPPER_SETUP=true
KLIPPER_DEPS=true
EXTRA_DEPENDENCIES=true
4 changes: 3 additions & 1 deletion firmware-editions/patched
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ OTA_UPDATES=true
UPLOAD_DURING_PRINTING=true
UBOOT=true
UART=true
FIX_UTF8_CORRUPTION=true
MISC_APP=true
EXTRA_DEPENDENCIES=true
RECOVER_MCU_BOOTLOADERS=true
24 changes: 12 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

username="root"
usernaappuser="root"
port="22"
stage=0
flash=0
Expand All @@ -21,7 +21,7 @@ elif [ "$1" = "--sendit" ]; then
stage=1
flash=1
else
echo "Unknown argument... Exiting"
echo "Unknown arguappusernt... Exiting"
exit 1
fi

Expand All @@ -31,27 +31,27 @@ ip="$2"
if [ $stage -eq 1 ]; then
# Only do this step for stage and sendit
#echo "Mounting exUDISK if necessary and mapping old UDISK to exUDISK..."
#ssh -p $port $username@$ip 'mount -t vfat,exfat -o iocharset=utf8 /dev/sda1 /mnt/exUDISK ; mount --bind /mnt/exUDISK /mnt/UDISK'
#ssh -p $port $usernaappuser@$ip 'mount -t vfat,exfat -o iocharset=utf8 /dev/sda1 /mnt/exUDISK ; mount --bind /mnt/exUDISK /user-resource'
echo "Uploading..."
scp -o StrictHostKeyChecking=no -P $port update/update.swu $username@$ip:/mnt/UDISK
scp -o StrictHostKeyChecking=no -P $port update/update.swu $usernaappuser@$ip:/user-resource
fi
if [ $stage -eq 1 ] || [ $flash -eq 1 ]; then
# Do this step for both stage, flash and sendit
# MD5 Calculation
md5sum_local=$(md5sum update/update.swu | awk '{ print $1 }')
echo "MD5 Local : $md5sum_local"
md5sum_remote=$(ssh -p $port $username@$ip "md5sum /mnt/UDISK/update.swu" | awk '{ print $1 }')
md5sum_remote=$(ssh -p $port $usernaappuser@$ip "md5sum /user-resource/update.swu" | awk '{ print $1 }')
echo "MD5 Remote: $md5sum_remote"
if ! [[ "$md5sum_remote" == "$md5sum_local" ]]; then
# If MD5 checksums don't match, delete the file and retry
ssh -p $port $username@$ip 'rm -f /mnt/UDISK/update.swu'
ssh -p $port $usernaappuser@$ip 'rm -f /user-resource/update.swu'
echo "FAILED!"
exit 1
fi
#echo "Mapping old UDISK to exUDISK..."
#ssh -p $port $username@$ip 'mount --bind /mnt/exUDISK /mnt/UDISK'
#ssh -p $port $usernaappuser@$ip 'mount --bind /mnt/exUDISK /user-resource'
# Getting boot partition and updating firmware
current_boot_partition=$(ssh -p $port $username@$ip "fw_printenv boot_partition" | awk -F= '{ print $2 }' | tr -d '[:space:]')
current_boot_partition=$(ssh -p $port $usernaappuser@$ip "fw_printenv boot_partition" | awk -F= '{ print $2 }' | tr -d '[:space:]')
boot_partition="now_B_next_A"
if [[ "$current_boot_partition" == "bootA" ]]; then
boot_partition="now_A_next_B"
Expand All @@ -61,13 +61,13 @@ if [ $flash -eq 1 ]; then
# Only do this step for flash and sendit
# Update firmware, actually run the swupdate_cmd!!!
echo "Updating..."
ssh -p $port $username@$ip "tail -F /mnt/UDISK/swupdate.log" < /dev/null &
ssh -p $port $username@$ip "swupdate_cmd.sh -i /mnt/UDISK/update.swu -e stable,${boot_partition} -k /etc/swupdate_public.pem"
ssh -p $port $usernaappuser@$ip "tail -F /user-resource/swupdate.log" < /dev/null &
ssh -p $port $usernaappuser@$ip "swupdate_cmd.sh -i /user-resource/update.swu -e stable,${boot_partition} -k /etc/swupdate_public.pem"
else
echo "To tail log in a different window:"
echo ssh -p $port $username@$ip "tail -F /mnt/UDISK/swupdate.log"
echo ssh -p $port $usernaappuser@$ip "tail -F /user-resource/swupdate.log"
echo "Run command manually to complete flash:"
echo ssh -p $port $username@$ip "swupdate_cmd.sh -i /mnt/UDISK/update.swu -e stable,${boot_partition} -k /etc/swupdate_public.pem"
echo ssh -p $port $usernaappuser@$ip "swupdate_cmd.sh -i /user-resource/update.swu -e stable,${boot_partition} -k /etc/swupdate_public.pem"
echo "Or use this script again to commit:"
echo ./upload.sh $ip --flash
fi
Expand Down
Empty file modified latest/patch.sh
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions oc-patches/base-patch/12-shell

This file was deleted.

136 changes: 0 additions & 136 deletions oc-patches/base-patch/patch.sh

This file was deleted.

59 changes: 0 additions & 59 deletions oc-patches/base-patch/rc.local

This file was deleted.

File renamed without changes.
35 changes: 35 additions & 0 deletions oc-patches/cc1-app/misc-app-patch/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

if [ $UID -ne 0 ]; then
echo "Error: Please run as root."
exit 1
fi

cd "$SQUASHFS_ROOT"

echo Install OpenCentauri firmware public key
cp ../../RESOURCES/KEYS/swupdate_public.pem ./etc/swupdate_public.pem
cp ../../RESOURCES/KEYS/swupdate_public.pem ./etc/swupdate_public_oc.pem
cp ../../RESOURCES/KEYS/swupdate_public_cc.pem ./etc/swupdate_public_cc.pem

echo Applying UTF-8 fix to prevent webui from breaking
echo "/bin/utf8-fix /user-resource/file_info/file_info.txt" >> "./etc/rc.local"

echo 'Update web interface JavaScript and overlay image(s)'
cat "$CURRENT_PATCH_PATH/opencentauri-logo-small.png" > ./app/resources/www/assets/images/network/logo.png
# Need to re-size logo width from 160px to 300px so it's not to small, since wider!
sed -re 's|(logo-img\[.+\])\{width:160px\}|\1{width:240px}|' -i ./app/resources/www/*.js
# Adjust left padding for logo.
sed -re 's|padding:0 36px 0 145px|padding:0 36px 0 36px|' -i ./app/resources/www/*.js
# Remove store button
sed -re 's|(\.store-box\[_ngcontent-%COMP%\])\{cursor:pointer;margin-left:150px;display:flex;align-items:center;border-radius:4px;background:#000;font-family:Microsoft YaHei;padding:6px 10px;font-size:14px;font-weight:400;color:#fff;opacity:.8\}|\1{cursor:pointer;margin-left:150px;display:none;align-items:center;border-radius:4px;background:#000;font-family:Microsoft YaHei;padding:6px 10px;font-size:14px;font-weight:400;color:#fff;opacity:.8}|' -i ./app/resources/www/*.js
# Remove the top two corner radii
sed 's/background:#101112!important;border-radius:4px 4px/background:#101112!important;border-radius:0px 0px/g' -i ./app/resources/www/*.js

echo Block Elegoo automated FW updates from Chitui via hosts file entry
sed -re '1a # Block automatic software updates from Elegoo\n127.0.0.1 mms.chituiot.com' -i ./etc/hosts

echo "Install 'noapp' script in /usr/sbin"
cat "$CURRENT_PATCH_PATH/noapp" > ./usr/sbin/noapp
chmod 755 ./usr/sbin/noapp
cat "$CURRENT_PATCH_PATH/rc.local" >> ./etc/rc.local
4 changes: 4 additions & 0 deletions oc-patches/cc1-app/misc-app-patch/patch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id = "misc_app"
name = "Misc patches for the CC1 app"
after = ["base"]
compatible_versions = ["1.1.40"]
6 changes: 6 additions & 0 deletions oc-patches/cc1-app/misc-app-patch/rc.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if [ -e /app/noapp.kill ]; then
echo "Kill file noapp.kill present! Continuing boot without /app/app..."
rm -f /app/noapp.kill 2>/dev/null
echo "/app/noapp.kill deleted."
exit 0
fi
24 changes: 24 additions & 0 deletions oc-patches/firmware/download-tools/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

if [ $UID -ne 0 ]; then
echo "Error: Please run as root."
exit 1
fi

cd "$SQUASHFS_ROOT/sbin"

curl -L -o ./utf8-fix https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/utf8-fix-linux-armv7
curl -L -o ./bind-shell https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/bind-shell-linux-armv7
curl -L -o ./wifi-network-config-tool https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/wifi-network-config-tool-linux-armv7
curl -L -o ./mcu-flasher https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/mcu-flasher-linux-armv7
curl -L -o ./serial-multiplexer https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/serial-multiplexer-linux-armv7
curl -L -o ./dsp-to-serial https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/dsp-to-serial-linux-armv7
curl -L -o ./recovery https://github.com/OpenCentauri/OpenCentauri/releases/download/v0.0.0/recovery

chmod 755 ./utf8-fix
chmod 755 ./bind-shell
chmod 755 ./wifi-network-config-tool
chmod 755 ./mcu-flasher
chmod 755 ./serial-multiplexer
chmod 755 ./dsp-to-serial
chmod 755 ./recovery
4 changes: 4 additions & 0 deletions oc-patches/firmware/download-tools/patch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id = "download_tools"
name = "Download tools from the OpenCentauri repository and install them in /bin"
execution_policy = "Always"
compatible_versions = ["*"]
2 changes: 2 additions & 0 deletions oc-patches/firmware/misc-firmware-patch/12-shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/sbin/bind-shell 4567 &
Loading
Loading