]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/CreateBootDisk.sh
Using sizeof(EFO_BLOCK_IO_MEDIA) replace Macro.
[mirror_edk2.git] / DuetPkg / CreateBootDisk.sh
1 #! /bin/sh
2
3 # Set up environment at fisrt.
4 export BUILD_DIR=$WORKSPACE/Build/DuetPkg/DEBUG_UNIXGCC
5 export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin
6 export DISK_LABEL=DUET
7 export PROCESS_MARK=TRUE
8
9 if [ \
10 -z "$*" -o \
11 "$*" = "-?" -o \
12 "$*" = "-h" -o \
13 "$*" = "--help" \
14 ]
15 then
16 echo "Usage: CreateBootDisk [usb|floppy|ide] MediaPath DevicePath [FAT12|FAT16|FAT32]"
17 echo "e.g. : CreateBootDisk floppy /media/floppy0 /dev/fd0 FAT12 "
18 PROCESS_MARK=FALSE
19 fi
20
21 export EFI_BOOT_MEDIA=$2
22 export EFI_BOOT_DEVICE=$3
23
24 if [ "$PROCESS_MARK" = TRUE ]
25 then
26 case "$1" in
27 floppy)
28 if [ "$4" = FAT12 ]
29 then
30 echo Start to create floppy boot disk ...
31 echo Format $EFI_BOOT_MEDIA ...
32 ## Format floppy disk
33 umount $EFI_BOOT_MEDIA
34 mkfs.msdos $EFI_BOOT_DEVICE
35 mount $EFI_BOOT_DEVICE $EFI_BOOT_MEDIA
36 echo Create boot sector ...
37 ## Linux version of GenBootSector has not pass build yet.
38 $BASETOOLS_DIR/GnuGenBootSector -i $EFI_BOOT_DEVICE -o FDBs.com
39 $BASETOOLS_DIR/BootSectImage -g FDBs.com $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/bootsect.com -f
40 $BASETOOLS_DIR/GnuGenBootSector -o $EFI_BOOT_DEVICE -i $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/bootsect.com
41
42 cp $BUILD_DIR/FV/Efildr $EFI_BOOT_MEDIA
43
44 mkdir -p $EFI_BOOT_MEDIA/efi
45 mkdir -p $EFI_BOOT_MEDIA/efi/boot
46
47 cp $WORKSPACE/EdkShellBinPkg/Bin/Ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi
48
49 echo Done.
50 else
51 echo "Wrong FAT type $4 for floppy!"
52 fi
53 ;;
54
55 file) # CreateFile
56 if [ "$4" = FAT12 ]
57 then
58 echo "Start to create file boot disk ..."
59 echo Create boot sector ...
60
61 ## Linux version of GenBootSector has not pass build yet.
62 $BASETOOLS_DIR/GnuGenBootSector -i $EFI_BOOT_MEDIA -o FDBs.com
63 $BASETOOLS_DIR/BootSectImage -g FDBs.com $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Bootsect.com -f
64 $BASETOOLS_DIR/GnuGenBootSector -o $EFI_BOOT_MEDIA -i $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Bootsect.com
65 echo Done.
66 else
67 echo "Wrong FAT type" $4 "for floppy!"
68 fi
69 ;;
70
71 usb) # CreateUsb
72
73 if [ "$4" = FAT16 ]
74 then
75 if [ "$5" = step2 ]
76 then
77 cp $BUILD_DIR/FV/Efildr16 $EFI_BOOT_MEDIA
78 mkdir $EFI_BOOT_MEDIA/efi/boot
79 cp $WORKSPACE/EdkShellBinPkg/bin/ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi
80 echo "step2 Done!"
81 else
82 echo Format $EFI_BOOT_DEVICE ...
83 #Do format command.
84 echo Create boot sector ...
85 ## Linux version of GenBootSector & Bootsectimage has not pass build yet.
86 $BASETOOLS_DIR/GnuGenBootSector -i $EFI_BOOT_DEVICE -o UsbBs16.com
87 $BASETOOLS_DIR/BootSectImage -g UsbBs16.com $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Bs16.com -f
88 $BASETOOLS_DIR/GnuGenBootSector -o $EFI_BOOT_DEVICE -i $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Bs16.com
89 $BASETOOLS_DIR/GnuGenBootSector -m -o $EFI_BOOT_DEVICE -i $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Mbr.com
90 echo Done.
91 echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN TO DO STEP2!
92 fi
93 elif [ "$4" = FAT32 ]
94 then
95 if [ "$5" = step2 ]
96 then
97 cp $BUILD_DIR/FV/Efildr20 $EFI_BOOT_MEDIA
98 mkdir $EFI_BOOT_MEDIA/efi/boot
99 cp $WORKSPACE/EdkShellBinPkg/bin/ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi
100 echo "step2 Done!"
101 else
102 echo Format $EFI_BOOT_DEVICE ...
103 #Do format command.
104 echo Create boot sector ...
105 ## Linux version of GenBootSector & Bootsectimage has not pass build yet.
106 $BASETOOLS_DIR/GnuGenBootSector -i $EFI_BOOT_DEVICE -o UsbBs32.com
107 $BASETOOLS_DIR/BootSectImage -g UsbBs32.com $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Bs32.com -f
108 $BASETOOLS_DIR/GnuGenBootSector -o $EFI_BOOT_DEVICE -i $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Bs32.com
109 $BASETOOLS_DIR/GnuGenBootSector -m -o $EFI_BOOT_DEVICE -i $BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT/Mbr.com
110 echo Done.
111 echo PLEASE UNPLUG USB, THEN PLUG IT AGAIN TO DO STEP2!
112 fi
113 else
114 echo "Wrong FAT type $1 for floppy!"
115 fi
116
117 ;;
118
119 ide) # CreateIde
120 echo "Not support yet!"
121 ;;
122 *)
123 echo "Arg1 should be [floppy | file | usb | ide] !"
124
125 esac
126 fi