2011年5月27日 星期五

(較早期的做法)Creating an Embedded Recovery CD by Using Windows PE and SDI

2011 realse

Creating an Embedded Recovery CD by Using Windows PE and SDI

Step 1: Install and Boot Until You Have a Master Image
Once you have deployed the image to your device, you need to boot the device. This allows you to:
Verify that your device and applications work properly.
All extraneous applications have been removed – remove any internal diagnostic, testing, or debugging applications that you don't want to appear on the customer's device.
The run-time image has been resealed so that a new and unique SID is created on each device when the image is deployed.
The image is available offline on a drive accessible from your development computer. This can be a mounted SDI volume, a folder on your development computer, or a Universal Naming Convention (UNC) network path.


Step 2: Image cloning
For mass deployment, you should reseal the device after completing boot. This ensures that when the image is deployed, each device has a unique security ID (SID) and computer name.
To use the fbreseal command, type the following syntax in a command prompt.Then, shut down the device.
Example
The following code sample shows a typical syntax.C:\>fbreseal -keepall

Note . These image files are as Master image now. You can copy it to your development computer, for example :”C:\master image”.

Step 3: Create an SDI File on Your Development Computer
Use SDI to create an image of a partitioned, formatted disk on your development computer. With SDI, you create an SDI file on your computer, which will then appear as a mounted regular drive that you can add files to.
To create an SDI file
1. On the Start menu, click All Programs, point to Microsoft Windows Embedded Studio, and then click SDI Loader.
The Storage Device Image Loader dialog box appears.
2. Click Add Disk. Specify a location, for example “C:\”.
3. Specify a new file name, for example "deploy.sdi."
4. Click Open, and then click Yes to confirm that you want to create the file.
5. Specify the size of disk that you want to create to hold your run-time image, and then click OK.
Set this to a size just larger than the total size of your master image. In most cases, you can set this to 510 MB. Depending on whether you are using a 74-minute or 80-minute CD-R, your recovery CD will hold about 650-700 MB of data. Your recovery CD will include the following:
· Windows PE (unmodified, 154 MB; a customized version can be larger or smaller depending on your changes)
· Your SDI file (400-510 MB)
· SDI Manager (sdimgr.wsf, 217 KB)
· A few small miscellaneous files (1 KB each)
· Any other additional files you want to include outside of the image
Found New Hardware notifications appear in the Taskbar notification area for the new SDI disk and disk drives.
6. Click Done.

To initialize the SDI file as a disk drive
1. On the Start menu, click Control Panel, and then double-click Administrative Tools.
2. Double-click Computer Management, and then click Disk Management.
The Initialize and Convert Disk Wizard appears.
3. Click Next to accept the defaults, and then click Finish to complete the wizard.
4. In the bottom pane of the Computer Management window, locate the new disk you just created. Right-click the area where Unallocated appears, and then click New Partition.
5. Follow the steps in the New Partition Wizard to:
· Create a primary boot partition, using the default value.
· Specify partition size. Accept the default value, which have to larger than the size your master image you created the OS image files after clone.
· Assign a drive letter. For example K:\> , or change if needed).
· Specify the file system. Accept the default value, NTFS.
· Format the partition by selecting Perform a quick format.
6 Click Next, and then click Finish.
Depending on the size of the disk, it may take a few minutes to format the drive.
7 Right-click the new volume, and then click Mark Partition as Active.
You should now have a drive with a drive letter(k:\>), ready to receive your image. 

STEP 4: Copy the Master Image to the SDI File/Mounted Drive
At this stage, you are using the SDI file you created as a mounted drive. It appears in My Computer as a drive, and you can add files to it. The SDI file will only be used to store your master image. After you copy the image to the mounted drive, you can dismount the drive so that it is just a file that you can move or copy.
To complete the SDI file and dismount the drive
1. Locate the folder or drive that contains your master image (for example, C:\master image\ ), and copy the contents (Master Image)of that folder to the disk drive you just created (For example K:\).
Note. If you get a Confirm Folder Replace dialog box, click Yes to replace the existing System Volume Information folder (on the new virtual disk) with the version you are copying from your master image.
If you can’t replace Volume Information folder, set the authority of folder, or you don’t need to copy it.
2. To create a new SDI image,
For example: cscript sdimgr /new c:\recovery.sdi
3. To write the master image to new sdi file
For example: cscript sdimgr c:\recovery.sdi /readpart:k:
4. To mounted SDI disk drive
Note
Dismount the disk from your computer in one of the following ways:
On the Start menu, click All Programs, point to Microsoft Windows Embedded Studio, and then click SDI Loader. Select the image you want to remove, and then click Remove Disk.
For example, click C:\Deploy.sdi, and then click Remove Disk. Doing so removes it as a mapped drive. Now you can move or copy it as a file.
-or-
In the Taskbar notification area, right-click the Safely Remove Hardware icon to dismount the SDI file

