# # Booting SCO Unix : The Kernel
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Booting: The Kernel

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© September 1999 Tony Lawrence

This is part of a series of articles that covers the booting of an OSR5 machine. See Booting OSR5 for other related articles.

When you type the name of a kernel or just press enter to get the kernel defined by defbootstr, /boot first checks to see that you haven't typed a built in command that it understands, or that what you typed is an alias (remember, it has already read /stand/etc/default/boot) that will expand to something that it can understand; if it is either an alias or a direct reference (like "hd(40)unix") it then looks to see if the kernel or other program you want you want is on the disk. Other program? Yes, if you aren't loading a kernel, you'll be running something else like bootos.

If you have given the name of a program to load, /boot checks the magic number of the file. For example, if you type "/etc/default/boot" at the boot prompt, you'll be told that it has a "bad magic number"; in other words it is not a program that can be executed by /boot. Only standalone programs can be run. If you have the opportunity, try this:

btmt -w
# remounts /stand as read/write
cp /bin/ls /stand
btmnt -d
# remounts /stand as readonly
shutdown -g1 -y
 

At the Boot: prompt, type "ls". You will be told that "ls" has a bad magic number. It isn't a standalone program, so /boot won't load it.

Built in commands usually affect some later behavior of /boot or the kernel that it loads, although a notable exception is "dir", which acts much like "ls" except that it has no flags: you can't do "dir -l", for example. Another is "debug", which will be very familiar to those old enough to remember machines that always booted to a debug console, or MSDOS "debug", which served exactly the same purpose as this. Probably the only thing anyone would use this for nowadays is low-level disk format if the disk bios didn't provide any other way to do it. If you have been doing this long enough to remember when that was standard operating procedure, you won't be surprised to learn that "g C800:6" would transfer you to drive formatting code hopefully located at that address.

There's no harm in taking a peek at debug: just type "debug" at the Boot: prompt. A "?" will show you the commands it understands. You can examine registers with "r", and print bytes (just bytes; this is not a disassembler) with "p". Just don't change anything; when you've had enough, type "g" to return to the normal prompt.

"link" is another oddball: when you type "link", it looks like it takes over the loading of the kernel, but actually /boot still does the work, and passes control to link just after the loading. This can be seen by using an emergency boot floppy made with "mkdev fd" (which by default would not have the "link" program on the disk). If you type "link" at that floppy's Boot: prompt, boot will ask you what package(s) you want to link, will then load the unix kernel, and only then will fail because it is unable to load and pass control to link.

Other potentially useful commands:


Sizing Memory

Once you finally do type the name of a kernel, /boot actually sizes memory before it starts to load it. You can get /boot to do just the memory sizing by typing "mem=/p" at the Boot: prompt.

If you do that, you'll have another surprise when you actually do boot: after loading the kernel, /boot stops and tells you that the kernel is loaded and that you need to press RETURN to continue.

Memory sizing has a large section of the "man HW boot" page devoted to it. Each "." that it prints represents 1 megabyte of memory. If you have done "mem=/p", you'll see something like this after all the dots:

     mem=1m-16m,16m-256m/s/n
 

The "/s" means the memory is "special", the /n means it is not DMAable. The "mem=" command can also be used to tell /boot what memory to use.

If you want to know what memory was used (and how it is used) after booting, run "hw -r ram".

After loading your kernel, /boot passes control to it. The information that boot has about memory size, etc. has been placed at a special memory address where the kernel will know to look for it. That information is documented in /usr/include/sys/bootinfo.h; if you examine this you'll see that /boot actually passes quite a bit of information.

Loading kernel hd(40)unix .text

After memory sizing, the kernel's .text (executable code) section is loaded. This procedure prints a "." for each 4K of text.

Jim Mohr, in SCO Companion says that each dot represents 12k, but my experience says that isn't so. For example, on this 5.0.4 machine, "size /stand/unix" tells me that the text size of this kernel is 1797680 bytes and the data segment is 205484 bytes. With each dot being 4k, /boot should print 439 dots for the text segment and 50 dots for data, and that is just what it does.

I suspect that this behaviour might have been changed after Jim published. He mentioned that the booting had the appearance (though not the reality) of being slow due to the 12k chunks; perhaps this perception caused the design change.

After .text comes .data (initialized variables), and then space is set aside for stack variables ("loading .bss"). At this point control is passed to the kernel unless btld's are to be linked in.

Boot Time Loadable Drivers

If you have essential equipment such as a hard disk controller that is not supported by any of the standard drivers included with the installation kernel, you need a boot time loadable driver. Generally, this is simple: you just type "link" at the Boot: prompt or construct a "defbootstr=" line that includes the link. For example, if you needed to link two drivers, you might have to type

defbootstr link="alad ida"
 

Where this can get confusing is when link objects to something about the driver and asks you what to do about it. The problems might be:


After this, /boot gives over control to the kernel.

Publish your articles, comments, book reviews or opinions here!

See also OSR504 boot STOPS after "Loading kernel ... .text"

© September 1999 A.P. Lawrence. All rights reserved


If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> Booting SCO Unix : The Kernel


Inexpensive and informative Apple related e-books:

Take Control of Numbers

Take Control of Automating Your Mac

Sierra: A Take Control Crash Course

Take Control of the Mac Command Line with Terminal, Second Edition

Digital Sharing Crash Course





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





The problem of viruses is temporary and will be solved in two years. (John McAfee)




Linux posts

Troubleshooting posts


This post tagged:

Kernel

SCO_OSR5



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode