Posts

Assembler Basics: Registers

When learning Assembler and Machine Language, processor registers are super important. Whenever you want to calculate something in Assembler, you first have to load the values into a register before you can perform the arithmetic calculation. Let's start with a hello world program in C: hello.c: #include <stdio.h> int main() { printf("hello world"); }  Compile and link it with: gcc hello.c Have a look at the <main> function with the command: objdump -d -Mintel a.out Note that objdump -Mintel puts the source operand right and the target operand left while objdump -MIntel does it the other way round. Here is the <main> function:  1149: f3 0f 1e fa endbr64 114d: 55 push rbp 114e: 48 89 e5 mov rbp,rsp 1161: 48 8d 05 9c 0e 00 00 lea rax,[rip+0xe9c] # 2004 <_IO_stdin_used+0x4> 1168: 48 89 c7 mov rdi,rax 116b: b8 00 00 00 00 mov eax,0x0 1170:

programming Linux Kernel modules

Image
Linux kernel modules run in a priviledged space. But what does this mean? Let's find out. First let's program a "hello world" Linux kernel module: create a folder kernel mkdir kernel create a file hello.c: #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> MODULE_DESCRIPTION("Insert description"); MODULE_AUTHOR("Insert author"); MODULE_LICENSE("GPL"); static int __init hello_init(void) { printk(KERN_INFO "Hello world\n"); return 0; } module_init(hello_init); create a file Makefile: obj-m += hello.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean run make: make insert the module: sudo insmod hello.ko verify the syslog: sudo dmesg and I see in it the following line that confirms me it works: [49694.489768] Hello world See also https://tldp.org/LDP/lkmpg/2.6/html/hello2.html https://stackoverflow

NET::ERR_CERT_AUTHORITY_INVALID and you are webmaster?

 I am webmaster for https://linuxintro.org . However, when I visited this page in Chrome I always got the message NET::ERR_CERT_AUTHORITY_INVALID Today I resolved it after some years. I went to  https://letsencrypt.org/getting-started/ followed the instructions and got it working in 11 minutes. And it did not cost anything :) I am super happy this site exists and makes it so easy for me. I immediately donated to them because they are just so useful :)

Host key verification failed

Image
Today I got the error "host key verification failed" when trying to connect from my Linux desktop to my Google Cloud VM "linuxintro.org": # ssh thorsten@linuxintro.org The authenticity of host 'linuxintro.org (34.122.183.250)' can't be established. ED25519 key fingerprint is SHA256:7F9VxKJOEhY/ulnvywkGuQRZUB6S5xd2hG2oWbCSd2E. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])?  Host key verification failed. The reason was that I had never logged in before, so the system did not know the key of my target VM. Solution was to call: # ssh -o "StrictHostKeyChecking no" thorsten@linuxintro.org A question that remains open with me is why I did not have to do it earlier. Earlier, the host keys were automatically added to the known_hosts file. Now I get the next error: # ssh thorsten@linuxintro.org thorsten@linuxintro.org: Permission denied (publickey). To resolve this error, I need a private/pub

A camera for less than 10 EUR

Image
Today I got my ESP32-CAM to work. My goal is to have cheap camera surveillance all over the house, even in cellar to read my gas counter :) The camera costs less than 10 EUR, I got it from  https://de.aliexpress.com/item/32983165020.html?spm=a2g0o.order_list.order_list_main.5.26655c5fja4s5J&gatewayAdapt=glo2deu Here is the beautiful thing: I connected it to the 5V and GND GPIO PINS of my Raspberry Pi. Then I looked on my desktop's internet settings and found a new WLAN: I connected to the camera's WLAN. It showed a question mark as there was no connection to the internet (just to the webcam): Then, on my desktop, I looked what IP address I had in the camera's WLAN: thorsten@tweedleburg:~$ ifconfig enp2s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500         ether 8c:ec:4b:26:a9:31  txqueuelen 1000  (Ethernet)         RX packets 0  bytes 0 (0.0 B)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 0  bytes 0 (0.0 B)         TX errors 0  dropped

monitoring my gas counter with a webcam

Image
During my certification I have learned about DocumentAI and I am eager to put it into practical use. So, here is my project: I will install a webcam to watch my gas counter and take a picture every day. Will use DocumentAI to find out its read and store it in a table. Here is the prototype: Webcam monitoring my gas counter OK, first we have the physical setup. I use an old Ubuntu laptop (will be a Raspberry Pi soon) with a very new and good webcam:  On Ubuntu, I issue the command to grab the picture from the webcam: $ fswebcam -r 4000x3000 -d /dev/video0 test2.jpg --- Opening /dev/video0... Trying source module v4l2... /dev/video0 opened. No input was specified, using the first. Adjusting resolution from 4000x3000 to 2304x1296. --- Capturing frame... Captured frame in 0.00 seconds. --- Processing captured image... Writing JPEG image to 'test2.jpg'. When I upload it to DocumentAI, it does recognize the counter's number, in this case 9153.486 m³ Now, this deserves to be autom

Windows is too slow - let's try Linux

Image
Today I decided to try Linux again as my desktop operating system. Here is an assessment how it worked out - especially for people who have other things to do in their lives than operating systems. Windows Windows was slow and had a lot of hiccups where it would suddenly stall for some seconds. Reboot button did not exist any longer, instead a message that power options are not available. It suggested updating to Windows 11, but said my beloved VMware Player would then cease to work. So, time for a change... to Linux. Considerations What I don't want is constant switching between operating systems. Live has better things to experience. Also, what I don't want is a USB installation that forgets the WLAN password and all my settings on reboot. Functionality The functionality I need is: Video Editing - I do it via wevideo.com, this is available where Chrome is, so, as well on Linux and Windows FreeCiv - my favorite game is available both on Windows and Linux (and the reason I do n