|
|
(49 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
| ='''IMPORTANT WARNING'''= | | ==Step 1: Reset Hardware== |
| For some reason if you use rsync >= 3 this whole thing goes haywire. I have a custom compile of rsync 2 that is used for all imaging tasks. If in doubt, run 'rsync --version' or './moz-rsync --version' to ensure you are on '''RSYNC 2'''. Any image processed by rsync is garbage and should be deleted immediately so as not to contaminate our collection of images.
| | '''NOTE: You should be in the RF Shielded room with the door *CLOSED* to ensure machines connect to correct network''' |
| ='''IMPORTANT WARNING 2'''=
| |
| Since all commands '''must''' be run as root, you can destroy not only the images that we have, but also the entire filesystem of the computer. Please be extremely careful to not do this.
| |
| =Nokia Imaging=
| |
| We run lots of Nokia N810s in support of Fennec development. In order to efficiently manage these devices and improve their reliability we have developed a process to clone and boot from an SD card.
| |
| ==Creating the images==
| |
| write me please
| |
| ==Cloning an N810==
| |
| There are two distinct parts of the N810 cloning process: device prep and card cloning.
| |
| ===Device Prep===
| |
| We currently erase the root filesystem and prepare for SD card booting by running the [http://hg.mozilla.org/build/tools/file/tip/buildfarm/mobile/production-sd/moz-prep.sh moz-prep.sh]. For this step you need the following things:
| |
| *Nokia N810 | |
| *Nokia N810 Charger | |
| *Nokia N810 MicroUSB Cable
| |
| *PC running linux
| |
| *Empty JFFS2 filesystem
| |
| *moz-prep.sh
| |
| *flasher-3.0
| |
| *official Nokia firmware FIASCO image (RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin)
| |
|
| |
|
| ====Detailed Instructions====
| | For each session: |
| To run the moz-prep.sh script successfully, you will need to make sure your device is off. I do this by removing the battery because there are a number of not-off states that look like off states with the N810. Once you have verified that the device is off, plug in the USB cable and put the battery in the device. Start the script
| | *Ensure USB A end of Nokia MicroUSB cable is in computer |
| su -
| | *Remove batteries and backplates from all devices to be imaged |
| cd /flashing-hg/production-sd
| | <pre> |
| ./moz-prep.sh
| | cd ~/n810-imaging |
| You will see versioning information about the FIASCO image's sub-images which can safely be ignored. When you see the last line of output "Suitable USB device not found, waiting" you will plug the charger into the device. This will turn the device on and will cause a USB icon to show up in the top right of the Nokia screen. This means you have entered firmware update mode. In firmware update mode, you will see a green (maybe brown) progress bar. Because we are flashing an empty filesystem, it will be instantaneous. On the PC you will see "The device root device is now 'mmc'" which is an indication that the script is finished Unplug the device from USB and power. It will turn off. Remove the SD card for imaging.
| | sudo ./moz-prep.sh |
| | #Follow onscreen prompts |
| | #once all devices are prepped press CTRL+C to quit moz-prep.sh |
| | </pre> |
|
| |
|
| ====Suggested routine==== | | ==Step 2: Image multiple cards== |
| *Remove all batteries and leave them out
| | <pre> |
| *Remove all SD cards, separate cards+adapters into two bowls
| | #Detach all MicroSD card readers from computer |
| *Log in as maemo/maemo
| | #Insert MicroSD cards to be imaged into MicroSD card readers |
| *Start a terminal window
| | #Plug in MicroSD card readers with MicroSD cards into computer |
| *run:
| | #then run |
| su - #password will be on front of machine
| | cd ~/n810-imaging |
| cd /flashing-hg/production-sd/
| | sudo ./bulk-image.sh |
| *for n810 in dead_pile:
| | #This will take approx 5-7 minutes per card; computer will beep when all cards are imaged. |
| ./moz-prep.sh
| | # JHFORD will paste sample output here |
| ...
| | #Remove all MicroSD card readers |
| Suitable USB device not found, waiting</pre>
| | #Remove MicroSD cards from MicroSD card readers |
| **plug in USB in n810 (USB logo is facing up)
| | #Final output will tell you how many cards were successful, |
| **replace battery and casing
| | #this for your information and is not critical to the imaging process |
| **plug in Charger
| | </pre> |
| **verify that small USB logo is displayed in top right corner of n810
| |
| **on terminal display, wait for "The device root device is now 'mmc'"
| |
| **unplug USB and power
| |
| **watch device display debug info and then power itself off
| |
|
| |
|
| ===SD Clone=== | | ==Step 3: Verify card and power on device== |
| To get the filesystem onto the SD card we use [http://hg.mozilla.org/build/tools/file/tip/buildfarm/mobile/production-sd/moz-image.sh moz-image.sh]. This script only knows how to do a single SD card at a time. As a result, we have another simple script to drive moz-image.sh called [http://hg.mozilla.org/build/tools/file/tip/buildfarm/mobile/production-sd/bulk-image.sh bulk-image.sh].
| | <pre> |
| | #Run and follow on screen instructions |
| | cd ~/n810-imaging |
| | sudo ./bulk-verify.sh |
| | </pre> |
|
| |
|
| You will need the following things:
| | ==Step 4: Boot device== |
| *Linux PC | | *This step assumes that the MicroSD card has been inserted into the correct device |
| *N MicroSD Cards
| | *Press the power button on the top of the device '''then''' plug the charger into the device (NOTE: order is important). |
| *N USB ports (we have hubs) | | *Verify the device comes turns on successfully with the blue geometry-themed desktop. |
| *N MicroSD Card Readers
| | *Verify that the grey Wifi logo in top right of screen turns to solid white |
| *Root filesystem directory
| | ** may take 5 minutes |
| *rsync'''2''' (moz-rsync on our imaging pc is this)
| |
| * | |
|
| |
|
| ====moz-image.sh==== | | ==Troubleshooting Tips== |
| This script uses the syntax:
| | IGNORE BELOW HERE UNLESS YOU ARE *REALLY* CURIOUS |
| Usage: moz-image.sh <rootfsdir> <sd card dev> <unit name>
| |
| *<rootfsdir> specifies the directory that contains the whole filesystem.
| |
| **Example listing of a valid directory:
| |
| $ su -
| |
| $ cd /flashing-hg/production-sd
| |
| $ ls moz-ref-sd-v4/
| |
| bin cdrom floppy initrd media proc srv tools
| |
| boot dev home lib mnt root sys usr
| |
| builds etc INFO lost+found opt sbin tmp var
| |
| *<sd card dev> is a device file node (/dev/sdb) that represents the SD card to image. When there are partitions, you will see /dev/sdb1, /dev/sdb2, etc. Sometimes there are device files which do not map to an SD card or reader. If this is the case, reboot the computer. | |
| *<unit name> is the name of the device. This will be echoed into <rootfsdir>/etc/hostname which is picked up by buildbot.tac | |
|
| |
|
| =====Example===== | | ===N810 Imaging=== |
| su -
| | We use N810s to do on-device testing of our maemo4 builds of our mobile browser. In order to deal with maintaining 80 of these devices we have developed an imaging solution. Our initial attempt was to create a custom firmware image but file corruption became an issue. We eventually figured out how to boot these devices from MiniSD cards. We have special tools for creating and maintaining the filesystems on these cards. |
| cd /flashing-hg/production-sd
| |
| ./moz-image moz-ref-sd-v4 /dev/sdb maemo-n810-ref
| |
| ====bulk-image.sh====
| |
| This script uses moz-image.sh to do bulk updates of many SD cards. It sets the same hostname of 'maemo-n810-ref' to all cards as there is no known way to map a device file to a physical sd card reader. If run without parameters, you will be presented with a list of valid choices. '''Beware, you could erase the entire hard drive. Make sure you do not select the computer's hard drive as a target. I have special cased /dev/sda to not be useable, but there is no guarantee that the hard drive of the computer is /dev/sda.''' While the imaging is happening, the bash prompt will be blocked on the moz-image.sh scripts. When each script is finished it will print out "All done on /dev/sdb" and when the whole process is complete, bulk-image.sh will print out "BULK IMAGING COMPLETED". Because this script is a hack, you set the rootfsdir parameter by editing the script.
| |
| =====Example=====
| |
| $ su -
| |
| $ cd /flashing/production-sd
| |
| $ ./bulk-image.sh
| |
| Please specify devices from this list | |
| /dev/sdg1
| |
| /dev/sdc1
| |
| /dev/sdb1
| |
| $ ./bulk-image.sh b c g
| |
| <tons of interleaved dd, mke2fs, rsync, info output> | |
| INFO: Copying data to card
| |
| INFO: Copying data to card
| |
| INFO: Copying data to card
| |
| INFO: Modifying Image
| |
| INFO: Unmounting
| |
| INFO: Modifying Image
| |
| INFO: Unmounting
| |
| INFO: Modifying Image
| |
| INFO: Unmounting
| |
| All done on /dev/sdb
| |
| All done on /dev/sdc
| |
| All done on /dev/sdg
| |
| BULK IMAGING COMPLETED
| |
|
| |
|
| ====Suggested routine==== | | ===Resetting hardware=== |
| *plug in usb hub and power
| | The purpose of this step is to zero out the root mtd device as well as reflashing the linux kernel and bootloader. We want to make sure that any possible corruption in these critical subsystems is repaired |
| *plug in card readers
| |
| *insert cards into readers if not already plugged in
| |
| *run bulk-image.sh to find drive letters
| |
| *run bulk-image.sh with params to image
| |
| *remove sd cards
| |
| *unplug usb hub power and usb (they get hot)
| |
|
| |
|
| | | ===Potential issues=== |
| ==Random Notes== | | If you see |
| *The start up has these phases:
| | ERROR! Lost USB Connection while flashing RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin. Dead battery? |
| **Nokia screen (Big blue lettering)
| | this is a sign that moz-prep encountered an error. This is a sign that for some reason, the nokia flashing program lost connection to the device. This is often caused by trying to flash with a dead battery. We mitigate this by flashing with the charger connected. This has also been caused by issues with the linux kernel on the imaging host. If you encounter this error on multiple devices using different batteries reboot the imaging machine. If you still have issues, someone has broken the imaging machine. |
| ***Happens even if there is a corrupt FS
| |
| ***Beginning of Firmware Update Mode
| |
| **Nokia loading screen
| |
| ***This screen has a blue progress bar
| |
| ***Sign that the SD/RootFS are booting
| |
| **Handshake screen
| |
| ***OS Load
| |
| **Maemo Desktop
| |
Step 1: Reset Hardware
NOTE: You should be in the RF Shielded room with the door *CLOSED* to ensure machines connect to correct network
For each session:
- Ensure USB A end of Nokia MicroUSB cable is in computer
- Remove batteries and backplates from all devices to be imaged
cd ~/n810-imaging
sudo ./moz-prep.sh
#Follow onscreen prompts
#once all devices are prepped press CTRL+C to quit moz-prep.sh
Step 2: Image multiple cards
#Detach all MicroSD card readers from computer
#Insert MicroSD cards to be imaged into MicroSD card readers
#Plug in MicroSD card readers with MicroSD cards into computer
#then run
cd ~/n810-imaging
sudo ./bulk-image.sh
#This will take approx 5-7 minutes per card; computer will beep when all cards are imaged.
# JHFORD will paste sample output here
#Remove all MicroSD card readers
#Remove MicroSD cards from MicroSD card readers
#Final output will tell you how many cards were successful,
#this for your information and is not critical to the imaging process
Step 3: Verify card and power on device
#Run and follow on screen instructions
cd ~/n810-imaging
sudo ./bulk-verify.sh
Step 4: Boot device
- This step assumes that the MicroSD card has been inserted into the correct device
- Press the power button on the top of the device then plug the charger into the device (NOTE: order is important).
- Verify the device comes turns on successfully with the blue geometry-themed desktop.
- Verify that the grey Wifi logo in top right of screen turns to solid white
Troubleshooting Tips
IGNORE BELOW HERE UNLESS YOU ARE *REALLY* CURIOUS
N810 Imaging
We use N810s to do on-device testing of our maemo4 builds of our mobile browser. In order to deal with maintaining 80 of these devices we have developed an imaging solution. Our initial attempt was to create a custom firmware image but file corruption became an issue. We eventually figured out how to boot these devices from MiniSD cards. We have special tools for creating and maintaining the filesystems on these cards.
Resetting hardware
The purpose of this step is to zero out the root mtd device as well as reflashing the linux kernel and bootloader. We want to make sure that any possible corruption in these critical subsystems is repaired
Potential issues
If you see
ERROR! Lost USB Connection while flashing RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin. Dead battery?
this is a sign that moz-prep encountered an error. This is a sign that for some reason, the nokia flashing program lost connection to the device. This is often caused by trying to flash with a dead battery. We mitigate this by flashing with the charger connected. This has also been caused by issues with the linux kernel on the imaging host. If you encounter this error on multiple devices using different batteries reboot the imaging machine. If you still have issues, someone has broken the imaging machine.