Posts

Getting the MIPI DBI screen for the Sipeed M1S dock to work on Linux

Image
Background What started out as an activity to clear out unused stuff from my cupboard led on to a small project to get Linux working with the MIPI DBI screen for the Sipeed M1S dock. I first got hold of the Sipeed M1S dock back in December 2022. What tempted me was the rich set of features it supports, all in a really small package -- NPU, WiFi/BT/Zigbee, 3 RISCV cores courtesy of the BL808 SoC from Bouffalo Labs. It was also touted as being able to run Linux owing to one of its RISCV cores having an MMU. Beyond playing around with the SDK and a few examples, I didn't venture further due to poor documentation. Quickly, it went back to a box I've conveniently dedicated for dev boards which were marketed to support all kinds of features but disappointingly lack good documentation and were thus chucked aside until I had more time to mess around. That time finally came, in a period when work has gotten mundane and I needed some mental stimulation. In the process of declutter

Basics of Integration using Monte Carlo

Recently, someone asked me about Monte Carlo. So, I thought I should write this post to provide a basic introduction of performing integration using Monte Carlo. "Why integration?", you asked. Well, this is because integration is one of the main operations done in computing the posterior probability distributions used in machine learning and probabilistic filtering (e.g. Bayes filter). For example, consider the typical posterior probability expression in the Bayes filtering context, \(p(x_{t} \mid y_{1:t})\), i.e. the probability of hidden state \(x_{t}\) given the observed sequence of measurements up to the current time point \(y_{1:t}\), $$p(x_{t} \mid y_{1:t}) = \frac{p(y_{t} \mid x_{t}) p(x_{t} \mid y_{1:t-1})}{p(y_{t} \mid y_{1:t-1})}$$ The \(p(x_{t} \mid y_{1:t-1})\) is of particular interest. It can be seen as the prediction of \(x_{t}\) from previous observations \(y_{1:t-1}\) and can be expressed as $$p(x_{t} \mid y_{1:t-1}) = \int p(x_{t} \mid x_{t-1}) p(x_{t-1}

Having fun with port mirroring, ntopng and traffic shaping

Image
Out of interest, I recently managed to set up a monitoring system for my home network. I have been meaning to do this for quite some time already, but never gotten the chance, due to many other commitments. So, here is just a personal note on how I have done so, while having some fun with port mirroring (using iptables/netfilter ), ntopng and traffic shaping (using tc ). First of all, my router (TP-Link TL-WR841N/ND v9) has been set up with OpenWrt, where scripts were written to monitor the relative bandwidth used by each housemate; rules for iptables were written to perform accounting of the cumulative number of bytes sent and received by each host in the network. Basing off wrtbwmon by Peter Bailey , the scripts were further modified to include rules for ip6tables , so that IPv6 traffic could be taken into account. I have also augmented the display of the network statistics using Google Charts API. The result is shown in Figure 1 . Figure 1. A breakdown of the bandwidt

vmblock patch for linux 3.11-rc1 (vmware 9)

Linux 3.11-rc1 was released a few days ago. With it comes a kernel-level API change related to VFS . Specifically, struct file_operations no longer contains the function pointer readdir and vfs_readdir() which was defined in fs/readdir.c is now gone. They are both superseded by iterate and iterate_dir() respectively. Unfortunately, these changes broke the compilation of the vmblock fs module. So, here is a simple patch I've written for anyone who is interested. Note that you also have to apply the vmblock patch for linux 3.10 if you haven't already. Otherwise, the compilation would fail. Download: vmblock.3.11.patch diff --git a/linux/file.c b/linux/file.c index d7ac1f6..5499169 100644 --- a/linux/file.c +++ b/linux/file.c @@ -38,46 +38,6 @@ typedef u64 inode_num_t; typedef ino_t inode_num_t; #endif -/* Specifically for our filldir_t callback */ -typedef struct FilldirInfo { - filldir_t filldir; - void *dirent; -} FilldirInfo; - - -/* - *----------------------

PPA for radeon vdpau gallium drivers (Ubuntu 13.04)

Image
Update (Recommended): If you want, you can use Oibaf's ppa as mesa 9.2+ comes with numerous performance gains for the open-source radeon drivers. Just remember to install libg3dvl-mesa for hardware accelerated video playback instead of libvdpau1-gallium-drivers . Seeing that no one has created deb packages addressing the latest patches with regards to support of VDPAU on the open-source radeon drivers, I have built mesa-9.1.3-6 with these patches and uploaded them to my PPA . This should make is easy for anyone interested in enabling hardware-accelerated video playback without the usual compiling and installing from source which would otherwise mess with files referenced by the default mesa packages on Ubuntu. The following instructions assume you have at least Linux 3.10 installed. Otherwise, download and install them from here . First off, you would need the latest radeon microcode . Copy all the downloaded bins to /lib/firmware/radeon/ . sudo mv /lib/firmware/{radeon,rade

vmblock patch for linux 3.10 (vmware 9)

After upgrading to linux 3.10, vmware workstation will have trouble compiling the vmnet and vmblock kernel modules against the latest kernel headers. This is attributed to the removal of create_proc_entry() in favor of proc_create() . CC [M] /tmp/modconfig-lEXylP/vmnet-only/driver.o CC [M] /tmp/modconfig-lEXylP/vmnet-only/hub.o CC [M] /tmp/modconfig-lEXylP/vmnet-only/userif.o CC [M] /tmp/modconfig-lEXylP/vmnet-only/netif.o /tmp/modconfig-lEXylP/vmnet-only/userif.c: In function ‘VNetUserIf_Create’: /tmp/modconfig-lEXylP/vmnet-only/userif.c:1049:34: error: dereferencing pointer to incomplete type /tmp/modconfig-lEXylP/vmnet-only/userif.c:1050:34: error: dereferencing pointer to incomplete type /tmp/modconfig-lEXylP/vmnet-only/hub.c: In function ‘VNetHubAlloc’: /tmp/modconfig-lEXylP/vmnet-only/hub.c:366:28: error: dereferencing pointer to incomplete type /tmp/modconfig-lEXylP/vmnet-only/hub.c:367:28: error: dereferencing pointer to incomplete type make[2]: *** [/tmp/modconfi

A blog? Not really.

A blog? Not really. This "blog" is created for the sole purpose of documenting hacks/mods/fixes that I've applied to my Linux installation. Nothing beats the frustration of trying to recall specific hacks/mods/fixes that were done in the past. However, even though this is very much meant for my own purposes, I hope it helps someone who stumbled upon this page.