Unadorned links for February 7, 2017

This is the unformatted notes....

UUID

Stuff from the Unix and Linux System Administration
  man pages
    stored in /usr/share/man
    created with nroff
  info
    stored in /usr/share/info
    created with texinfo
  command editing
    bariables
    back-ticks
  common commands
    cut, sort, uniq, wc, tee, head, tail (tail -f)
  2.5 Python scripting
    http://www.ibm.com/developerworks/aix/library/au-python/
      use subprocess for newer scripts
        https://docs.python.org/2/library/subprocess.html#module-subprocess
  3.2 Booting with BIOS
  3.3 GRUB (boot loader)
  3.5 System V init
     Check it out on your computer (OK, it is really upstart)
       https://en.wikipedia.org/wiki/Upstart
       http://upstart.ubuntu.com/
     Files, directory
       /sbin/init
         ps gaux | grep init
       /proc/1/cmdline
     init scripts and runlevel
       /etc/init/rc-sysinit.conf
       /etc/init.d
         /etc/init.d/ntp
         /etc/init.d/nfs-kernel-server
       /etc/rcN.d

More references
  http://www.ibm.com/developerworks/library/l-linuxboot/
  https://en.wikipedia.org/wiki/Linux_startup_process
  https://en.wikipedia.org/wiki/Initrd

Boot process....

CPU will execute at reset vector
  https://en.wikipedia.org/wiki/Reset_vector
    (0xFFFFFFF0)
Intel reference manual
  http://download.intel.com/products/processor/manual/325462.pdf
  http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-manual-325462.html

Intel® 64 and IA-32 Architectures Software Developer’s Manual
  First Instruction Executed -- Section 9.1.4  (Vol 3A  9-5)
    0xFFFFFFF0 (FFFFFFF0H)   -- in EPROM

S/360 -- IPL (Initial Program Load)
  computer operator sets three hex address and presses LOAD
  loads 24 bytes --
    initial PSW and two CCW

http://askubuntu.com/questions/592740/how-does-the-ubuntu-boot-process-work
  bootchart

first stage boot loader (BIOS or UEFI)
  generally can specify boot order
  POST (Power-On Self-Test)
    https://en.wikipedia.org/wiki/Power-on_self-test
    Won't turn on .... count the beeps... 
    memory failure
    power supply

BIOS (UEFI) → MBR → grub → kernel → init  


BIOS
BIOS loads boot sector
  GUID Partition Table replacing MBR (Master Boot Record)
MBR contains "bootstrap code" (~400 bytes)
  loaded into memory at location 0 (could be up to ~32000 bytes)
VBR -- volume boot record (on each partition)

  http://www.howtogeek.com/56958/htg-explains-how-uefi-will-replace-the-bios/
  https://wiki.ubuntu.com/Booting
  https://help.ubuntu.com/community/UEFI


second stage boot loader (GNU GRUB)
    network boot ... uses TFTP

GRUB and LILO write to MBR sector (grub-install)

GUID Partition Table
  https://en.wikipedia.org/wiki/GUID_Partition_Table


BIOS/UEFI to GRUB
  generally /boot/grub/i386-pc (or /boot/grub/x86_64-efi) contains
    boot.img
      written to boot sector -- 512 bytes
      loads first part of core.img and jumps to it
      http://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/boot/i386/pc/boot.S
    core.img
      able to access /boot/grub and loads modules
      *.mod stored in /boot/grub
    UEFI uses core.efi and grub.efi
  usually you leave grub alone
    Some modifications in lab to make more secure
Customizing GRUB
  /usr/sbin/update-grub
  /usr/sbin/grub-mkconfig
  looks at /etc/grub.d

Where is kernel located....
  cat /proc/cmdline
    which points to kernel, eventually gets to /boot
  But look in 
    /lib/modules/*/kernel
    initrd (initial ramdisk)

A little exercise with initrd
  cd /var/tmp
  mkdir initrd
  cd initrd
  gunzip < /boot/initrd.img-3.13.0-100-generic | cpio -id
  du -s *
Take a look at
   bin directory
     what is busybox????
   init shellscript
     it will call /bin/run-init to run /sbin/init
   It is process #1

https://en.wikipedia.org/wiki/Init
https://en.wikipedia.org/wiki/Systemd

systemd is the future -- (it spite of the screaming)
  Fedora (2011), Red Hat (2014), Debian/Ubuntu/Raspbian (2015)
  Still many System V compatiability modes