Wednesday, 17 May 2017

Linux Kernel

kernel or device driver developers  must know what Linux kernel can not do


1) No access to C library
Generally, C library is large. Accessing a C lib function from kernel space is very time consuming.
It affects the kernel speed and size. So many libc functions are implemented in the kernel. Just like printf in libc is implemented as printk in kernel.

2) The kernel lacks memory protection.
Application in user space lacks memory protection. so when an application access illegal memory location, it results in segment violation. But when in kernel space segment violation occures, it results in oops. It is a major kernel error.

3) Difficult to use floating point.
When floating point arithmetic is done in user space, kernel manages the transition from integer to floating point mode. But enabling floating point in kernel, the kernel requires manually saving and restoring the floating point register. It is extra overhead for kernel.

4) Limited and small stack
Linux kernel has very small stack size. The size varies by architectures. Generally it is 8KB for 32-bit architecture and 16KB for 64-bit architecture.

5) Requires synchronization and concurrency
Linux kernel is a preemptive multitasking operating system. So scheduler schedules any process among the pool of processes. It requires synchronization between tasks. The concurrency is required when two or more processes tries to access the same resource.

 How boot the kernel with NFS
Network File System (NFS) is a Network file system protocol allowing a user on a client computer to access files over a network as easily as if the network devices were attached to its local disks.


Booting the kernel from Uboot

U-Boot implements tftp command to download the kernel and filesystem.You can then choose to directly boot the newly downloaded images or write them to non-volatile memory using U-Boot commands and then copy the the images to SDRAM from this memory for subsequent boots.

This method downloads the kernel and ramdisk image from ethernet using TFTP into SDRAM, then boots the kernel image from SDRAM. Use the following settings for U-Boot environment variables bootargs and bootcmd and reboot the DUT:
U-Boot> setenv bootargs mem=32M console=ttyS2,115200n8 root=/dev/ram0 rw initrd=0xc1180000,4M ip=dhcp eth=${ethaddr}
U-Boot> setenv bootcmd 'tftp 0xc0700000 uImage; tftp 0xc1180000 <ramdisk file name>; bootm 0xc0700000'


  

No comments:

Post a Comment