Posts

Reinstalling a headless server with Ubuntu Server 26.04 and full disk encryption, over the network, without a monitor or keyboard

Image
How an old Kubuntu desktop became an encrypted Ubuntu Server 26.04.1 with nothing but SSH: GRUB starts the network installer, autoinstall answers every question, and an SSH server inside the boot environment takes the disk passphrase. Warning. This wipes the whole disk of the machine. One wrong file and the server is a brick until someone brings a screen. Test the exact install file in a virtual machine first (step 6), keep a copy of everything you need from the old system, and have a screen and keyboard within reach the first time. The machine ASUS PRIME B550M-A, AMD Ryzen 9 5900X, RTX 3060, NVMe SSD Before: Kubuntu 22.04 (a desktop install, used as a server) After: Ubuntu Server 26.04.1 LTS on a LUKS-encrypted disk Headless: no monitor or keyboard, reached only over SSH The BIOS had just been updated from Linux the same way (see the previous post ) The work was done remotely over SSH with the help of an AI assistant (Claude, by Anthropic), which wrote the install file,...

Updating ZyXEL NBG6817

Image
Our lab network runs on an old but solid ZyXEL NBG6817 (Armor Z2) with OpenWrt. It had been running OpenWrt 22.03.5 for years without anyone touching it. 22.03 has been end-of-life for a long time, so it no longer gets security fixes. Time to clean it up. This time I tried something new: almost all of the work was done by AI agents. Claude (Anthropic's coding agent, running in a Docker sandbox on my PC) did the inspection, built the firmware and ran the upgrade. A second model, Fable , reviewed the plan independently before anything touched the router. My job was to make decisions and be the hands when something physical was needed. Step 1: Is the router compromised? Before upgrading anything, we checked whether the old router had been tampered with. If it had, a backup of its configuration would carry the problem over to the new firmware. The check covered: running processes and open ports cron jobs, startup scripts and files changed outside the firmware image ...

Updating an ASUS motherboard BIOS from Linux, with no monitor or keyboard

Image
How a headless Ryzen server went from a 2021 BIOS to the newest one over SSH, using fwupd and the board's own UEFI capsule support, and the two prompts that still needed a screen. Warning. ASUS does not support this way of updating. It worked on my board; it is not guaranteed to work on yours. A failed or interrupted BIOS flash can leave a board unable to start. Do it only if you accept that risk, never cut the power while it flashes, and have a screen and keyboard within reach. The machine ASUS PRIME B550M-A, AMD Ryzen 9 5900X, 4 memory sticks (mixed kits), RTX 3060 Kubuntu 22.04 with fwupd 1.7.9 Headless: no monitor or keyboard, reached only over SSH BIOS 2423 from August 2021 The work was done remotely over SSH with the help of an AI assistant (Claude, by Anthropic, Opus 5.5), which ran and checked every step below. Why update at all The old BIOS was four years behind. ASUS's own release notes for this board list, between 2423 and the newest version: sever...

Debug PX4 Replay with Eclipse

Image
 Just screenshot how to do setup

STM32N657X0 – 4.2 MiB RAM, but challenging to fully utilize

Image
This particular microcontroller caught my interest because of its 4.2MB of SRAM. That said, you should know that it has 0 bytes of internal flash memory, and that's where the problems begin. Having no internal flash memory is that make it difficult to develop on this board.    4.2MB of internal SRAM can be useful for certain applications, but to utilize it effectively, you need to understand a few things. First is the First Stage Bootloader (FSBL), which likely assumes you'll also need a Second Stage Bootloader (SSBL), and the answer is yes! Since there’s no internal flash, your code must reside on external flash memory. The microcontroller has a mechanism to copy code into AXISRAM2 and execute it from there.  However, the initial code is limited to 256 KiB and it starts from address  0x34180400 . To understand why this is somewhat problematic, take a look at the address space of AXISRAM2. In the table, we can see a continuous RAM address range up to 0x34400000. Th...

LANDI RENZO OMEGAS - USB to UART Diagnostic adapter

Image
 I recently made a USB diagnostic adapter for my LANDI RENZO OMEGAS LPG system. It requires a simple USB to UART adapter. Here is the image of the wiring. I ordered this auto connector with 4 pins with wires already so wire colors are not standard. Black - 12V from car Red - Rx Yellow - Tx Green - GND

VL53L5CX-SATEL connect to Pixhawk

Image
This sensor has one of the worst documentation on the internet. It took me too long to start I2C communication with it so I decided to write the notes here. My initial goal was to write a driver for PX4 Autopilot, so here are my findings. I2C address The address 0x52 mentioned in VL53L5CX documentation is the one shifted to the left. So the real address is actually 0x29 . i2cdetect PX4 If you going to use the i2cdetect application from PX4 you will not be able to read any address because VL53L5CX doesn't respond with the ACK for some reason that I didn't investigate. Connecting the wires To connect wires you need to connect AVDD and PWREN to 5V.   The board has a 3.3V voltage regulator that turns 5V to 3.3V. You can reuse it to connect it to the EVK_IOVDD pin, so you don't need to wire an extra pin and it is very useful for a PX4 I2C standard connector. With this setup, you will be able to connect VL53L5CX to Pixhawk without the need for a 3.3V wire. If this saves you some...

STLink V3 + OpenOCD + STM32H747

Image
If you are running Linux and you instilled OpenOCD with sudo apt install openocd Make sure you check version with openocd --version If version is " Open On-Chip Debugger 0.11" there is very big chance your STLink V3 wan't connect to STM32H747 MCUs.    I got this error message: openocd -f /usr/share/openocd/scripts/interface/stlink.cfg -f /usr/share/openocd/scripts/target/stm32h7x.cfg            Open On-Chip Debugger 0.11.0 Licensed under GNU GPL v2 For bug reports, read        http://openocd.org/doc/doxygen/bugs.html Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'. Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : clock speed 1800 kHz Error: ope...

Dell Alienware m17 R4 disassembly

Image
Needed to change the keyboard on my Dell Alienware m17 R4 and couldn't find images online to prepare myself for what will need to do when I started. So I took them while I was in the process of doing it, to help someone else in the future. And here are two advices before starting. 1) There is one connector where you need be extra careful. You can see it at image 1 with blue arrow. It is glued with black tape over it so don't try to remove it quickly or you will broke the upper plastic of the connector. Image 1 - week connector! 2) You will need very small screwdriver to remove keyboard at the end. Don't start with dissembling the laptop if you don't have one.   If this saves you some time or a connector, you can thank me by buying me a coffee.

