Last updated 2002-08-14 5:54 pm

Dear visitors,

This site presents Linux kernel-specific discussions and utilities. I'm currently focused on assembly programming, boot floppy creation, partition management, anatomy of ELF format, IPv4 networking code, and embedding system. All of the themes are general and important issues, but I've been failed to find definitive articles. There are several specification notes but they refer to only definition of data structure and function calling sequence. To make bad things worse, essential parts are missed in the document repeatedly. To overcome the situation, I read relating documents and wrote down simple utilities. During the coding process, I frequently encountered ambiguous points never mentioned in the existing documents, and tried to clear the points while wondering in the forest of Linux kernel. I'm not a professional programmer, but understand the pleasure of system programming. All of utilities provided in this site are free software and please feel free to utilize them. I hope this site will be helpful to programmers who want to communicate with the heart of Linux kernel. Thank you for your interest.


Wataru Nishida
from Osaka, Japan

2001/01/11   The first article of How To series: How to communicate with Linux kernel?
2001/01/12   Dump utilities are collected. partdump was updated and now supports extended partitions.
2001/02/06   An analysis of "OpenBSD libc" was started.
2001/02/07   I succeeded to compile and link ipconfig.C against uClibc. Finally, I'm completely free from the GNU's curse!
2001/02/08   References were updated.
2001/03/03   TinyDebian project is started and I prepared simplified libfdisk.a for original dbootstrap supporting ReiserFS.
2001/03/21   For the understanding of network control, two packet capturing programs were presented.
2001/04/04   A new page "Kernel startup" was added in "Linux network code tour" section. The story starts from the boot strap loader.
2001/04/06   Miss-labeled links to ELF PDF in "References" were corrected. I'm sorry for your inconvenience.
2001/06/08   My article "NAT and packet filtering in Linux kernel 2.4" was published in UNIX USER July, 2001 (Japanese commercial magazine). I prepared a supplemental short article on this site (Sorry, both of them are Japanese).
2001/06/14   Sorry, access had been restricted for these three days through an incorrect configuration. Can you see me?
2001/07/30   Page encoding was changed to Latin1 from Japanese Shift-JIS. Personal Japanese memorandum was started. Currently, there is a serious confliction between Linux kernel 2.4 and pcmcia-cs package. I found a simple fixation method.
2001/08/14   Small embedding system is a nice place to deepen and broaden the understanding of hardware/software interactions. As a first step, I set up a cross-developmental environment for Hitachi H8/300H CPU.
2001/09/03   GNU tools provide powerful environment for system programmers, but most of users and textbooks are missing their extended capabilities. Today, I created a fullset of PDF files from GNU gcc and binutils CVS trees, and pooled them in my references section. If you are not familiar with "linker script" and "__attribute__ specifier", please follow them in ld and gcc PDF files. I also supplemented some pointers to COFF (Common Object File Format).
2001/11/08  A serial article "GCC Programming Studio" was started in UNIX USER December, 2001. 1st title is "The mystery of code size".
2001/11/14   Japanese home page was started.
2001/12/08 GCC Programming Studio: "Independence from glibc" and a special article "Understanding the GNU GRUB" were appeared in UNIX USER January, 2002.
2002/01/08 GCC Programming Studio: "The linker script" was appeared in UNIX USER February, 2002.

