Intermec ck1 Reference Guide
Appendix A —
µClinux System
CK1 SDK Programmer’s Reference Manual
319
Kernel Block Drivers
The
µClinux kernel supports three different types of block drivers. These
drivers enable reading and writing fixed size blocks to the host file system
such as a disk. The drivers are used as the lowest level of access for the
physical device. Above these the Linux uses some root file system, which
handles the arrangement of the blocks.
such as a disk. The drivers are used as the lowest level of access for the
physical device. Above these the Linux uses some root file system, which
handles the arrangement of the blocks.
The common way to start up a
µClinux based system is by including the
block memory device, blkmem, and the ram disk drivers to the system.
The RAM disk driver is designed to allow a portion of the RAM memory
to be used as a block device allowing you to read and write to it. The file
system can be either in its native format or compressed. This file system
does not have any direct support for the Flash device and is only really
useful for storing the root file system.
The RAM disk driver is designed to allow a portion of the RAM memory
to be used as a block device allowing you to read and write to it. The file
system can be either in its native format or compressed. This file system
does not have any direct support for the Flash device and is only really
useful for storing the root file system.
A more convenient solution for the Flash device is the memory technology
device (MTD) driver. It provides a generic interface to memory devices
providing a hardware abstraction layer (HAL) that allows different file
systems to mount themselves on various memory devices. The mtdblock
provides some security against overlapping by allowing these
functionalities to be done to the actual Flash device only when the request
is done to another block. This is because the Linux buffer cache is smaller
than a typical erasable sector in Flash and is done with a local cache.
device (MTD) driver. It provides a generic interface to memory devices
providing a hardware abstraction layer (HAL) that allows different file
systems to mount themselves on various memory devices. The mtdblock
provides some security against overlapping by allowing these
functionalities to be done to the actual Flash device only when the request
is done to another block. This is because the Linux buffer cache is smaller
than a typical erasable sector in Flash and is done with a local cache.
Changes in Programming Interfaces
The lack of MMU in the
µClinux environment is the biggest change
compared to Linux. This change causes the lack of memory protection and
a virtual memory model, which affects the development done under
a virtual memory model, which affects the development done under
µClinux by forcing some changes to some system calls and the fact that the
programmer is responsible of memory management.
programmer is responsible of memory management.
The fork() system call is used to duplicate the current process by creating a
new entry in the process table. This can be handy if the program handles
more than one function at a time. The created child process is almost
identical to the parent executing the same code but with its own data
space, environment, and descriptors. The fork command is implemented
by using copy-on-write pages. When either one of the processes tries to
write on the page frame, a private copy of the page is created for this
process. The new physical page is mapped into the original logical address
space. Without MMU, the process cannot be completely and securely
cloned and it does not have access to copy-on-write page.
new entry in the process table. This can be handy if the program handles
more than one function at a time. The created child process is almost
identical to the parent executing the same code but with its own data
space, environment, and descriptors. The fork command is implemented
by using copy-on-write pages. When either one of the processes tries to
write on the page frame, a private copy of the page is created for this
process. The new physical page is mapped into the original logical address
space. Without MMU, the process cannot be completely and securely
cloned and it does not have access to copy-on-write page.
The
µClinux implements BSDs vfork() in the order of the offer the
functionality of the fork. The process created by this system call shares all
of its memory space including the stack. To prevent the parent from
overriding the data needed by the child process, the parent is suspended
until the child exists.
of its memory space including the stack. To prevent the parent from
overriding the data needed by the child process, the parent is suspended
until the child exists.