5 # Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
7 # This program and the accompanying materials
8 # are licensed and made available under the terms and conditions of the BSD License
9 # which accompanies this distribution. The full text of the license may be found at
10 # http://opensource.org/licenses/bsd-license.php
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 # Set up environment at fisrt.
19 if [ -z "$EDK_TOOLS_PATH" ]
21 export BASETOOLS_DIR
=$WORKSPACE/Conf
/BaseToolsSource
/Source
/C
/bin
23 export BASETOOLS_DIR
=$EDK_TOOLS_PATH/Source
/C
/bin
26 export BOOTSECTOR_BIN_DIR
=$WORKSPACE/DuetPkg
/BootSector
/bin
27 export DISK_LABEL
=DUET
28 export PROCESS_MARK
=TRUE
37 echo "Usage: CreateBootDisk [usb|floppy|ide|file] MediaPath DevicePath [FAT12|FAT16|FAT32] [IA32|X64]"
38 echo "e.g. : CreateBootDisk floppy /media/floppy0 /dev/fd0 FAT12 IA32"
50 echo Invalid Architecture string
, should be only IA32 or X64
54 .
$WORKSPACE/DuetPkg
/SetEnv_
$PROCESSOR.sh
55 export BUILD_DIR
=$WORKSPACE/Build
/DuetPkg
$PROCESSOR/DEBUG_
$TOOLCHAIN
58 export EFI_BOOT_MEDIA
=$2
59 export EFI_BOOT_DEVICE
=$3
61 if [ "$PROCESS_MARK" = TRUE
]
67 echo Start to create floppy boot disk ...
68 echo Format
$EFI_BOOT_MEDIA ...
70 umount
$EFI_BOOT_MEDIA
71 mkfs.msdos
$EFI_BOOT_DEVICE
72 mount
$EFI_BOOT_DEVICE $EFI_BOOT_MEDIA
73 echo Create boot sector ...
74 ## Linux version of GenBootSector has not pass build yet.
75 $BASETOOLS_DIR/GnuGenBootSector
-i $EFI_BOOT_DEVICE -o FDBs.com
76 cp $BOOTSECTOR_BIN_DIR/bootsect.com FDBs-1.com
77 $BASETOOLS_DIR/BootSectImage
-g FDBs.com FDBs-1.com
-f
78 $BASETOOLS_DIR/GnuGenBootSector
-o $EFI_BOOT_DEVICE -i FDBs-1.com
80 cp $BUILD_DIR/FV
/Efildr
$EFI_BOOT_MEDIA
82 mkdir
-p $EFI_BOOT_MEDIA/efi
83 mkdir
-p $EFI_BOOT_MEDIA/efi
/boot
86 cp $WORKSPACE/ShellBinPkg
/UefiShell
/Ia32
/Shell.efi
$EFI_BOOT_MEDIA/efi
/boot
/boot
$5.efi
90 cp $WORKSPACE/ShellBinPkg
/UefiShell
/X64
/Shell.efi
$EFI_BOOT_MEDIA/efi
/boot
/boot
$5.efi
97 echo "Wrong FAT type $4 for floppy!"
104 echo "Start to create file boot disk ..."
105 dd bs
=512 count
=2880 if=/dev
/zero of
=$EFI_BOOT_MEDIA
106 mkfs.msdos
-F 12 $EFI_BOOT_MEDIA
108 mcopy
-i $EFI_BOOT_MEDIA $BUILD_DIR/FV
/Efildr
::/Efildr
109 mmd
-i $EFI_BOOT_MEDIA ::/efi
::/efi
/boot
112 mcopy
-i $EFI_BOOT_MEDIA $WORKSPACE/ShellBinPkg
/UefiShell
/Ia32
/Shell.efi
::/efi
/boot
/boot
$5.efi
115 mcopy
-i $EFI_BOOT_MEDIA $WORKSPACE/ShellBinPkg
/UefiShell
/X64
/Shell.efi
::/efi
/boot
/boot
$5.efi
119 mdir
-i $EFI_BOOT_MEDIA -s ::
121 ## Linux version of GenBootSector has not pass build yet.
122 $BASETOOLS_DIR/GnuGenBootSector
-i $EFI_BOOT_MEDIA -o $EFI_BOOT_MEDIA.bs0
123 cp $BOOTSECTOR_BIN_DIR/bootsect.com
$EFI_BOOT_MEDIA.bs1
124 $BASETOOLS_DIR/BootSectImage
-g $EFI_BOOT_MEDIA.bs0
$EFI_BOOT_MEDIA.bs1
125 $BASETOOLS_DIR/GnuGenBootSector
-o $EFI_BOOT_MEDIA -i $EFI_BOOT_MEDIA.bs1
126 rm $EFI_BOOT_MEDIA.bs
[0-1]
129 echo "Wrong FAT type" $4 "for floppy!"
139 cp $BUILD_DIR/FV
/Efildr16
$EFI_BOOT_MEDIA
140 mkdir
$EFI_BOOT_MEDIA/efi
/boot
143 cp $WORKSPACE/ShellBinPkg
/UefiShell
/Ia32
/Shell.efi
$EFI_BOOT_MEDIA/efi
/boot
/boot
$5.efi
147 cp $WORKSPACE/ShellBinPkg
/UefiShell
/X64
/Shell.efi
$EFI_BOOT_MEDIA/efi
/boot
/boot
$5.efi
154 echo Format
$EFI_BOOT_DEVICE ...
156 echo Create boot sector ...
157 ## Linux version of GenBootSector & Bootsectimage has not pass build yet.
158 $BASETOOLS_DIR/GnuGenBootSector
-i $EFI_BOOT_DEVICE -o UsbBs16.com
159 cp $BOOTSECTOR_BIN_DIR/bs16.com Bs16-1.com
160 $BASETOOLS_DIR/BootSectImage
-g UsbBs16.com Bs16-1.com
-f
161 $BASETOOLS_DIR/GnuGenBootSector
-o $EFI_BOOT_DEVICE -i Bs16-1.com
163 $BASETOOLS_DIR/GnuGenBootSector
-m -o $EFI_BOOT_DEVICE -i $BOOTSECTOR_BIN_DIR/Mbr.com
165 echo PLEASE UNPLUG USB
, THEN PLUG IT AGAIN TO DO STEP2
!
167 elif [ "$4" = FAT32
]
171 cp $BUILD_DIR/FV
/Efildr20
$EFI_BOOT_MEDIA
172 mkdir
$EFI_BOOT_MEDIA/efi
/boot
175 cp $WORKSPACE/ShellBinPkg
/UefiShell
/Ia32
/Shell.efi
$EFI_BOOT_MEDIA/efi
/boot
/boot
$5.efi
179 cp $WORKSPACE/ShellBinPkg
/UefiShell
/X64
/Shell.efi
$EFI_BOOT_MEDIA/efi
/boot
/boot
$5.efi
186 echo Format
$EFI_BOOT_DEVICE ...
188 echo Create boot sector ...
189 ## Linux version of GenBootSector & Bootsectimage has not pass build yet.
190 $BASETOOLS_DIR/GnuGenBootSector
-i $EFI_BOOT_DEVICE -o UsbBs32.com
191 cp $BOOTSECTOR_BIN_DIR/bs32.com Bs32-1.com
192 $BASETOOLS_DIR/BootSectImage
-g UsbBs32.com Bs32-1.com
-f
193 $BASETOOLS_DIR/GnuGenBootSector
-o $EFI_BOOT_DEVICE -i Bs32-1.com
195 $BASETOOLS_DIR/GnuGenBootSector
-m -o $EFI_BOOT_DEVICE -i $BOOTSECTOR_BIN_DIR/Mbr.com
197 echo PLEASE UNPLUG USB
, THEN PLUG IT AGAIN TO DO STEP2
!
200 echo "Wrong FAT type $1 for floppy!"
206 echo "Not support yet!"
209 echo "Arg1 should be [floppy | file | usb | ide] !"