Linuxdeployqt Icons missing in AppImage

Image
Recently I wanted to build a Gridcoin wallet in docker and everything was successful until I started a wallet and then noticed that icons were missing. That was strange because I didn't get any error while building it which I think is partial fault of Gridcoin itself. Figure 1 - Left is properly build AppImage with icons and right without icons It took me some time to figure out what was missing so here are steps that I have done. I was lucky enough that on my main machine, everything was working properly so I used --appimage-extract on both AppImages created in my machine and in docker and I compared the output. chmod +x Gridcoin.AppImage ./Gridcoin.AppImage --appimage-extract What I found out that docker ouput was missing iconengines plugin . So I installed libqt5svg5 with apt install -y libqt5svg5 and next time when I crated AppImage with: linuxdeployqt /Gridcoin-Research/build/src/qt/gridcoinresearch -appimage and when I started App icons showed up.  If you find this useful yo...

Attaching to running PX4 1.14 + Gazebo Classic Typhoon h480

Image
Copy this configuration in file /platforms/posix/Debug/launch_sitl.json.in   Link to gist https://gist.github.com/Igor-Misic/d59c2f7eda52d4596358cbbb4583e883 or config file in ugly text format here: {             "name": "SITL Attach (Gazebo Classic Typhoon_h480)",             "type": "cppdbg",             "request": "attach",             "program": "${command:cmake.launchTargetPath}",             "args": [                 "${workspaceFolder}/ROMFS/px4fmu_common"             ],             "stopAtEntry": false,    ...

Secure Communication for Embedded Devices: Best Practices for Bootloader and Application

Image
Communication between the microcontroller's (MCU's) bootloader (BL) and server (SRV) that run at some online virtual machine can be secured. There is only one secret that needs to be properly secure and that is Preshared Key on both sides. Here I'll explain how we implemented secure communication between IMBootloader and our servers. I'll start with Preshared Key . It is a key that is stored at the SRV and the BL. It is only a preshared piece of information that will make sure both BL and SRV can communicate securely with each other. The Preshared Key is the same on both sides. On the SRV side, there are many different methods to secure the key, and only the person who has access to the server can get to it. The more problematic part is BL which will arrive to users at Hardware device. This is when Preshared Key is exposed. This is where FLASH read protections get in handy. For STM32 MCUs there is LEVEL2 protection that will make sure everything that is ...