References (2001' Sep. 3)

Wataru's Memorandum (Japanese)

Embedding Linux (2001' Aug. 14)
I'm currently focusing on Linux embedding technologies and working on Hitachi H8/300H and AXIS ETRAX 100LX microprocessors.Through this journey, we would reach deep understanding of Linux kernel and solve many essential questions. Where does the process come from? What is the object file format? How to control binutils and gcc all you want? How to create an executable file adapted for flash ROM? What is a linker script? How to create cross-development tools for target CPUs? And so on.

Hitachi H8/300H microprocessor family
How to create cross-developmental tools? (binutils, gcc 3.x, newlib, and gdb for H8/300H)

Linux 2.4 network code tour

Inside of the Linux 2.4 networking code
kernel startup
socket creation
ioctl control
NETLINK sockets

Linux 2.4 and PCMCIA (2001' July 30)

PCMCIA usage on Linux kernel 2.4
PCMCIA IDE-disk problem is solved

Linux sniffers, simple packet capturing programs using two independet kernel interfaces

csniff and psniff
This tarball file contains two simple packet capturing programs, csniff and psniff. The former is coded using obsolete socket call with PF_INET family and SOCK_PACKET type and ioctl(). The latter is coded by new PACKET protocol family and setsockopt(). You should turn on CONFIG_PACKET capability in the kernel. Both programs control promiscuous mode on the specified interface in different ways (I hope psniff will be helpful for programmers who want to utilize the packet protocol). They include only a primitive packet hexdump routine, but are very short (about 180 lines) and easy to understand the skeleton of sniffer. I believe that packet capturing is the first place to understand the Internet. Have fun!
Compressed source listing of sniffers

TinyDebian, a modified Debian rescue/root diskset for ReiserFS 3.6 on Linux kernel 2.4

simplified libfdisk.a
• Debian installation is tightly regulated by dbootstrap program, but it does not currently support Linux kernel 2.4 and reiserfs. You can develop an original rescue/root diskset by using boot-floppies package from Debian, but it depends on so many developmental packages and quite hard to understand the contents. Then I read over the source tree, and grasped their essential skeleton in the huge codes. One of the difficulties for reading is the presence of complicated partition-related functions. In boot-floppies, the functions are supplied as a libfdisk library. Here is a simplified libfdisk.a for x86 architecture and MS-DOS partitions. I'll outline the data definitions and functions according to this new source tree one of fine days.
Screen shot of testing
Compressed source listing of libfdisk.a

BSD libc "Port a secure C library from the OpenBSD"

dump mania, a collection of dump utilities

dump v1.0
• Old-fashioned dump utility. It dumps file contents with hexadecimal number and ASCII code.
Screen shot of dump
Compressed source listing of dump

elfdump v0.10
• Executable and Linking Format (ELF) takes essential parts in Linux and recent UNIX.
• ELF structure is slightly complicated and difficult to understand. According to the specification notes (Ref #ELF1), I coded a small ELF dump utility, elfdump. You should follow another reference, "ELF:From the Programmer's Perspective" (ref #ELF2).
Screen shot of elfdump
Compressed source listing of elfdump

partdump v0.92
• Master boot record (MBR) contains 4 sets of primary partition table, and there are optional extended partitions holding secondary partition information. I had been confused with "extended" and "secondary" partitions, and had a question "How many secondary partitions I can create?". To understand partition structures and their relationships, I wrote down a partition dump utility. In this program, I created a new seek function, xseek, which utilizes non-official system call llseek. xseek specifies seek address in long long value (64 bits) and can explore the disk over 2GB.
• v0.92 newly supported secondary partitions. SCSI drives are not supported (/proc/scsi problem). In the source listing, I employed C++ class definitions for the partition structure.
Screen shot of partdump
Compressed source listing of partdump

How to communicate with Linux kernel?

Power of assembly programming
• So many C language text books have been used the "Hellow World" program in their introduction. The output is so easy, but did you concern about the code size? The code is usually larger than 4000 bytes. If you are an experienced assembly programmer, the size would be a serious matter. I've never met with a text book refering to the situation and showing a way to the code reduction.
• This chapter reveals an identity of the "bloated software" and presents a solution. After reading, you may feel Linux program is so simple and teeny just like as old DOS environment.

Reiser FS on Debian

How to install Reiser's journaling FS on Debian/GNU Linux (WRITING IS IN PROGRESS...)

  This chapter outlines an anatomy and mechanism of the Debian/GNU Linux installation disks, and

  gives some pointers and real binary images for customised RESCUE and ROOT disks.

ipconfig, a tiny and small INET configuration tool

ipconfig v0.90

There are two famous network configuration tools, ifconfig and route, but they are independent tools and redundant (45KB and 39KB, respectively). "ipconfig" presents essential methods for network configuration including LINK and ROUTING setup and it requires only 14KB file space.

  compressed source listing of ipconfig.C


Linux-based screening router GateKeeper (PAUSED)

  GateKeeper is simple packet filtering type firewall, based on Linux kernel 2.2 and ipchains.

  GateKeeper is compact (within 1.44MB FD), and is a free software.


Your SysOp is Wataru Nishida