User:Kevgor/Reflash to Custom Install Image using Ntugigroup USB stick

From OLPC
Jump to: navigation, search

These instructions are used to re-flash an Ntugigroup XO to signed 11.3.1 Build 885 deployment defaults, using an Ntugi group provided un-signed OOB 4.1 customised build from the appropriate pre-supplied USB thumb drive:

This is a one-step refresh and install process takes around 20 minutes from start to finish on an XO 1.0; and about 25 minutes on an XO 1.5 due to more software being installed onto the XO 1.5.

The XO 1.0 and XO 1.5 machines, although similar in look and feel, are of very different architectures with very different capabilities. The 11.3.1 OOB Ntugi custom-build sticks, and this procedure, are shared for both these models of the machine.

The procedure involves replacing the entire operating system, and the default Sugar Activities, with the master copy, which has been saved onto the USB Refresh stick. Any work previously saved on the XO internal storage since delivery, or any new programs or activities installed on internal storage since delivery, will be erased. All Sugar journal entries on main storage will also be erased. At the end of this install, the machine internal memory will be exactly as the originally deployed image on the USB drive. If this is the same USB drive that was used for the initial deployment, then this could alternately be termed: Return to Defaults. Be advised that during this process, no changes are made to any external SD cards or other USB flash drives. So, if there is any content you wish to save before the reflash, please ensure it exists either on the SD card, or on a user's USB thumb drive before proceeding. If in doubt, contact the appropriate technical resource to ensure that no valuable information will be lost.

To begin, ensure the XO is turned off. Plug the charger into the wall, and the other end into the XO. Ensure that XO is fully charged by observing that the green battery light is on. If an XO is completely discharged, it can take a few hours for the yellow light to turn green. Being fully charged and having line power may not be mandatory in all re-flash circumstances, but it is the best practice.

Put the Refresh USB stick in the right hand vertical XO USB port.

Press the power button, then quickly hold down only the top game key - the circle key - on the front right side set of game keys beside the display - the ones right above the power button.

Release the game key when prompted on the screen. If this prompt does not appear, and the machine just continues to boot, then after the system comes up and is running, power it off elegantly (using a shutdown command). Start again: perhaps being faster on hitting, or more accurate at holding down, that one game key.

On an XO-1, the screen will now show a grid of rectangles, and will then slowly fill the rectangles as the image is loaded from the USB stick into internal storage.

On an XO 1.5, there will be alternating green and white fill rectangles during this part of the process.

When it has finished installing the base image, the Linux Operating system and the two operating desktop environments, Sugar and Gnome are both available on the machine. On first boot, the XO will begin to start the Sugar environment. You will be asked to Name the machine. Please use a unique name.

After naming the machine, you will be prompted to change the colour of the machine icon. You may elect to just hit return here, if having accurately matched coloured icons is not required in your deployment.

At the top right of the screen there are two small icons. The square with 4 lines across it on the right corresponds to the ‘List View’ of Sugar Activities. Beside that is the circle which corresponds to selecting the 'Favourites' wheel view of the activity icons. Place the pointer on the square, and hit the left-click button. You will now have changed from the Favourite Home View to the List View of activities. You will most likely wish to look at the ‘List View’ of the activities again, and click the star beside any which you would also like to see on the favourites wheel view, that have not appeared. removed by this refresh.

You will then also need to re-attach to your network, since your previous network settings will have been Please be reminded that the Network Neighbourhood View key is the 3rd key from the left on the top row of the keyboard, looking like a circle with eight dots in it. To return to the home activity view, one can then use the Home key, which is also on the top row of the keyboard. It is a circle with a single dot in it.

If you are connected to a network, perhaps check the browse activity at this time to ensure you have internet connectivity. At this point, you can then switch to the Gnome desktop, through the My Settings panel in Sugar, attach to the desired Network in Gnome, then return to Sugar. This procedure ensures that future boots will automatically attach to the last connected network.

This completes the full refresh of the XO.

Following is the content of the olpc.fth script stored in the /boot/ directory of the USB key:

\ OLPC boot script 
\ visible
\ Returns a number identifying the XO version - 2 for XO-1, 3 for XO-1.5
: xo-version  ( -- n )  fw-version$ drop 1+ c@ [char] 0 -  ;
\ To pass hardware specific arguments we define the xo-1? and xo-1.5? flags   
\ Returns true if the machine is XO-1
: xo-1?  ( -- flag )  xo-version 2 =  ;
\ Returns true if the machine is XO-1.5
: xo-1.5?  ( -- flag )  xo-version 3 =  ;
\ Sets the DN macro to expand to the device name from which this script
\ was booted.  That's useful for subsequently booting the kernel from
\ the same device.
\ Also sets the PN macro depending on the XO version
: set-path-macros  ( -- )
   \ "O" game button forces boot from internal FLASH
   button-o game-key? INVERT if
      " \boot"  pn-buf place
      " int:"   dn-buf place
      exit
   then
    \ Set DN to the device that was used to boot this script
   " /chosen" find-package  if                       ( phandle )
      " bootpath" rot  get-package-property  0=  if  ( propval$ )
         get-encoded-string                          ( bootpath$ )
         [char] \ left-parse-string  2nip            ( dn$ )
         dn-buf place                                ( )
      then
   then 
   \ Set PN according to the XO version
   xo-version  case
      2 of  " \boot10"  endof
      3 of  " \boot15"  endof
      ( default )  " \" rot
   endcase  ( adr len )
   pn-buf place
; 
\ We check if we are booting from USB or SDcard to specify device-specific parameters
: dn-contains?  ( $ -- flag )  " ${DN}" expand$  sindex 0>=  ;
: usb?    ( -- flag )  " /usb"     dn-contains?  ;
: sd?     ( -- flag )  " /sd"      dn-contains?  ;
: slot1?  ( -- flag )  " /disk@1"  dn-contains?  ; 
: olpc-fth-boot-me  ( -- )
   set-path-macros
   \ We can pass boot-device-specific kernel arguments here with the PD macro
   \ PDEV1 tells the script where to find specific files.
   usb?  if
      " PDEV1=sda1"
   else
      sd?  if
         slot1?  if
            " PDEV1=mmcblk0p1"  \ External SD card
         else
            " PDEV1=mmcblk1p1"  \ Internal SD card
         then
      else
         " "   \ Internal raw NAND
      then
   then
   " PD" $set-macro 
   " console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22 ${PD}" expand$ to boot-file 
\ Uncomment the next 2 lines to see the command line
\   ." cmdline is " boot-file type cr
\   d# 4000 ms
	button-o game-key? INVERT if
   		" ${DN}${PN}\vmlinuz"    expand$ to boot-device
   		" ${DN}${PN}\initrd.img" expand$ to ramdisk
   		boot 
	then
;
olpc-fth-boot-me
button-o game-key? if
   visible
   xo-1? if
      " copy-nand u:\os.img" eval
   else 
      xo-1.5? if
          " fs-update u:\fs.zd" eval
      then
  then
  CR ." Rebooting in seconds... "
  1000 ms
  bye
then

Following is the content of the OOB 4.1 ini file used to generate the custom vuild:

To be completed

/