Setting hostname/IP the legacy way

Hello,

how to set/flash the TeddyCloud hostname/IP manual from console?
The wiki only shows how to change the certificates:

I want to avoid the web interface, as I also have to first Read ESP32 (although I already have the firmware) before the patch/write options are available:
image
image

Thanks for your support
Sven

I think it should give you the Options if you just type “teddycloud” in the docker cli.

Thanks for the hint!
I tried

teddycloud ESP32HOST patched_newhost.bin teddycloud.example.com

However, I get the following result:

INFO |esp32.c:0990:esp32_patch_host()| Patching hostnames in 'patched_newhost.bin'
INFO |esp32.c:1038:esp32_patch_host()|  replaced RTNL host 0 times
INFO |esp32.c:1040:esp32_patch_host()|  replaced API host 0 times

=================================================================
==93==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8388608 byte(s) in 1 object(s) allocated from:
    #0 0x5654f8a87037 in __interceptor_malloc (/usr/local/bin/teddycloud+0x602037)
    #1 0x5654f8aeee17 in esp32_patch_host src/esp32.c:1003

SUMMARY: AddressSanitizer: 8388608 byte(s) leaked in 1 allocation(s).

And the firmware is untouched.

I’m using TeddyCloud v0.3.5 (8602da9) - 2024-01-22 13:39:05 +0000 linux-x86_64

Be sure it is a valid firmware. If the hostnames are not found you either patched it already or the image is not valid.

If you have a valid patch, be sure you fix the image afterwards.

I tried to patch an already patched version. Is this wrong?
But I also tried the original firmware with the same error.

If the hostnames are patches they cannot be patched again, as the original hostnames cannot be detected anymore.
What do you mean by error?
This is just a memory leak after the patching process

I thought the memory leak were a severe issue.
But you are right, patching the original firmware changes the file.
Is the order first certs than hostname or vice versa important?

No, the order doesn’t matter

I patched the original firmware with the CAs and afterwards I changed the hostname. The output looked promising as the output stated that the hostname was changed in two places.
However, the box is in constant reboot after flashing (log output was also OK) that software:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403bb116
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x118
load:0x403b6000,len:0xb90
load:0x403ba000,len:0x27f4
entry 0x403b61c4
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403bb116
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x118
load:0x403b6000,len:0xb90
load:0x403ba000,len:0x27f4
entry 0x403b61c4

Next try is to flash the old firmware to check if I bricked the device.
But any suggestions were to dig deeper are appreciated.

I tried now the following:

  • Flash old patched firmware: OK
  • Patch original firmware with Certificates and flash: OK
  • Patch previous firmware with hostname or IP: NOK

teddycloud ESP32HOST Test2_FakeCA_IP.bin 10.10.10.15
Patching looks successfull:

INFO |esp32.c:0990:esp32_patch_host()| Patching hostnames in 'Test2_FakeCA_IP.bin'
INFO |esp32.c:1038:esp32_patch_host()|  replaced RTNL host 2 times
INFO |esp32.c:1040:esp32_patch_host()|  replaced API host 2 times

Please fix the image with ESP32FIX after manipulating the hostname

@Kuchen0815 Thanks for the hint again.
I don’t know why I didn’t recognized it in first place…

Know everything is working like a charm!

I created a pull request to update the documentation: