So, you got your new fancy Raspberry Pi 3 and booted the latest FreeBSD 12-CURRENT snapshot on it. After logging into system, you want to configure WiFi module and don't see any wireless network interface in ifconfig output. Googling "FreeBSD WiFi Raspberry Pi 3" tells you that there is no driver for the Broadcom chip that is responsible for WiFi/BT on the Pi 3.
But how can it be, you're asking, that there is still no driver for that chip? Is it that hard given that there are already drivers for BCM chipsets in the tree?
Actually the problem is not only writing the driver. WiFi chipset on Raspberry Pi 3 (and on many other boards in fact) is connected to the CPU using SDIO interface, not USB as you might have expected. SDIO is essentially an extension of an SD interface used to connect SD and MMC cards to the host system, adding generic I/O functions to the command set.
FreeBSD doesn't have support for the SDIO interface at the moment, at least not in the GENERIC kernel.
However my not-so-recent work of adding new MMC stack to the FreeBSD kernel lays off a way for the system to actually talk to the devices behind SDIO interface.
FreeBSD SDIO wiki page has information on how to compile the kernel with the new stack and how to try it out on the real hardware, as well as in the VM.
I have created a Telegram channel where I will post updates about the current status of SDIO support in FreeBSD, in addition to this very blog. Let's see how it works out.
/var/run/kibab/brain.pipe
Jun 7, 2018
Jan 19, 2016
Why do people work on Opensource projects?
In the recent BSDNow podcast Josh Paetzel talks about contributing to opensource projects and why people are doing this even in their free time.
Basically, that's because most corporate code bases are crappy, and people tend to write ugly code to get the work done instead of focusing on engineering perfection, whereas Opensource projects demand high code quality, you really don't want people to look at your code and run away with their eyes bleeding.
That is definitely not the only reason, because not all corporate code bases are crappy, the one at Google is actually pretty clean IMHO. But it's certainly a good point.
Basically, that's because most corporate code bases are crappy, and people tend to write ugly code to get the work done instead of focusing on engineering perfection, whereas Opensource projects demand high code quality, you really don't want people to look at your code and run away with their eyes bleeding.
That is definitely not the only reason, because not all corporate code bases are crappy, the one at Google is actually pretty clean IMHO. But it's certainly a good point.
Aug 6, 2014
Booting FreeBSD with the RAM disk as root file system from GRUB 2
Recently I needed to boot FreeBSD on our development laptop that normally boots from the network using PXEGRUB. Traditionally the kernel is loaded using PXE and then mounts a NFS root file system. In my case I didn't have any ready NFS shares, and I didn't really want to setup any -- after all, I needed the running FreeBSD system to do a couple of quick tests.
In Linux world, there is a thing called initrd -- a small (or, well, sometimes not so small) disk image that is loaded into memory and that is used by the kernel to setup a minimal environment. Loading initrd is implemented in GRUB using the "initrd" command.
*BSD kernels may be booted using the GRUB as well. Additionally, there are a couple of extra commands for dealing with *BSD modules and ramdisks, for example kopenbsd_ramdisk command. As the name suggests, it loads an OpenBSD ramdisk into the memory so the kernel is able to mount it after boot.
There is no such command for the FreeBSD kernel, which made me a bit sad.
But after looking through the source code of GRUB and FreeBSD kernel, I have found a way to do it without any modifications of either kernel or GRUB.
There is an undocumented parameter for the kfreebsd_module command, which allows to specify the type of an object being loaded as a module. Its name is, unsurprisingly, "type" :-) GRUB adjusts the type attribute of the loaded object so that kernel is able to initialize the memory disk. Thanks to the flexible FreeBSD module loading system, no special GRUB code is needed to load the FreeBSD disk image.
So the configuration entry for loading the FreeBSD kernel with the ramdisk from some location is:
menuentry "FreeBSD" {
kfreebsd $rootloc/fbsd-kernel
kfreebsd_module $rootloc/fbsd-rd.img type=mfs_root
}
Of course the GRUB should be able to load "bsd" GRUB module (or have it statically compiled in), otherwise kfreebsd* commands won't be available.
fbsd-rd.img is a normal disk image with an UFS file system on it.
If $rootloc is somewhere in the network (for example, we load the binaries using GRUB HTTP loader), you can compress the image using gzip, since GRUB automatically detects compressed data and uncompresses it before loading into the memory. I use a compressed FreeBSD 10/amd64 memstick image that can be downloaded from the FreeBSD website.
In Linux world, there is a thing called initrd -- a small (or, well, sometimes not so small) disk image that is loaded into memory and that is used by the kernel to setup a minimal environment. Loading initrd is implemented in GRUB using the "initrd" command.
*BSD kernels may be booted using the GRUB as well. Additionally, there are a couple of extra commands for dealing with *BSD modules and ramdisks, for example kopenbsd_ramdisk command. As the name suggests, it loads an OpenBSD ramdisk into the memory so the kernel is able to mount it after boot.
There is no such command for the FreeBSD kernel, which made me a bit sad.
But after looking through the source code of GRUB and FreeBSD kernel, I have found a way to do it without any modifications of either kernel or GRUB.
There is an undocumented parameter for the kfreebsd_module command, which allows to specify the type of an object being loaded as a module. Its name is, unsurprisingly, "type" :-) GRUB adjusts the type attribute of the loaded object so that kernel is able to initialize the memory disk. Thanks to the flexible FreeBSD module loading system, no special GRUB code is needed to load the FreeBSD disk image.
So the configuration entry for loading the FreeBSD kernel with the ramdisk from some location is:
menuentry "FreeBSD" {
kfreebsd $rootloc/fbsd-kernel
kfreebsd_module $rootloc/fbsd-rd.img type=mfs_root
}
Of course the GRUB should be able to load "bsd" GRUB module (or have it statically compiled in), otherwise kfreebsd* commands won't be available.
fbsd-rd.img is a normal disk image with an UFS file system on it.
If $rootloc is somewhere in the network (for example, we load the binaries using GRUB HTTP loader), you can compress the image using gzip, since GRUB automatically detects compressed data and uncompresses it before loading into the memory. I use a compressed FreeBSD 10/amd64 memstick image that can be downloaded from the FreeBSD website.
Feb 25, 2012
Мастерство упаковки
Переезд -- хороший способ отделить то, что нужно по жизни, от того, что не нужно. Когда всё, с чем жил до этого много лет, нужно упаковать в 2 сумки по 20кг, это заставляет хорошо задуматься над смыслом этих вещей.
А пока в прихожей растёт гора пакетов, которым предстоит сегодня отправиться на помойку.
А пока в прихожей растёт гора пакетов, которым предстоит сегодня отправиться на помойку.
Apr 24, 2011
Simple sharding in YCSB's JDBC driver
Recently I've started using YCSB benchmarking framework while writing my PhD thesis. I like it because it has clear and simple architecture, and allows benchmarking not only SQL-based database systems, which is critical for me.
However, it would be wonderful to have an opportunity to compare non-SQL based database systems with traditional SQL-based ones. Recently it was made possible thanks to the great work of Sudipto Das, who has contributed JDBC driver to YCSB. So now any database that has SQL interface can be benchmarked with YCSB.
The only thing that was missing was sharding. If we want to see behavior of database systems while dealing with really HUGE amounts of data, it's desirable to run the database system on multiple servers. But while such systems as Cassandra have built-in clustering capabilities, other ones (such as MySQL) don't. So application developers are forced to implement "sharding" for those databases by writing some application logic to spread data across multiple database servers.
I have added simple sharding capability to JDBC driver for YCSB, to make it possible to benchmark real sharded setups. The pull request can be found here. I was able to run the benchmark against 3 MySQL servers, each holding 1/3 of dataset. Since YCSB uses very simple queries by primary key against only one table, it's easy to define sharding function S(key), S = hash(key) % number_of_shards. This works well when number of shards is constant. By now I'm not sure if it reasonable to test elastic speedup of hand-made sharding MySQL setup, because it offers no automatic cluster rebalancing anyway.
However, it would be wonderful to have an opportunity to compare non-SQL based database systems with traditional SQL-based ones. Recently it was made possible thanks to the great work of Sudipto Das, who has contributed JDBC driver to YCSB. So now any database that has SQL interface can be benchmarked with YCSB.
The only thing that was missing was sharding. If we want to see behavior of database systems while dealing with really HUGE amounts of data, it's desirable to run the database system on multiple servers. But while such systems as Cassandra have built-in clustering capabilities, other ones (such as MySQL) don't. So application developers are forced to implement "sharding" for those databases by writing some application logic to spread data across multiple database servers.
I have added simple sharding capability to JDBC driver for YCSB, to make it possible to benchmark real sharded setups. The pull request can be found here. I was able to run the benchmark against 3 MySQL servers, each holding 1/3 of dataset. Since YCSB uses very simple queries by primary key against only one table, it's easy to define sharding function S(key), S = hash(key) % number_of_shards. This works well when number of shards is constant. By now I'm not sure if it reasonable to test elastic speedup of hand-made sharding MySQL setup, because it offers no automatic cluster rebalancing anyway.
Subscribe to:
Posts (Atom)