ATT8231: Creating a Customized USB Thumb Drive for ZCM Imaging Methods for creating a customized bootable USB Thumb Drive Rich Hanley Senior ATT Engineer rhanley@novell.com
Objectives Understanding ZCM 11 SP3 USB Imaging Support Using the ZENUsbcreator Utility Creating a Custom USB Thumb Drive for ZCM Imaging 2
Understanding ZCM 11 SP3 USB Imaging Support
Understanding ZCM 11 SP3 USB Imaging Support Previous versions of ZCM never officially supported booting the ZCM Imaging Distro from USB Thumb Drive Could be done but involved using Open Source unsupported code, such as: Unetbootin, the Syslinux Project s ISOLINUX ZCM 11 SP3 offers a supported way to generate a bootable USB Thumb Drive for the ZCM Imaging Distro Any thumb drive supported by the SLES 11 SP3 kernel is supported Requires that you only use a Novell supported utility to generate the bootable USB Thumb Drive 4
Understanding ZCM 11 SP3 USB Imaging Support (continued) Process to build a default version of the ZCM Imaging Distro on a USB Thumb Drive is very straightforward! Burn either the bootcd.iso or bootcd_tntfs.iso to a CD / DVD Boot up a machine using that CD / DVD Select Manual Mode to get to the bash prompt Insert your USB Thumb Drive into the machine Run ZENUsbcreator Case is significant for the command name! And that s all it takes! 5
Understanding ZCM 11 SP3 USB Imaging Support (continued) ZENUsbcreator must be run from the CD-based ZCM Imaging Distro Burn bootcd.iso or bootcd_tntfs.iso to a CD / DVD ISOs can be found - On Linux Primary: /opt/novell/zenworks/preboot/bin/winutils On Windows Primary: c:\program Files (x86)\novell\zenworks\bin\preboot Remember that: bootcd.iso contains only the Legacy NTFS File System Driver You must use the bootcd_tntfs.iso if you want to use the Tuxera NTFS High Performance File System Driver on your USB Thumb Drive Injecting the Tuxera Driver into the ZCM Imaging Distro using the ZCC creates bootcd_tntfs.iso 6
Using the ZENUsbcreator Utility
Using the ZENUsbcreator Utility Running ZENUsbcreator Understanding ZENUsbcreator Processing 8
Using the ZENUsbcreator Utility Running ZENUsbcreator Purpose: Create a USB Thumb Drive that can boot the ZCM Imaging Distro on a BIOS or UEFI-based machines Remove all the existing partitions on a thumb drive Upgrade a bootable USB drive Can only be launched from CD / DVD ZENUsbcreator throws an error if its not launched while booted up from the CD / DVD Located in the /bin directory on the CD / DVD ZENUsbcreator is a wrapper program that calls a bash script named ZEN-usb-creator 9
Using the ZENUsbcreator Utility Running ZENUsbcreator Syntax: ZENUsbcreator [--help] 10
Using the ZENUsbcreator Utility Running ZENUsbcreator After choosing one of the previous four options, the available thumb drives to act upon are shown next: 11
Using the ZENUsbcreator Utility Understanding ZENUsbcreator Processing After selecting the thumb drive, you re given a final sanity check : 12
Using the ZENUsbcreator Utility Understanding ZENUsbcreator Processing ZENUsbcreator will create a second partition on the USB Thumb Drive Its an NTFS partition Could be used to store zmg image files on the thumb drive 13
Using the ZENUsbcreator Utility Understanding ZENUsbcreator Processing This is what happens behind the scenes: Initialize the MBR Launch ZENUsbcreator Call the ZEN-usb-creator script Formatting for BIOS or UEFI? BIOS Create a 160MB ext2 Partition 1 NO Booted from CD? Throw An Error YES Get input from user on Operation to perform Detect and Display USB Linux Device Names Get input from user on Linux Device to use UEFI 4 Initialize the GPT Create a 160MB FAT32 Partition Create a NTFS partition on remainder of drive Copy required files to the EFI FAT32 boot partition Create a NTFS partition on remainder of drive Copy required files to ext2 boot partition Create the grub config file 3 2 EXIT ZEN-usb-creator NO Sanity Check: Format Drive? YES Create the grub config file Install grub boot loader Display Success Message 14
Using the ZENUsbcreator Utility Understanding ZENUsbcreator Processing This is what happens behind the scenes: 1 If the variable CDBOOT equals YEScd then the machine is booted up using the ZCM CD-based Imaging Distro 2 Copies contents of boot, addfiles, & dev directories from the CD to USB drive at root. The settings.txt file from CD is copied to USB drive. 3 Creates the menu.lst file under the boot/grub directory. This file does such things as specifying the Initial RAM Drive, root file system, and kernel name. 4 UEFI requires FAT32 support for the EFI System Partition 15
Creating a Custom USB Thumb Drive for ZCM Imaging
Creating a Custom USB Thumb Drive for ZCM Imaging Overview of the process Customizing using the Addfiles Method Customizing by Modifying the CD s System Resource Files (initrd and root) 17
Creating a Custom Thumb Drive for ZCM Imaging Overview Since ZENUsbcreator must be launched when booted from the CD-based version of the ZCM Imaging Distro: Changes made to bootcd.iso or bootcd_tntfs.iso get imparted to USB Thumb Drive when ZENUsbcreator is run from that iso Important: So don t mess with ZENUsbcreator or ZEN-usb-creator (the script) on the modified iso! Methods you can employ to modify the CD-based ZCM Imaging Distro apply equally to USB-based distro Using the Addfiles Method is the easiest Can also modify the CD s System Resource Files (initrd & root) However there is no code in ZENUsbcreator for dealing with a driverupdate file system driverupdate is a CRAMFS file system with a particular directory structure driverupdate can be used to get modifications into the CD-based distro 18
Creating a Custom Thumb Drive for ZCM Imaging Overview of CD boot process you ll modify for USB Thumb Drive creation Control to: zenworks.s script ABCD EFGH ASDF IJKLM A What can be modified on CD for USB Thumb Drive 19
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Addfiles Easiest method to modify bootcd.iso / bootcd_tntfs.iso: Uses the original contents of ISO then your custom content is placed into a special directory. Then you create a new iso. Special directory is named: addfiles Is an empty directory on the original iso files During CD boot process: content of addfiles is added to the RAM drive 20
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Addfiles The addfiles method is the preferred method Great for getting the following in the Imaging Distro: Bash scripts Binary executables Implementing some types of changes to the settings.txt file Not the method to use to add new content into the Imaging distro that must be available during the boot process when the kernel or the init process is in control Example: new device drivers 21
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Addfiles (continued) See Section F.4.1 of the doc available on our web site at: https://www.novell.com/documentation/zenworks113/zen11_cm_preboot_imaging/data/bookinfo.html 1. Mount the desired boot CD iso to a /mnt/bootcd directory 2. Created a working directory under root s home called isolinux 3.Copied all of what s in /mnt/bootcd to the isolinux directory 4. Modified the settings.txt file in the isolinux directory to set: the IP Address for the PROXYADDR variable The value of the IMGCMD variable to the name of a custom script that you copied to the isolinux/addfiles/bin directory If required change netsetup, HostIP, netmask, and gateway for static IP addressing 22
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Addfiles (continued) From Section F.4.1 of the zen11_cm_preboot_imaging.pdf: 5.Use chmod command to make sure settings.txt and your custom scripts are executable 6. Use the mkisofs command to create a new iso file from the source tree in the isolinux directory 23
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Modify System Resource Files This method is the most time consuming Needs to be used when the content you want to add must be available: Right after the kernel mounts the initial RAM drive (initrd) When init is processing When the zenworks.s script itself has control Example use cases Typically used to add custom menu programs Add LAN drivers Requires modifying the initrd file system Customize zenworks.s or the scripts it calls Requires modifying the root file system 24
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Modify System Resource Files From Section F.4.2 of zen11_cm_preboot_imaging.pdf: Modifying the initrd file system: 1. Create a mount and a couple working directories (/work-iso and /work-initrd and /mod-initrd for instance) 2. Mount bootcd or bootcd_tntfs iso to the /work-iso mount point 3. Copy /work-iso/boot/i386/loader/initrd to the /work-initrd directory 4. Rename initrd in /work-initrd to initrd.gz 5. gunzip initrd.gz 6. Change directory to /mod-initrd 7. cpio idmuv < /work-initrd/initrd (/mod-initrd now contains the content of the original initrd file system.) 25
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Modify System Resource Files Modifying the initrd file system (continued): 8. Copy the content you want in the new initrd to the appropriate directories under the /mod-initrd directory (such as bin, usr, or var) 9. rm /work-initrd/initrd (Deletes the original initrd) 10. find. cpio o H newc > /work-initrd/initrd (This pipeline creates the new initrd with your content and puts it in the /work-initrd directory.) 11. Change into the /work-initrd directory 12. gzip v9c initrd > initrd.gz (Creates a new archive of the initrd containing your changes.) 13. Rename initrd.gz to initrd. 26
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Modify System Resource Files Modifying the initrd file system (continued): 14. Copy initrd from the /work-initrd directory into the /workiso/boot/i386/loader directory 15. Use mkisofs to create a new iso file containing your modified initrd file system using the /work-iso directory as the source tree. 27
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Modify System Resource Files Modifying the root file system: 1. Create a mount point (/work-iso) and a working directory under root s home directory (/root/modroot for instance) 2. Mount bootcd or bootcd_tntfs iso to the /work-iso mount point 3. Copy /work-iso/boot/i386/root to root s home directory 4. Change directory to root s home directory (/root) 5. Rename root in root s home directory (/root) to root.gz 6. gunzip root.gz 7. mount o loop root mod-root (Now the modroot in root s home directory has the original contents of root in extracted form.) 28
Creating a Custom Thumb Drive for ZCM Imaging Customization Method: Modify System Resource Files Modifying the root file system (continued): 8. Copy your content to the appropriate directories under the modroot directory 9. umount modroot 10. gzip v9c root > root.gz 11. Rename root.gz to root 12. Copy root in root s home directory to the /workiso/boot/i386/ directory 13. Use the mkisofs command using the /work-iso directory as the source tree to create a new boot CD iso whose root file system contains your changes. 29
Exercises Let s Play!
Important VMware Controls Give focus to a VM by clicking in it When a VMware virtual machine has focus it owns the real keyboard and mouse of the Host machine All keystrokes and cursor movements affect the virtual machine Release focus from a VM by pressing Ctrl+Alt This allows you to switch focus to another VM or launch a program from the Host desktop Use the VMware Toolbar to navigate between VM s or use a particular VM Quick Switch button makes it easy to move from VM to VM Full Screen button resizes VM to full screen Ctrl+Alt exits full screen mode 31
Exercise 1 Task Overview Task To familiarize yourself with the ZENUsbcreator utility. Boot W7-64-WS2 VM up using bootcd_tntfs.iso Boot W7-64-WS2 VM using the Plop Boot Manager Notes Will create a bootable USB Thumb Drive that can boot up the ZCM Imaging Distro: Will use the default bootcd_tntfs.iso file Will use ZENUsbcreator to create a bootable USB Thumb Drive for the ZCM Imaging Distro on the provided USB Thumb Drive. This boot manager (plpbt.iso) will be attached to the VM s Virtual CD and will then allow the VM to be booted from your thumb drive 32
Exercise 2 Task Overview Task Notes Create a modified version of a ZCM Imaging USB Thumb Drive Create new ISO file (usblab2.iso) Boot WS-64-WS2 VM using new usb-lab2.iso file Boot WS-64-WS2 VM using the Plop Boot Manager Will modify bootcd_tntfs.iso file to create a new iso (usb-lab2.iso) used to run ZENUsbcreator. usb-lab2.iso will contain: The zusbc.s script. This script can perform several different types of imaging operations including restoring the DA NSI Standard Base Image from the USB drive The parted, nano, hexedit, and unix2dos utilities that are not native to the ZCM Imaging Distro Will modify the settings.txt file to automatically launch zusbc.s. After booting your modified CD-based version of the ZCM Imaging Distro you ll run ZENUsbcreator to create a bootable thumb drive containing those modifications. Testing new USB Thumb Drive modifications. Plop will allow you to boot up your VM using the thumb drive. Should see the menu displayed by zusbc.s 33
Corporate Headquarters 1800 South, Novell Place Provo, Utah 84606 801.861.7000 (Worldwide) 800.453.1267 (Toll-free) Join us on: www.novell.com 34
This document could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein. These changes may be incorporated in new editions of this document. Novell, Inc. may make improvements in or changes to the software described in this document at any time. Copyright 2014 Novell, Inc. All rights reserved. All Novell marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States. All third-party trademarks are the property of their respective owners.