Presentation is loading. Please wait.

Presentation is loading. Please wait.

Washington University

Similar presentations


Presentation on theme: "Washington University"— Presentation transcript:

1 Washington University
Smart Port Card Tutorial --- SPC Utilities Edward Spitznagel Washington University

2 Utilities - Overview Purpose of SPC Utilities:
glue between various software components simplify other parts of the system solve miscellaneous problems encountered There aren’t as many as there used to be. Utilities that are still useful: mkimg - make image mknl - make namelist

3 mkimg - overview Creates a kernel image suitable for downloading to the SPC Removes some of the burden from the bootloader

4 Kernel Image On Disk: This is what the NetBSD kernel in a.out format looks like on the disk e.g. the file /netbsd on most systems exec header text segment initialized data symbol table (optional) string table (optional)

5 Kernel Image On Disk: (e.g. the file /netbsd) In Memory: (as loaded by bootloader) This is what the kernel image looks like when loaded into memory. What’s different? BSS segment has been inserted in the middle. exec header exec header text segment text segment initialized data initialized data symbol table (optional) BSS segment (uninitialized data) string table (optional) symbol table (optional) string table (optional)

6 mkimg - summary Kernel requires BSS segment for execution.
Normal PC: done at boot time (by the bootloader) SPC: done by mkimg, after kernel build mkimg creates a copy of the kernel file with the BSS segment included. mkimg is invoked by “make” from the mk.3 script

7 mknl - purpose Certain system tools need a kernel namelist:
ps, netstat, top, uptime, etc. Normally, this is read from kernel file (/netbsd) Problem: kernel too large to fit on filesystem Solution: create a file that we can put on the filesystem, to hold the namelist information file should look as much like the real kernel as possible

8 Kernel Image mknl utility: input: kernel in a.out format
On Disk: (e.g. the file /netbsd) mknl utility: input: kernel in a.out format output: the “symbols only” file approach: open input and output files copy exec header lseek past text and data segments copy symbol table and string table close files exec header text segment initialized data symbol table (optional) string table (optional)

9 a file with a hole mknl creates a file with a hole
unneeded blocks are not allocated Example of a file with a hole: block array for the file: disk block disk block null null null null disk block disk block . . .

10 152 -rw-r--r-- 1 root wheel 24624114 /netbsd
output from mknl Output file from mknl: This is what the symbols-only netbsd file looks like This is what we put into our filesystem as /netbsd Doesn’t require much space typically around 150kB Example: from a 24MB kernel: exec header hole (used to be text segment) hole (used to be initialized data) 152 -rw-r--r-- 1 root wheel /netbsd symbol table string table

11 mknl - implications Implication of a files with holes:
Copying can produce undesirable results: holes look like blocks full of zeroes... new file will be as large as the original kernel defeats purpose of mknl Need to mknl directly into the filesystem. Need to mknl after any changes are made to the kernel. mknl is invoked by mk.2 script

12 Conclusion Utilities The End
mkimg - make a kernel image suitable for downloading to SPC mknl - makes a “symbols-only” file to reside on the SPC filesystem The End


Download ppt "Washington University"

Similar presentations


Ads by Google