Step 5: Copy the SDI file, Windows PE, and SDIMGR.WSF Tool to a Working Folder
Note. Choose Your Windows PE Options
Regardless of which version of Windows PE you use on your recovery CD, you must use the Windows PE Toolkit or OEM Preinstall Kit (OPK) for the final steps that precede actually burning the CD. When creating the .iso file, which is the image file of the entire CD, you must use the oscdimg tool and etfsboot.com. These are only available in the Windows PE toolkit or the OPK. Oscdimg.exe creates the .iso file, and etfsboot.com creates the CD boot sector. If you use other software to create the .iso image, the CD will not boot. Once you have created the .iso file, you can burn the CD with any software that burns an ISO-9660 compliant image.
Windows PE is available in the following two forms:
· Self-contained version
Windows PE is supplied on Windows XP Embedded CD-ROM Disc 1, or a separate Windows PE disc, depending on whether you have the Full Price Product or the Upgrade Product. In this form, it can be used as a boot disc to perform many development tasks. You can also include it on a recovery CD, deployment disc, or field upgrade disc, along with SDI, to enable installation and deployment of the SDI image.
To use this version in your CD-ROM or Deployment, you will copy the entire I386 folder (the folder and folder name) from Windows XP Embedded CD-ROM Disc 1.
· Customizable version
You may also create your own customized version of Windows PE with a separately licensed Windows PE toolkit, or with the Windows PE tools included in the OPK.
To create a customizable version, follow the instructions in the Windows PE Help, provided with the Windows PE toolkit and the OPK.
In either form, there are specific licensing restrictions governing the use of and redistribution of Windows PE. For more information, see the appropriate license that accompanies your version.
Once you have created your image file, and chosen or customized a version of Windows PE, you can assemble your recovery disc components.
1. Create a new working folder on your development computer.
For example, create a folder named "Working."
2. Copy Windows PE to the Working folder in one of the following ways:
Insert your Windows XP Embedded disc 1 into your computer, and copy the following to the Working folder:
· I386 folder
· win51 file
· win51ip file
· win51ip.SP2 file
· winbom.ini
-or-
Copy your custom version of Windows PE to the Working folder.
3. Copy sdimgr.wsf from the Windows Embedded\utilities folder to the Working folder.
For example, if C:\ is your primary drive on your development computer, then sdimgr.wsf should be located in C:\Program Files\Windows Embedded\utilities.
4. From the I386\SYSTEM32 folder of your Windows PE disc, copy sdiaut.dll to the Working folder.
5. Copy recovery.sdi to working folder:
6. Copy any additional files you need to the Working folder, such as installation instructions or additional files you want to install outside of the image contained in the SDI file.
When you have copied all of the necessary files to the Working folder, it should look something like this:




STEP6 (Option, if you want to manual CD boot, you can omit this step): Configure the CD Boot process to Auto install the image
Add some scripts to i386\system32\starnet.cmd
call oc.bat
regsvr32 sdiaut.dll
cd\
cscript sdimgr.wsf recovery.sdi /writepart:c: /yes
Exit

Note. WinPE does not support scripting by default and needs to have a script file run to enable these features. The file is located in the WinPE folder and is called BUILDOPTIONALCOMPONENTS.VBSOnce this was complete a batch file (oc.bat) needs to be entered into startnet.cmd and then you can run scripts by using cscript sdimgr.wsf recovery.sdi /writepart:c: /yes

STEP 7: Create a Bootable CD
Once you have all of the files together in the working folder, you can create an .iso file and burn that file to a CD. To burn the CD, you need software that burns an ISO-9660 compliant image.
Note You must use oscdimg.exe and etfsboot.com to create the .iso file. These are only available in the Windows PE toolkit or the OPK. Oscdimg.exe creates the .iso file, and etfsboot.com creates the CD boot sector. If you use other software to create the .iso image, the CD will not boot.
1. Create a new winpe folder on your development computer.
2. Copy the OPK/Windows PE Toolkit utility under WINPE folder to WinPE foloder
3. To create an .iso file with the OPK/Windows PE Toolkit oscdimg utility
C:\winPE\>Oscdimg –h –n –o –m –bETFSBoot.com C:\ working C:\ working.iso
Note. Locate the winpe.chm help file provided with the OPK and Windows PE Toolkit.
Search for the topic "Creating a Customizable Windows PE Image" and/or "Creating a Custom Windows PE CD." 

STEP 8: Burn the .iso file, Duplicate Your Recovery CD, and Distribute with Installation Instructions
Once you have created the .iso file, you can burn to the CD with any software that burns an ISO-9660 compliant image.
Once you have a flawless CD, you can duplicate the CD and distribute it with installation instructions. Depending on how you intend to use the CD, your instructions should explain how to use it for recovery, deployment, or field upgrade.
Your instructions may be as simple as telling the user to insert the CD in the target device, boot, let it run its course, and remove the CD when prompted to reboot. You may want to create a batch file to automatically register the sdiaut.dll and run sidmgr.wsf. You may also want to include post-install instructions for when the device restarts in its new image.

STEP 9: (Option, if you already set auto CD boot, you can omit this step): Boot the Device with the CD, and Install the Image
Note. Make sure the target device is configured to allow booting from CD-ROM. Usually this is specified in the target device's BIOS.
Step by Step install the image
1. Start the target device with the recovery CD-ROM in the CD drive.
The device starts in Windows PE and provides a command prompt, at drive X:.
2. At the command prompt, type:
regsvr32 sdiaut.dll
This registers the SDI Manager.
3. Change directories to the location of your SDI file, and then type:
Cscript sdimgr.wsf recovery.sdi /writepart:c: /yes
This tells SDI Manager to write the DISK blob from the SDI file "recovery.sdi" to the physical drive 0. The /yes switch prevents the accidental erasure of data on the drive. Otherwise, the disk writing operation erases all data.
SDI Manager writes the image to disk, and a message similar to the following appears:
*Writing to disk :"\\.\PhysicalDrive0"...
4 When a message appears that the writing is complete, exit Windows PE, remove the CD-ROM, and restart the computer.
5 Test the run-time image on the device. Troubleshoot as needed until you have an image that installs from a burned CD and runs correctly.







沒有留言:

張貼留言