Early boot: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Dump our early boot design into the wiki)
 
(Partially wiki-fy.)
Line 3: Line 3:
Draft of early boot upgrade/init procedures designed by Michael Stone and C. Scott Ananian.
Draft of early boot upgrade/init procedures designed by Michael Stone and C. Scott Ananian.


== Early userland startup steps ==
[initrd]
[initrd]
v
v
Line 45: Line 46:
listen for shutdown, etc.
listen for shutdown, etc.
vserver (- CONTEXT)
vserver (- CONTEXT)

== Notes on P_SF_RUN ==
---------------------------------
P_SF_RUN:
P_SF_RUN:
off = allow mod = run from /run/X
off = allow mod = run from /run/X
Line 54: Line 54:
switch on->off: set the unlink flags on /run
switch on->off: set the unlink flags on /run
off->on: create immutably-tagged /run/a,b from /pristine/a,b
off->on: create immutably-tagged /run/a,b from /pristine/a,b

== List of directories in root ==
---------------------------
directories in root:
/sys, /proc, /ofw vfs
/sys, /proc, /ofw vfs
/pristine/a
/pristine/a
Line 68: Line 67:
/boot -> /pristine/current/boot
/boot -> /pristine/current/boot
/boot-alt -> /pristine/alt/boot
/boot-alt -> /pristine/alt/boot

== Upgrade procedure ==
--------------------------
Upgrade procedure, creating new b from a (w.l.o.g)
Upgrade procedure, creating new b from a (w.l.o.g)
Rainbow: (ATC gives <version> <hash> <priority>)
Rainbow: (ATC gives <version> <hash> <priority>)
Line 87: Line 86:
8. Swing /pristine/current to /pristine/b (atomic!)
8. Swing /pristine/current to /pristine/b (atomic!)
9. If <priority> reboot.
9. If <priority> reboot.
-----------------------


[[Category:software]]
[[Category:software]]

Revision as of 16:57, 15 August 2007

  This page is monitored by the OLPC team.


Pencil.png NOTE: The contents of this page are not set in stone, and are subject to change!

This page is a draft in active flux ...
Please leave suggestions on the talk page.

Pencil.png

Draft of early boot upgrade/init procedures designed by Michael Stone and C. Scott Ananian.

Early userland startup steps

[initrd]
v
python2.5 (pid 1)
v
network_setup(), mount usb/sd, etc
v
antitheft client (ATC)
 olpc.atc.run(fqdn of schoolserver, callback)

(sometime later, or immediately if already activated)
v
callback (as pid 2)
v
mount /sysroot, unmount usb/sd
copy /security/lease to /sysroot/security/lease if first boot
parse chosen/bootpath, swing /p/current
v
make minimal userland context (mount --move /sysroot /)
 vserver (protect PID 1, RTC <- vserver delta time)
v
with open('/sbin/olpc-init.py') as f:
 str = f.read()
eval(str)
--------------------> debian w/ developer key:
|                      def run():
|                        os.exec('/sbin/init')
xo boot:
$current = last part of /pristine/current symlink
mnt /home /run/$current/home
mnt /security /run/$current/security
mnt /pristine /run/$current/pristine
chroot /run/$current (mount --move ?)
v
with open('/sbin/olpc-init.py') as f:
 str = f.read()
eval(str)
---------------------> debian w/o developer key (in run)
|
pyinit + rainbow stuff (take over legacy init's job)
 fork run-parts (/etc/inittab stuff)
 listen for shutdown, etc.
 vserver (- CONTEXT)

Notes on P_SF_RUN

P_SF_RUN:
 off = allow mod = run from /run/X
 on  = pristine  = run from /run/X

switch on->off: set the unlink flags on /run
      off->on:  create immutably-tagged /run/a,b from /pristine/a,b

List of directories in root

 /sys, /proc, /ofw   vfs
 /pristine/a
 /pristine/b
 /pristine/current -> /pristine/a (say)
 /run/a
 /run/b
 /security
 /home
 /sbin/olpc-init.py
 /boot -> /pristine/current/boot
 /boot-alt -> /pristine/alt/boot

Upgrade procedure

Upgrade procedure, creating new b from a (w.l.o.g)
 Rainbow: (ATC gives <version> <hash> <priority>)
  0. swing /pristine/alt to /pristine/a
  1. delete /pristine/b
  2. Invoke 'olpc-updater <version>'
     in new container:
           /current (ro-bind mount from /pristine/a)
           /upgrade (initially empty)
 OLPC updater:
  3. clone /current to /upgrade
  4. upgrade /upgrade by hook or crook
  5. exit
 Rainbow:
  6. Verify $container/upgrade matches <hash>
  7. Move $container/upgrade to /pristine/b (atomic!)
  8. Swing /pristine/current to /pristine/b (atomic!)
  9. If <priority> reboot.