Change-Id: I23718c9378240fcc7dc62c261c05f9b45cc8df9a
Reviewed-on: http://photon-jenkins.eng.vmware.com/757
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: suezzelur <anishs@vmware.com>
(cherry picked from commit 40a039df1190eea6ea60a1c344fd57417da0a503)
Reviewed-on: http://photon-jenkins.eng.vmware.com/831
Reviewed-by: Sharath George
| ... | ... |
@@ -62,7 +62,7 @@ cd $BUILD_SCRIPTS_PATH |
| 62 | 62 |
DISK_DEVICE=`losetup --show -f ${PHOTON_IMG_OUTPUT_PATH}/photon-${IMG_NAME}.raw`
|
| 63 | 63 |
|
| 64 | 64 |
echo "Mapping device partition to loop device" |
| 65 |
-kpartx -av $DISK_DEVICE |
|
| 65 |
+kpartx -avs $DISK_DEVICE |
|
| 66 | 66 |
|
| 67 | 67 |
DEVICE_NAME=`echo $DISK_DEVICE|cut -c6- ` |
| 68 | 68 |
|
| ... | ... |
@@ -83,6 +83,8 @@ rm -f $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/etc/shadow.bak
|
| 83 | 83 |
rm -f $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/etc/shadow-
|
| 84 | 84 |
rm -f $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/etc/machine-id
|
| 85 | 85 |
touch $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/etc/machine-id
|
| 86 |
+rm -f $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/etc/fstab
|
|
| 87 |
+echo "/dev/sda2 / ext4 defaults,barrier,noatime,noacl,data=ordered 1 1" >> $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/etc/fstab
|
|
| 86 | 88 |
|
| 87 | 89 |
mount -o bind /proc $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/proc
|
| 88 | 90 |
mount -o bind /dev $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/dev
|
| ... | ... |
@@ -99,16 +101,6 @@ fi |
| 99 | 99 |
|
| 100 | 100 |
if [ $IMG_NAME != "ova" ] && [ $IMG_NAME != "ova_uefi" ] && [ $IMG_NAME != "ova_ovs" ] |
| 101 | 101 |
then |
| 102 |
- #Copy the initrd image |
|
| 103 |
- rm -rf /tmp/initrd* |
|
| 104 |
- rm -rf /tmp/installer |
|
| 105 |
- cp $ISO_MOUNT_FOLDER/isolinux/initrd.img /tmp/initrd.gz |
|
| 106 |
- gunzip /tmp/initrd.gz |
|
| 107 |
- cd /tmp |
|
| 108 |
- cpio -idu < initrd |
|
| 109 |
- cp /tmp/installer/boot/initrd.img* $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME}/boot/
|
|
| 110 |
- rm -rf /tmp/initrd* |
|
| 111 |
- rm -rf /tmp/installer |
|
| 112 | 102 |
cd $BUILD_SCRIPTS_PATH |
| 113 | 103 |
if [ $IMG_NAME = "gce" ] |
| 114 | 104 |
then |
| ... | ... |
@@ -15,11 +15,21 @@ |
| 15 | 15 |
grub_efi_install() |
| 16 | 16 |
{
|
| 17 | 17 |
mkdir $BUILDROOT/boot/efi |
| 18 |
- mkfs.vfat /dev/sda1 |
|
| 19 |
- mount -t vfat /dev/sda1 $BUILDROOT/boot/efi |
|
| 18 |
+ # |
|
| 19 |
+ # if it is a loop device then we should mount the dev mapped boot partition |
|
| 20 |
+ # |
|
| 21 |
+ if [[ $HDD == *"loop"* ]] |
|
| 22 |
+ then |
|
| 23 |
+ BOOT_PARTITION=/dev/mapper/`basename ${HDD}`p1
|
|
| 24 |
+ else |
|
| 25 |
+ BOOT_PARTITION=${HDD}1
|
|
| 26 |
+ fi |
|
| 27 |
+ mkfs.vfat $BOOT_PARTITION |
|
| 28 |
+ mount -t vfat $BOOT_PARTITION $BUILDROOT/boot/efi |
|
| 20 | 29 |
cp boot/unifont.pf2 /usr/share/grub/ |
| 21 |
- grub2-efi-install --target=x86_64-efi --efi-directory=$BUILDROOT/boot/efi --bootloader-id=Boot --root-directory=$BUILDROOT --recheck --debug |
|
| 22 |
- mv $BUILDROOT/boot/efi/EFI/Boot/grubx64.efi $BUILDROOT/boot/efi/EFI/Boot/bootx64.efi |
|
| 30 |
+ grub2-efi-install --target=x86_64-efi --efi-directory=$BUILDROOT/boot/efi --bootloader-id=Boot --root-directory=$BUILDROOT --recheck |
|
| 31 |
+ rm $BUILDROOT/boot/efi/EFI/Boot/grubx64.efi |
|
| 32 |
+ cp efi/bootx64.efi $BUILDROOT/boot/efi/EFI/Boot/bootx64.efi |
|
| 23 | 33 |
umount $BUILDROOT/boot/efi |
| 24 | 34 |
} |
| 25 | 35 |
|
| ... | ... |
@@ -40,20 +50,24 @@ ARCH=$(uname -m) # host architecture |
| 40 | 40 |
[ ${EUID} -eq 0 ] || fail "${PRGNAME}: Need to be root user: FAILURE"
|
| 41 | 41 |
> ${LOGFILE} # clear/initialize logfile
|
| 42 | 42 |
|
| 43 |
-# Check if passing a HHD and partition |
|
| 44 |
-if [ $# -eq 3 ] |
|
| 45 |
- then |
|
| 46 |
- BOOTMODE=$1 |
|
| 47 |
- HDD=$2 |
|
| 48 |
- PARTITION=$3 |
|
| 43 |
+# Check if passing a HDD and partition |
|
| 44 |
+if [ $# -eq 5 ] |
|
| 45 |
+ then |
|
| 46 |
+ BOOTMODE=$1 |
|
| 47 |
+ HDD=$2 |
|
| 48 |
+ ROOT_PARTITION_PATH=$3 |
|
| 49 |
+ BOOT_PARTITION_PATH=$4 |
|
| 50 |
+ BOOT_DIRECTORY=$5 |
|
| 49 | 51 |
fi |
| 50 | 52 |
|
| 51 | 53 |
# |
| 52 |
-# Install grub2. |
|
| 54 |
+# Install grub2. |
|
| 53 | 55 |
# |
| 56 |
+UUID=$(blkid -s UUID -o value $ROOT_PARTITION_PATH) |
|
| 57 |
+BOOT_UUID=$(blkid -s UUID -o value $BOOT_PARTITION_PATH) |
|
| 54 | 58 |
echo "Changing boot loader to MBR type on raw disk" |
| 59 |
+ |
|
| 55 | 60 |
sgdisk -m 1:2 "$HDD" |
| 56 |
-UUID=$(blkid -s UUID -o value $PARTITION) |
|
| 57 | 61 |
|
| 58 | 62 |
grubInstallCmd="" |
| 59 | 63 |
mkdir -p $BUILDROOT/boot/grub2 |
| ... | ... |
@@ -64,10 +78,11 @@ if [ -z $grubInstallCmd ]; then |
| 64 | 64 |
echo "Unable to find grub install command" |
| 65 | 65 |
exit 1 |
| 66 | 66 |
fi |
| 67 |
- |
|
| 67 |
+echo "Current directory is" |
|
| 68 |
+pwd |
|
| 68 | 69 |
cp boot/unifont.pf2 ${BUILDROOT}/boot/grub2/
|
| 69 | 70 |
mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
|
| 70 |
-cp boot/splash.tga ${BUILDROOT}/boot/grub2/themes/photon/photon.tga
|
|
| 71 |
+cp boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
|
|
| 71 | 72 |
cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
|
| 72 | 73 |
cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
|
| 73 | 74 |
|
| ... | ... |
@@ -149,11 +164,11 @@ menuentry 'GNU/Linux' --class gnu-linux --class gnu --class os $menuentry_id_opt |
| 149 | 149 |
else |
| 150 | 150 |
search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER |
| 151 | 151 |
fi |
| 152 |
- echo 'Loading Linux 4.2.0 ...' |
|
| 153 |
- linux /boot/vmlinuz-4.2.0 root=/dev/sda2 ro console=ttyS0,38400n8 |
|
| 152 |
+ echo 'Loading Linux 4.4.7 ...' |
|
| 153 |
+ linux /boot/vmlinuz-4.4.7 root=/dev/sda2 ro console=ttyS0,38400n8 |
|
| 154 | 154 |
} |
| 155 | 155 |
submenu 'Advanced options for GNU/Linux' $menuentry_id_option 'gnulinux-advanced-UUID_PLACEHOLDER' {
|
| 156 |
- menuentry 'GNU/Linux, with Linux 4.2.0' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-advanced-UUID_PLACEHOLDER' {
|
|
| 156 |
+ menuentry 'GNU/Linux, with Linux 4.4.7' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.7-advanced-UUID_PLACEHOLDER' {
|
|
| 157 | 157 |
load_video |
| 158 | 158 |
set gfxpayload=keep |
| 159 | 159 |
insmod gzio |
| ... | ... |
@@ -165,10 +180,10 @@ submenu 'Advanced options for GNU/Linux' $menuentry_id_option 'gnulinux-advanced |
| 165 | 165 |
else |
| 166 | 166 |
search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER |
| 167 | 167 |
fi |
| 168 |
- echo 'Loading Linux 4.2.0 ...' |
|
| 169 |
- linux /boot/vmlinuz-4.2.0 root=/dev/sda2 ro console=ttyS0,38400n8 |
|
| 168 |
+ echo 'Loading Linux 4.4.7 ...' |
|
| 169 |
+ linux /boot/vmlinuz-4.4.7 root=/dev/sda2 ro console=ttyS0,38400n8 |
|
| 170 | 170 |
} |
| 171 |
- menuentry 'GNU/Linux, with Linux 4.2.0 (recovery mode)' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-recovery-UUID_PLACEHOLDER' {
|
|
| 171 |
+ menuentry 'GNU/Linux, with Linux 4.4.7 (recovery mode)' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.7-recovery-UUID_PLACEHOLDER' {
|
|
| 172 | 172 |
load_video |
| 173 | 173 |
set gfxpayload=keep |
| 174 | 174 |
insmod gzio |
| ... | ... |
@@ -180,8 +195,8 @@ submenu 'Advanced options for GNU/Linux' $menuentry_id_option 'gnulinux-advanced |
| 180 | 180 |
else |
| 181 | 181 |
search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER |
| 182 | 182 |
fi |
| 183 |
- echo 'Loading Linux 4.2.0 ...' |
|
| 184 |
- linux /boot/vmlinuz-4.2.0 root=/dev/sda2 ro single console=ttyS0,38400n8 |
|
| 183 |
+ echo 'Loading Linux 4.4.7 ...' |
|
| 184 |
+ linux /boot/vmlinuz-4.4.7 root=/dev/sda2 ro single console=ttyS0,38400n8 |
|
| 185 | 185 |
} |
| 186 | 186 |
} |
| 187 | 187 |
|
| ... | ... |
@@ -15,11 +15,21 @@ |
| 15 | 15 |
grub_efi_install() |
| 16 | 16 |
{
|
| 17 | 17 |
mkdir $BUILDROOT/boot/efi |
| 18 |
- mkfs.vfat /dev/sda1 |
|
| 19 |
- mount -t vfat /dev/sda1 $BUILDROOT/boot/efi |
|
| 18 |
+ # |
|
| 19 |
+ # if it is a loop device then we should mount the dev mapped boot partition |
|
| 20 |
+ # |
|
| 21 |
+ if [[ $HDD == *"loop"* ]] |
|
| 22 |
+ then |
|
| 23 |
+ BOOT_PARTITION=/dev/mapper/`basename ${HDD}`p1
|
|
| 24 |
+ else |
|
| 25 |
+ BOOT_PARTITION=${HDD}1
|
|
| 26 |
+ fi |
|
| 27 |
+ mkfs.vfat $BOOT_PARTITION |
|
| 28 |
+ mount -t vfat $BOOT_PARTITION $BUILDROOT/boot/efi |
|
| 20 | 29 |
cp boot/unifont.pf2 /usr/share/grub/ |
| 21 |
- grub2-efi-install --target=x86_64-efi --efi-directory=$BUILDROOT/boot/efi --bootloader-id=Boot --root-directory=$BUILDROOT --recheck --debug |
|
| 22 |
- mv $BUILDROOT/boot/efi/EFI/Boot/grubx64.efi $BUILDROOT/boot/efi/EFI/Boot/bootx64.efi |
|
| 30 |
+ grub2-efi-install --target=x86_64-efi --efi-directory=$BUILDROOT/boot/efi --bootloader-id=Boot --root-directory=$BUILDROOT --recheck |
|
| 31 |
+ rm $BUILDROOT/boot/efi/EFI/Boot/grubx64.efi |
|
| 32 |
+ cp efi/bootx64.efi $BUILDROOT/boot/efi/EFI/Boot/bootx64.efi |
|
| 23 | 33 |
umount $BUILDROOT/boot/efi |
| 24 | 34 |
} |
| 25 | 35 |
|
| ... | ... |
@@ -31,6 +41,7 @@ grub_mbr_install() |
| 31 | 31 |
set -o errexit # exit if error...insurance ;) |
| 32 | 32 |
set -o nounset # exit if variable not initalized |
| 33 | 33 |
set +h # disable hashall |
| 34 |
+set -x |
|
| 34 | 35 |
PRGNAME=${0##*/} # script name minus the path
|
| 35 | 36 |
source config.inc # configuration parameters |
| 36 | 37 |
source function.inc # commonn functions |
| ... | ... |
@@ -40,18 +51,22 @@ ARCH=$(uname -m) # host architecture |
| 40 | 40 |
[ ${EUID} -eq 0 ] || fail "${PRGNAME}: Need to be root user: FAILURE"
|
| 41 | 41 |
> ${LOGFILE} # clear/initialize logfile
|
| 42 | 42 |
|
| 43 |
-# Check if passing a HHD and partition |
|
| 44 |
-if [ $# -eq 3 ] |
|
| 45 |
- then |
|
| 46 |
- BOOTMODE=$1 |
|
| 47 |
- HDD=$2 |
|
| 48 |
- PARTITION=$3 |
|
| 43 |
+# Check if passing a HDD and partition |
|
| 44 |
+if [ $# -eq 5 ] |
|
| 45 |
+ then |
|
| 46 |
+ BOOTMODE=$1 |
|
| 47 |
+ HDD=$2 |
|
| 48 |
+ ROOT_PARTITION_PATH=$3 |
|
| 49 |
+ BOOT_PARTITION_PATH=$4 |
|
| 50 |
+ BOOT_DIRECTORY=$5 |
|
| 49 | 51 |
fi |
| 50 | 52 |
|
| 51 | 53 |
# |
| 52 | 54 |
# Install grub2. |
| 53 | 55 |
# |
| 54 |
-UUID=$(blkid -s UUID -o value $PARTITION) |
|
| 56 |
+UUID=$(blkid -s UUID -o value $ROOT_PARTITION_PATH) |
|
| 57 |
+BOOT_UUID=$(blkid -s UUID -o value $BOOT_PARTITION_PATH) |
|
| 58 |
+ |
|
| 55 | 59 |
|
| 56 | 60 |
grubInstallCmd="" |
| 57 | 61 |
mkdir -p $BUILDROOT/boot/grub2 |
| ... | ... |
@@ -72,7 +87,7 @@ fi |
| 72 | 72 |
|
| 73 | 73 |
cp boot/unifont.pf2 ${BUILDROOT}/boot/grub2/
|
| 74 | 74 |
mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
|
| 75 |
-cp boot/splash.tga ${BUILDROOT}/boot/grub2/themes/photon/photon.tga
|
|
| 75 |
+cp boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
|
|
| 76 | 76 |
cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
|
| 77 | 77 |
cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
|
| 78 | 78 |
cat > "$BUILDROOT"/boot/grub2/grub.cfg << "EOF" |
| ... | ... |
@@ -85,6 +100,7 @@ loadfont /boot/grub2/unifont.pf2 |
| 85 | 85 |
insmod gfxterm |
| 86 | 86 |
insmod vbe |
| 87 | 87 |
insmod tga |
| 88 |
+insmod png |
|
| 88 | 89 |
|
| 89 | 90 |
set gfxmode="640x480" |
| 90 | 91 |
gfxpayload=keep |
| ... | ... |
@@ -96,7 +112,7 @@ set theme=/boot/grub2/themes/photon/theme.txt |
| 96 | 96 |
menuentry "Photon" {
|
| 97 | 97 |
insmod ext2 |
| 98 | 98 |
insmod part_gpt |
| 99 |
- linux /boot/vmlinuz-4.2.0 init=/lib/systemd/systemd root=UUID=UUID_PLACEHOLDER loglevel=3 ro |
|
| 99 |
+ linux /boot/vmlinuz-4.4.7 init=/lib/systemd/systemd root=UUID=UUID_PLACEHOLDER loglevel=7 ro |
|
| 100 | 100 |
initrd /boot/initrd.img-no-kmods |
| 101 | 101 |
} |
| 102 | 102 |
# End /boot/grub2/grub.cfg |
| ... | ... |
@@ -36,7 +36,7 @@ mv $PHOTON_IMG_OUTPUT_PATH/temp/photon-ova-$PHOTON_RELEASE_VER-$PHOTON_BUILD_NUM |
| 36 | 36 |
cd $PHOTON_IMG_OUTPUT_PATH |
| 37 | 37 |
rm -rf photon-custom |
| 38 | 38 |
DISK_DEVICE=`losetup --show -f ${PHOTON_IMG_OUTPUT_PATH}/photon-ova.raw`
|
| 39 |
-kpartx -av $DISK_DEVICE |
|
| 39 |
+kpartx -avs $DISK_DEVICE |
|
| 40 | 40 |
|
| 41 | 41 |
DEVICE_NAME=`echo $DISK_DEVICE|cut -c6- ` |
| 42 | 42 |
|