|
root filesystem: Porting Unix to the 386: Three Initial PC UtilitiesThe second article in the "PORTING UNIX TO THE 386" series discussed the utilities we had to build to test the port on an actual 80386 PC. Why we wrote PC utilities to port UNIX with - the advantage of working from a primitive OS that runs on the absolute machine. The Second PC Utility: cpfs.exeFirst thing the kernel does is open its root filesystem - so we need a way to write a filesystem onto the hard disk, adjacent to the DOS filesystem, which is what this utility does. The Third PC Utility: cpsw.exeOnce the system is debugged and tested, the next step was to load on more code to expand with. So we moved "tar balls" to the swap space with this utility to provide a primative file upload capability. Where Do We Go From HereWith cross tools we could make utility programs for our nascent system. The next step would be incorporating them into a filesystem so that they could run on the native 386, with the kernel program. Porting Unix to the 386: The Initial Root FilesystemWe build the first instance of the root filesystem - before any operational system is present on the 386 to build one. Part of the bootstrapping cycle of getting up the first running system on a new architecture. The Role of the Root FilesystemThe root filesystem is a small, essential portion of disk storage, providing functionality to expand its resources to use storage other than the root itself, and configure system operations. The root usually survives intact when a system crash occurs, allowing system operation during recovery. A Brief Review of the RootA breakdown of the various uses of the root filesystems, and the considerations for each as we prove out the operation of the system step by step. Installation: /standPortions of the root allow the kernel to be installed as the fundamental component of the operating system. These standalone programs occupy space within the root filesystem. Initialization: /sbin/init, /dev/console, and /bin/shWith the kernel running, we do a "high level bootstrap" to initialize the operating system, by executing certain programs located in the root filesystem. Utilities: /bin and /sbinA basic set of utilities is present on the root, both of general user operation as well as necessary supervisory utilities for system recovery and operation. Operation: /tmp and /varIn operation, directories in the root are reserved for temporary and persistant data, such as compiler temporary files and accounting records. Other Directories: /lib, /mnt, /usr, /root, and /sysA number of additional directorys are present in the root to handle a variety of other purposes, but these are more to do with full operation of the system beyond the initial root filesystem. Filesystem CreationWhere do you get the root filesystem, when you need it to make itself? Answer - you make it on another system, in this case one quite different, and then you break the recursion. Filesystem DownloadingHaving made the initial filesystem on another kind of system, we need to move it into place on the system we are running the kernel on. Filesystem DebuggingNothing ever goes right the first time, so a incremental process of bringing up the filesystem, from standalone utilities to system initialization allows us to debug flaws in filesystem creation, often artifacts of its non-native creation. What's in a Filesystem?What is it that makes up a filesystem? This depends very much on what kind of filesystem we are talking about. Why Do We Need a Root Filesystem?Whats different about operating systems like Unix that use a root filesystem, and other systems that don't require a filesystem to be mounted initially to operate? The Filesystem Metaphor and its Importance in Future WorkFilesystem as metaphor allows us to restructure the way we organize system operation - perhaps other arrangements of the filesystem can achieve more enhanced operation, possibly rethinking how to bring up the system in the future. |