Re: [PATCH] [libvirt-test-API] Use YABOOT instead of ISOLINUX to create bootable ISO.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/03/2012 05:11 PM, Lin Qing wrote:
Yaboot is the bootloader of PowerPC  (ISOLINUX on AMD64/x86 systems, yaboot on PowerPC),
so should change the yaboot.conf firstly,then use mkiso command  to create bootable ISO.

Signed-off-by: Qing Lin <qinglbj@xxxxxxxxxxxxxxxxxx>
---
 utils/ksiso.sh |   57 ++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/utils/ksiso.sh b/utils/ksiso.sh
index 7cf30fc..8b3186c 100755
--- a/utils/ksiso.sh
+++ b/utils/ksiso.sh
@@ -23,28 +23,41 @@ cp -rf ${boot_iso_dir}/* $custom_iso_dir
 chmod -R 777 ${custom_iso_dir}/*
 umount $boot_iso_dir

-echo "- copy kickstart to custom work directory"
-cp $kscfg $custom_iso_dir
-
-echo "- edit isolinux.cfg and add kickstart entry"
-WORKING_ISO="${custom_iso_dir}/isolinux/isolinux.cfg"
-
-echo "label custom_ks
-  kernel vmlinuz $kernel_args
-  append initrd=initrd.img ks=cdrom:/$kscfg ramdisk_size=20000" >> $WORKING_ISO
-
-# change default boot target and timeout
-DEFAULT_LINE=`cat $WORKING_ISO | grep default | head -1`
-TIMEOUT_LINE=`cat $WORKING_ISO | grep timeout | head -1`
-
-cat $WORKING_ISO | sed "s/${DEFAULT_LINE}/default custom_ks/" | sed "s/${TIMEOUT_LINE}/timeout 5/" > isocfgtmp
-
-mv -f isocfgtmp $WORKING_ISO
-
-# cd to custom_iso_dir, otherwise mkisofs seems to bomb...
-cd $custom_iso_dir
-mkisofs -R -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -o $cwd/$custom_iso .
-
+vlmid=`isoinfo -d -i $boot_iso |grep 'Volume id:'`
+vlmid=${vlmid#"Volume id: "}
+if [ -n "`echo $vlmid|grep ppc`" ];then
+	echo "- edit yaboot.conf and add kickstart entry"
+	WORKING_ISO="${custom_iso_dir}/etc/yaboot.conf"
+	# change timeout and  add kickstart entry
+	TIMEOUT_LINE=`cat $WORKING_ISO | grep timeout | head -1`
+	APPEND_LINE=`cat $WORKING_ISO | grep append | head -1`
+	cat $WORKING_ISO | sed "s#${TIMEOUT_LINE}#timeout=5#" | sed "s#${APPEND_LINE}#append= \"root=live:CDLABEL=$vlmid ks=cdrom:/$kscfg \"#" > isocfgtmp
+	mv -f isocfgtmp $WORKING_ISO
+	cd $custom_iso_dir
+	mkisofs -R -V "$vlmid" -sysid PPC -chrp-boot -U -prep-boot ppc/chrp/yaboot -hfs-bless ppc/mac -no-desktop -allow-multidot -volset 4 -volset-size 1 -volset-seqno 1 -hfs-volid 4 -o $cwd/$custom_iso .
+else
+	echo "- copy kickstart to custom work directory"
+	cp $kscfg $custom_iso_dir
+
+	echo "- edit isolinux.cfg and add kickstart entry"
+	WORKING_ISO="${custom_iso_dir}/isolinux/isolinux.cfg"
+
+	echo "label custom_ks
+	  kernel vmlinuz $kernel_args
+	  append initrd=initrd.img ks=cdrom:/$kscfg ramdisk_size=20000" >> $WORKING_ISO
+
+	# change default boot target and timeout
+	DEFAULT_LINE=`cat $WORKING_ISO | grep default | head -1`
+	TIMEOUT_LINE=`cat $WORKING_ISO | grep timeout | head -1`
+
+	cat $WORKING_ISO | sed "s/${DEFAULT_LINE}/default custom_ks/" | sed "s/${TIMEOUT_LINE}/timeout 5/" > isocfgtmp
+
+	mv -f isocfgtmp $WORKING_ISO
+
+	# cd to custom_iso_dir, otherwise mkisofs seems to bomb...
+	cd $custom_iso_dir
+	mkisofs -R -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -o $cwd/$custom_iso .
+fi
 EXITVAL=$?
 if [ $EXITVAL -ne '0' ] ; then
     echo -e "\n mkisofs exited with $EXITVAL!"
--

    ACK and pushed.
 
    Guannan Ren
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]