diff --git a/articles/style.css b/articles/style.css index 409a78c..a4c8411 100644 --- a/articles/style.css +++ b/articles/style.css @@ -1,30 +1,36 @@ ::-moz-selection { - background: rgb(255, 247, 162); -} + /*background: rgb(255, 247, 162); */ + background: #F83; +} ::selection { - background: rgb(255, 247, 162); + /*background: rgb(255, 247, 162);*/ + background: #F83; } - body { - background-color: rgb(255, 254, 242); + background-color: #FFF1E5; + color: #333; + /*background-color: rgb(255, 254, 242);*/ /* font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; */ font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-family: Verdana, Geneva, Tahoma, sans-serif; font-size: 1.2rem; } a:link, a:visited { - color: rgb(247, 170, 28); + /*color: rgb(247, 170, 28);*/ + color: #0D7680; + text-decoration: none; } a:visited:hover,a:visited:not(.lit):hover, a:link:hover,a:link:not(.lit):hover { - text-decoration: underline; - color: rgb(248, 148, 18); + /*text-decoration: underline;*/ + /*color: rgb(248, 148, 18);*/ + color: #0F5499; } p { line-height: 1.5; padding: 0.65rem 0 } h1 { - text-align: left; + text-align: center; font-size: 2.25em; font-weight: 400; } @@ -34,7 +40,8 @@ h4 { } pre { text-wrap: wrap; - background-color: #ecefef; + /*background-color: #ecefef;*/ + background-color: #FFF4EA; padding: 0.45rem 0.8rem; -moz-tab-size: 2; tab-size: 2; @@ -43,9 +50,14 @@ pre { border-radius: 0.2rem; box-shadow: 1px 1px 4px #d5d9d9; margin-bottom: 0.9rem; + font-size: 0.85rem; + border: 1px solid #F2DFCE; + width: fit-content; } pre.prettyprint { - background-color: #f4f7f7; + /*background-color: #f4f7f7;*/ + background-color: #FFF4EA; + color: black; padding: 0.45rem 0.8rem; -moz-tab-size: 2; tab-size: 2; @@ -54,11 +66,20 @@ pre.prettyprint { border-radius: 0.2rem; box-shadow: 1px 1px 4px #d5d9d9; margin-bottom: 0.9rem; + border: 1px solid #F2DFCE; } p:not(.notp) { text-indent: 0; } code { - color: #b36f0a; - font-size: 1.05em; + /*color: #b36f0a;*/ + color: #990F3D; + font-size: 0.8em; + font-family: 'Courier New', monospace; +} +.codeblock_name { + display: none; +} +.seealso { + display: none; } diff --git a/site/LFSp.html b/site/LFSp.html index c3cefda..a7a8258 100644 --- a/site/LFSp.html +++ b/site/LFSp.html @@ -3,53 +3,104 @@
in my experience, many network engineers lack an intuition about what linux is and how it works, despite its increasing importance in our field. counting myself among them, i set out to deepen my understanding. the foremost resource for that purpose is Linux From Scratch, but after skimming through the book, i felt that i first needed a higher level overview of the material. this article is the first in a series intended to supplement LFS.
-a bash script is available which runs all of the commands seen below, to save the reader from copy pasting. +
a bash script is available which runs all of the commands found below. both this HTML and the bash script are generated from the same source file, which was written using literate programming techniques.
if you'd like to follow along, i suggest a clean install of ubuntu 22.04.3 LTS. @@ -71,7 +122,7 @@
linux is a type of computer program called a kernel. a kernel manages resources (e.g. RAM), and provides an interface through which applications can use them. despite what you may have read, linux is not an operating system; what that means in practice will become clear shortly. @@ -102,11 +153,11 @@
in our case the kernel image currently in use is vmlinuz-6.2.0-39-generic
.
-(if you are curious about the filename, it is an abbreviation of "Virtual Memory Linux Gzip", another convention)
+(if you are curious about the filename, it is an abbreviation of "Virtual Memory Linux Gzip", another convention.)
check its permissions and ensure that it is readable as above, otherwise we will run into problems.
having found the linux kernel image used by our currently running system, what do you suppose happens if we boot it? -to find out, we'll use a program called qemu. +to find out, we'll use a program called qemu.
-m
flag, and it will very kindly load our kernel for us directly, allowing us to sidestep the hassle of creating a bootable disk image (for now).
in the new window that appears you will see rapidly scrolling output as the kernel initializes, which stops just as rapidly when the kernel "panics" (crashes).
so, we have answered our earlier question - when we run a linux kernel directly, it crashes almost immediately.
-let's explore why that is, and what we can do about it.
+
+let's explore why that is, and what we can do about it.
[ 1.949579] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)@@ -164,11 +216,11 @@
-append
passes parameters to the kernel, and in this case it sets the value of root=
to /dev/sda
.
/dev/sda
is a path representing the first SCSI device attached to the system; subsequent devices are named sdb, sdc, and so on.
-exeuting this command, we hit a different panic. +
executing this command, we hit a different panic.
[ 1.966493] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.@@ -224,14 +276,15 @@
you likely know what a BIOS is and does; you may not know that almost no modern computers ship with a BIOS - they now use UEFI. these are in fact entirely different things, although some mistakenly (but understandably) believe that BIOS is a generic term, and that UEFI is a "type of" BIOS. because BIOS is by now a legacy standard, we will be using qemu's UEFI firmware, which is called OVMF, to boot our kernel image from disk. this is a topic that can get very complicated, but fortunately for our purposes there are only four major concepts we need to understand:
the UEFI boot manager -this is the program, included in implementations of UEFI, that is responsible for (among other things) loading UEFI applications. +
+this is the program, included in implementations of UEFI, that is responsible for (among other things) loading UEFI applications. the boot manager is programmable via variables which are written to an NVRAM chip on your motherboard (similar to the older CMOS chip and battery system it replaced). "boot options" are a type of NVRAM variable which contain a pointer to a hardware device and to a file on that device, which is the UEFI application to be loaded.
@@ -240,7 +293,8 @@init
, UEFI can execute a boot loader program, which will then handle starting your OS.
GUID partition tables -GPT is a standard for the layout of partition tables, and all compliant UEFI firmware is required to be able to understand it. +
+GPT is a standard for the layout of partition tables, and all compliant UEFI firmware is required to be able to understand it. as UEFI replaced BIOS, GPT replaced MBR-based partitioning schemes.
EFI system partitions @@ -288,7 +342,7 @@
now that qemu is no longer booting our kernel for us, it can't pass along the required boot parameter root=
.
OVMF is able to find and boot our kernel image from the disk we provided, but we are again seeing a panic because the kernel doesn't know on what device to find the root filesystem.
we have a few options to fix this, but first we will take this opportunity to introduce another method by which linux can boot: initramfs.
@@ -310,7 +364,7 @@
Added to in section 6
+Added to in section 6
+Added to in section 6
+it's about time we set aside our example init program and booted something more useful. a great option for a minimal init program is busybox.
@@ -497,7 +551,7 @@Added to in section 8
+Added to in section 8
+Added to in section 8
+at this point you may wonder what's left to do - we've booted a custom linux kernel image from disk using UEFI, and we get a shell with a suite of useful applications available. remember that we are still just running the initramfs, whose job is to boot up the real OS on the root filesystem. we could certainly try building a root filesystem for a "real" linux system and have our initramfs load it, but that starts to encroach on Linux From Scratch's territory, so isn't really appropriate for this primer. @@ -586,7 +640,7 @@
Added to in section 9
+( cd linux/usr -cat > init << EOF +cat > init << EOFredshift #!/bin/busybox sh /bin/busybox --install /bin mount -t proc proc /proc @@ -610,7 +664,7 @@-LFS: a primer
chmod +x init )
Added to in section 9
+Added to in section 9
+ @@ -652,15 +706,6 @@-