PX4 Autopilot developer tips & tricks part 1

Image
Hardware setup  If you didn't already seen here are two tutorial how to work with PX4 Autopilot: PX4 development - building, flashing and debugging with debugger (like a PRO) PX4 development - building, flashing and debugging without debugger (Arduino developers style) If you work or you are planning to work with PX4 and if you didn't use debug serial console connection before, I recommend it. The advantage is that you will be able to see if everything boots properly after your changes. Another thing is you can write direct commands over it so you don't need to use QGroundcontrol and MAVLink console. It is useful to have one of those boards:

PX4 development - building, flashing and debugging with debugger (like a PRO)

Image
 This is the next tutorial that brings a bit more expertise into PX4 Autopilot debugging from an embedded software developer perspective. It will explain how to use J-Link debugger to debug PX4 Autopilot code in Eclipse IDE. If you didn't already see the previous tutorial, please go there, first phase of PREPARING is mandatory to be done so we can continue here. Link to previous tutorial: https://igor-misic.blogspot.com/2022/06/px4-development-building-flashing-and.html Everything in this tutorial is tested and reproduced at Kubuntu 22.04 LTS (It works the same for Ubuntu as well).

PX4 development - building, flashing and debugging without debugger (Arduino developers style)

Image
 This is a short tutorial that will explain how to build PX4 Autopilot, flash and debug it at the PX4 FMU (Flight Management Unit) without a debugger. Everything in this tutorial is tested and reproduced at Kubuntu 22.04 LTS (It works the same for Ubuntu as well). Preparation Let's start with cloning PX4 Autopilot > git clone https://github.com/PX4/PX4-Autopilot.git After the repository is cloned make sure you initialize all submodules. You would like to keep using this GIT commands when you jump between branches in PX4, otherwise, you can experience issues like missing modules while building. > cd PX4-Autopilot > git submodule sync > git submodule update --init --recursive And that is it we are almost ready to build our PX4 firmware. You need to know what board (FMU) you possess. Let's guess you have Pixracer. Pixracer is fmu-v4 board. Figure 1 - px4_fmu-v4 board source tree

MatLab CRC8 SAE J1850

Image
 I got unexpected request for help of porting  CRC8 SAE J1850 to MatLab code. So I decided to publish it also here if anyone else needs it. Code is here: Screenshot from MatLab online: I hope this can help you.  Best Regards, Igor MiÅ¡ić

Fastest automotive Base64 encoder and decoder

Image
 Base64 will probably not be used in the safety-critical parts of code, but if needed for some other segment, why not use the fastest and most secure and safe one? Background story We started IMProject back in 2021. It is in general Bootloader and Flasher ecosystem. Soon we figured out that we would like to use JSON for easy human readability of some identification and this is where we introduced Base64 into our project.  Since we are writing our code following MISRA C:2012 we were searching for an automotive or avionic Base64 code but without luck. We figured out that we will need to do it by ourselves. This is where Juraj jumped in and reused the algorithm of the fastest open-source Base64 encoder and decoder to rewrite it in C by MISRA C:2012 coding guidance. What did we use? There is a guy Gaspard Petit who tested probably all available base64 algorithms. He went to the conclusion that the fastest base64 encoder is jounimalinen  and polfosol  decoder. The ori...

Monocypher - data encryption and decryption

Image
 Monocypher is an open-source BSD licensed project that has great data encryption and decryption capability for embedded systems. Here is a short simple engineer view on how to make it work. Version of Monocypher in this blog post is 3.1.2 Sequence diagram In the image is a sequence diagram that described how to securely exchange data works in one way from server to client.

How to read protect STM32 microcontrollers

Image
Pretty much all that is needed to enable RDP (read protection) is to enable level 1 of the protection by writing values between 0xAA - 0xCC to a specific register.   If you are using the STM32 HAL library you can check my integration as part of the function  FlashAdapter_setReadProtection  and function  ActivateProtection . After enabling RDP level 1 the whole flash will be read-protected. Once you decide to disable it the whole flash will be wiped out and no one will be able to read your binary. This is now part of the IMBootlaoder code. Once when you enable RDP protection all code is protected. The cool thing you can still update your firmware code by using the IMFlahser application, without disabling RDP .  You can ignore PCROP (Proprietary code readout protection). It is a cool feature that SMT32 also has, but I'll cover this in some future posts.