Percentage of the Linux Kernel libre

8 replies [Last post]
twipley
Offline
Joined: 09/23/2012

About what percentage does the blob entrenched into Linux occupy?

Under Ubuntu (without any third-party application installed), can I maintain that I am running, for example, through a 99%-libre system?

(I have searched a little bit, but could not find the information, for example on http://www.fsfla.org/svnwiki/selibre/linux-libre/.)

Magic Banana

I am a member!

Offline
Joined: 07/24/2010

A way to approximately compute that would be to use the 'sloccount' command (in Trisquel repositories) to count the number of "source lines of code" in both the source code of the vanilla Linux kernel and in that of Linux-libre. Indeed, and as far as I understood, the blobs are dressed up as source code (text files full of numbers, which hopefully span across many lines, otherwise this method does not work). Alternatively, you can compare the size (in bytes) of the binaries. On my 64 bit Trisquel 5.5 system:
$ sudo wc -c /boot/vmlinuz-3.0.0-24-generic
4670416 /boot/vmlinuz-3.0.0-24-generic

I guess the difference is very small. Anyway, you do not need many directives to implement something nasty (a backdoor, a spyware, etc.). You want the freedom to fix bugs in those blobs too (what is close to impossible because they are blobs). That is why, if you value your own freedom, you would refuse any proprietary piece of software.

Michał Masłowski

I am a member!

I am a translator!

Offline
Joined: 05/15/2010

> Alternatively, you can compare the size (in bytes) of the
> binaries. On my 64 bit Trisquel 5.5 system:
> $ sudo wc -c /boot/vmlinuz-3.0.0-24-generic
> 4670416 /boot/vmlinuz-3.0.0-24-generic

It's more common to have them in /lib/modules/*/firmware or something
similar.

Another way: compare tarball sizes. For 3.5.4 bzip2 compressed tarballs
it's 80980207 and 78569526 bytes, so about three percent difference.
Binaries and sources have different compressibility and maybe
Linux-libre adds some text, so it's not a good comparison.

> I guess the difference is very small. Anyway, you do not need many
> directives to implement something nasty (a backdoor, a spyware,
> etc.). You want the freedom to fix bugs in those blobs too (what is
> close to impossible because they are blobs). That is why, if you value
> your own freedom, you would refuse any proprietary piece of software.

Some examples of their size: Radeon firmware uses about 15 KiB to
emulate old 2d requests (only in R6xx, R7xx doesn't have it, drivers
don't use it for R6xx); "Intel 2400 Wireless WiMAX Connection over USB"
has a ~1.5 MiB firmware file. It might be possible to fit spyware in
such files and there certainly are smaller programs difficult to debug
with source.

lembas
Offline
Joined: 05/13/2010

It would be interesting to see when these binary blobs were introduced to Linux and how their size (and proportion?) has grown.

Magic Banana

I am a member!

Offline
Joined: 07/24/2010

For the size question, and using Michał Masłowski's proposal (i.e., the size of the BZ2 tarballs), here is the result when only the major versions are considered (e.g., 3.5 but not 3.5.4):
# Version Linux Linux-libre absolute-removal relative-removal
2.6.27 49175.6 48049.2 1126.42 2.29061%
2.6.28 51431 50073.8 1357.19 2.63886%
2.6.29 55253.3 53721.8 1531.46 2.77171%
2.6.30 58042.9 56456.6 1586.23 2.73285%
2.6.31 60053.5 58247.4 1806.17 3.00759%
2.6.32 62914.2 61160.5 1753.7 2.78744%
2.6.33 64713.4 62759.9 1953.47 3.01865%
2.6.34 66048.5 64181.5 1866.95 2.82664%
2.6.35 67681.4 65894.9 1786.42 2.63945%
2.6.36 68630 66781 1848.98 2.69414%
2.6.37 71853.3 69104.9 2748.47 3.82511%
2.6.38 72987.4 70398.1 2589.32 3.54763%
2.6.39 74313 71986.3 2326.73 3.13098%
3.0 74954.2 72487.6 2466.65 3.29088%
3.1 75381.1 73003.1 2377.97 3.1546%
3.2 76316.2 73724.8 2591.42 3.39564%
3.3 77112.9 74726.3 2386.61 3.09495%
3.4 78294.4 75664.8 2629.66 3.35868%
3.5 79080.5 76673.2 2407.31 3.04413%

The sizes are in kB.

Here is the script I wrote (you need to install 'curl'):
#!/bin/sh

TMP=`mktemp -t linux-libre-removal.sh.XXXXXX`
trap "rm $TMP* 2>/dev/null" 0
for nb in `seq 27 39`
do
echo -n "2.6.$nb " >> $TMP
curl -sI https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.$nb.tar.bz2 | fgrep Length | cut -d ' ' -f 2 >> $TMP
curl -sI http://linux-libre.fsfla.org/pub/linux-libre/releases/2.6.$nb-gnu/linux-libre-2.6.$nb-gnu.tar.bz2 | fgrep Length | cut -d ' ' -f 2 >> $TMP.libre
done
for nb in `seq 0 5`
do
echo -n "3.$nb " >> $TMP
curl -sI https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.$nb.tar.bz2 | fgrep Length | cut -d ' ' -f 2 >> $TMP
curl -sI http://linux-libre.fsfla.org/pub/linux-libre/releases/3.$nb-gnu/linux-libre-3.$nb-gnu.tar.bz2 | fgrep Length | cut -d ' ' -f 2 >> $TMP.libre
done
echo "# Version Linux Linux-libre absolute-removal relative-removal"
paste -d ' ' $TMP $TMP.libre | awk '{ $2 /= 1024; $3 /= 1024; removal = $2 - $3; print $1, $2, $3, removal, removal * 100 / $2 "%" }'

Please guys, stop asking questions that make me want to write scripts... I cannot resist! :-)

aloniv

I am a translator!

Offline
Joined: 01/11/2011
lembas
Offline
Joined: 05/13/2010

Wow, thanks guys! You fulfilled all my wishes! :)

Chris

I am a member!

Offline
Joined: 04/23/2011

I can't give you a percentage although there are a significant number of printers (probably somewhere between 50 and 90%), video cards (maybe 80%), PCI/PCIe sound cards (maybe 5-10%), USB wifi adapters (99.999% right now), gigabit ethernet (built-in – maybe 15%), portable audio players (Apple iDevices mainly- maybe 30-50%), and mini pcie bluetooth cards (100%) dependent on non-free drivers/firmware. These are guesstimates.

twipley
Offline
Joined: 09/23/2012

"I guess the difference is very small. Anyway, you do not need many directives to implement something nasty (a backdoor, a spyware, etc.). You want the freedom to fix bugs in those blobs too (what is close to impossible because they are blobs). That is why, if you value your own freedom, you would refuse any proprietary piece of software." (Magic Banana)

Indeed.

Personal (ethical) script-kiddie experience shows that /even/ a 50 KiB file may be large enough to hold /both/ a functional firmware and a functional, sometimes-quite-wide, back-door opener.

1) create a piece of hardware and perform some relevant advertizing;
2) bundle malware into driver and send the whole over to Linux devs;
3) [...]