Epics@GSI Webhome

Dreamplug Rollback System And UImage

Introduction

Requirements

Sources

How-to

Prepare your external usb device.

  1. Needs root privileges.
  2. Get the uimage and the system tar ball
  3. Create a bootable SD-card/USB device
    • "by Hand" :
      1. Partition your device into at least 2 partitions:
        • first partition: FAT16, ≈ 30MB
        • second partition: ext3, the rest
      2. Format the device using mkfs.vfat and mkfs.ext3
        • Note: give the FAT partition only " " as name
    • "automatic" :
      • Follow the steps described in the topic DreamplugCreateBootableUSBDeviceFromLocalSystem
        • download/extract the script dreamplugCreateBootDeviceFunctionSet.sh
          • NOTE: our dreamplug devices, already contain this script
            • extract it from the system tar ball, ≈ 2min
        • source the this script
        • just excute the function createBootDevicePartition
  4. Mount the partitions
  5. Extract uimage into the first partition
  6. Extract the tar ball into the second partition
  7. Unmount the partitions

Restore

  1. Plug your prepared USB device / SD card into the Dreamplug
  2. Restart your system
  3. Login to the dreamplug with root privileges
    • user/pw: restore/nosoup4u
    • becomes automatically: root
  4. Internal SD card
    1. Optional: check internal dev/sda, there should be:
      • 2 partitions
        1. VFAT, ≈30MB
        2. ext3, ≥ ≈4GB
    2. Alternatively: clean and repartition /dev/sda:
      • Follow the steps described in the top DreamplugCreateBootableUSBDeviceFromLocalSystem, downloading the script, sourcing it, and just executing the function createBootDevicePartition
        source ~/dreamplugCreateBootDeviceFunctionSet.sh && target=<target> createBootDevicePartition
                    
      • Note: the current distribution of the image already contains the source: ~/dreamplugCreateBootDeviceFunctionSet.sh
  5. execute dreamplugRestoreLocalSystemFromExternal.sh,
    • the current distribution also contains it at ~/dreamplugRestoreLocalSystemFromExternal.sh
    • it performs the following steps
      • checks /proc/cmdline
        • root mustn't be the internal /dev/sda2
      • it takes the current / as source for the system
        • respecify source to be different
      • mounts internal devices: /dev/sda1 and /dev/sda2
      • mounts source device's first partition: /dev/sdX1
      • rsync of uimage
      • rsync of "system"
        • takes ≈ < 20 min
      • unmounts previously mounted devices
      • optional options:
        • -d: rsync with option --delete, any other content on the target system will be erased
        • -v: rsync with option --verbose, (much) more output
        • -n: rsync with option --dryRun, do nothing, just simulate
  6. restart system, with no boot device connected
  7. NOTE: at restart the restore account is automatically removed

Code:

Prepare

target=<span style="font-style:italic;font-variant:small-caps;">&lt;Your Target Device, e.g. </span>sdd&gt; &&
cd $(mktemp -d) && 
wget -N http://jspc29.x-matter.uni-frankfurt.de/bitfiles/dreamplug-uimage-04112013.tar.xz && 
wget -N http://jspc29.x-matter.uni-frankfurt.de/bitfiles/dreamplug-system-01032016.tar.xz &&
scr=$(tar atf dreamplug-system-01032016.tar.xz | grep -w dreamplugCreateBootDeviceFunctionSet.sh) && 
tar axf dreamplug-system-01032016.tar.xz $scr && 
mv $scr $(basename $scr) && unset scr && 
. ./dreamplugCreateBootDeviceFunctionSet.sh && 
createBootDevicePartition && 
createBootDeviceMounts && 
tar Jxvf dreamplug-uimage-04112013.tar.xz -C /mnt/${target}1 && 
tar Jxvf dreamplug-system-01032016.tar.xz -C /mnt/${target}2 &&     
createBootDeviceUnmounts 
#optional: cd && rm -rf $OLDPWD

Restoring from external USB stick / SD card

  1. Plug your prepared USB device / SD card into the Dreamplug
  2. Restart your system
  3. Login to the dreamplug with root privileges
    • user/pw: restore/nosoup4u
    • becomes automatically: root
  4. #if you want to get the newest/or dreamplugRestoreLocalSystemFromExternal.sh is not on the system 
    wget -N https://wiki.gsi.de/pub/Epics/DreamplugRollbackSystemAndUImage/dreamplugRestoreLocalSystemFromExternal.sh 
    
    #optional source
    source=&lt;Your source Device, e.g. sdb&gt;
    
    chmod u+x ./dreamplugRestoreLocalSystemFromExternal.sh  && 
    ./dreamplugRestoreLocalSystemFromExternal.sh
    

  1. reboot your device, with no boot device connected

Script code
dreamplugRestoreLocalSystemFromExternal.sh:


-- PeterZumbruch - 01 Mar 2016
-- PeterZumbruch - 2016-03-01
Topic revision: r22 - 2016-03-01, PeterZumbruch
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)