Skip to content

Commit

Permalink
add UEFI support for 64 bit only (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
01micko committed Apr 4, 2016
1 parent 11e41c3 commit ba2a9b8
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 142 deletions.
272 changes: 148 additions & 124 deletions woof-code/3builddistro-Z
Expand Up @@ -2542,134 +2542,158 @@ fi # if BUILD_SFS
#append initrd=initrd.gz pmedia=cd
#timeout 50" > build/isolinux.cfg


WOOF_OUTPUT="woof-output-${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}" #woodenshoe-wi idea. #140619
[ -d ../$WOOF_OUTPUT ] || mkdir -p ../$WOOF_OUTPUT

#build live-cd .iso file...
echo "Now building ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso"
rm -f ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso 2>/dev/null
if [ -f rootfs-complete/usr/lib${lsuffix}/syslinux/isolinux.bin ];then
cp -a rootfs-complete/usr/lib${lsuffix}/syslinux/isolinux.bin build/
else
cp -a ../boot/isolinux.bin build/
fi

case $DISTRO_FILE_PREFIX in #091203
wary) #101026
BOOTLOGO="puppy"
BOOTLABEL="puppy"
#REMOVELINE1='pfix=copy' #100916
REMOVELINE1=''
VERPREFIX="wary "
[ "`echo "$DISTRO_NAME" | grep "Racy"`" != "" ] && VERPREFIX="racy " #110917
;;
racy) #110917
BOOTLOGO="racy-splash" #110928
BOOTLABEL="puppy"
REMOVELINE1=''
VERPREFIX="racy "
;;
sqzd) #110517 squeeze debian
BOOTLOGO="puppy"
BOOTLABEL="puppy"
REMOVELINE1=''
VERPREFIX="squeezed "
;;
drake|drak) #110721
BOOTLOGO="puppy"
BOOTLABEL="puppy"
REMOVELINE1=''
VERPREFIX="drake "
;;
q*) #quirky, qurky, qrky
BOOTLOGO="quirky"
BOOTLABEL="puppy" #"quirky"
#REMOVELINE1='pfix=copy'
VERPREFIX="puppy " #100319
[ "$DISTRO_FILE_PREFIX" = "qret" ] && VERPREFIX="retro " #100514 quirky-retro.
;;
*)
BOOTLOGO="puppy"
BOOTLABEL="puppy"
#REMOVELINE1='pfix=copy' #100916
VERPREFIX=""
;;
esac
#111006 generic mechanism, boot logo for any pup...
[ -f ../boot/boot-dialog/${DISTRO_FILE_PREFIX}-splash.gif ] && BOOTLOGO="${DISTRO_FILE_PREFIX}-splash"
blPATTERN="s%BOOTLABEL%${BOOTLABEL}%"
namePATTERN="s/DISTRO_NAME/${DISTRO_NAME}/"
verPATTERN="s/DISTRO_VERSION/${DISTRO_VERSION}/"
prefixPATTERN="s/DISTRO_FILE_PREFIX/${DISTRO_FILE_PREFIX}/"
sed -e "$namePATTERN" -e "$verPATTERN" -e "$prefixPATTERN" -e "$blPATTERN" ../boot/boot-dialog/help.msg > build/help.msg
if [ "$REMOVELINE1" != "" ];then
grep -v "$REMOVELINE1" build/help.msg > /tmp/3builddistro-help.msg
mv -f /tmp/3builddistro-help.msg build/help.msg
fi
#100916 second help screen...
sed -e "$namePATTERN" -e "$verPATTERN" -e "$prefixPATTERN" -e "$blPATTERN" ../boot/boot-dialog/help2.msg > build/help2.msg
if [ "$REMOVELINE1" != "" ];then
grep -v "$REMOVELINE1" build/help2.msg > /tmp/3builddistro-help2.msg
mv -f /tmp/3builddistro-help2.msg build/help2.msg
fi

#130515 asked above whether to disable 'pupdesk.flg' mechanism...
if [ "$PUPDESKFLG" != "" ];then
sed -i -e 's%next bootup will force run of Video Wizard: choose alternate driver/settings%next startup type boot param "puppy pfix=nox" to enable run of Video Wizard%' build/help.msg
fi

cp -f ../boot/boot-dialog/boot.msg build/boot.msg
cat ../boot/boot-dialog/isolinux.cfg | sed -e "$blPATTERN" > build/isolinux.cfg
export RGBDEF=/usr/share/X11/rgb.txt
../boot/boot-dialog/textongif.sh ../boot/boot-dialog/${BOOTLOGO}.gif "${VERPREFIX}${RIGHTVER}" > logo.gif
../boot/boot-dialog/gif2lss logo.gif > build/logo.16

#120217 translate early-boot splash screens... (expect building with langpack)
if [ "$DEFAULTLANG" != "en_US" ];then
DEFAULTLANG1="${DEFAULTLANG%_*}" #ex: de
DEFAULTLANG12="${DEFAULTLANG%.*}" #ex: de_DE
SPLASHFILE=""
[ -f ../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG12} ] && SPLASHFILE="../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG12}"
[ ! "$SPLASHFILE" ] && [ -f ../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG1} ] && SPLASHFILE="../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG1}"
if [ "$SPLASHFILE" ];then
#translate boot.msg...
sPTN="/^\[boot.msg\]/,/^$/p" #this is a multi-line block find expression.
CODEBLOCK="`sed -n "$sPTN" ${SPLASHFILE} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
if [ "$CODEBLOCK" ];then
echo "$CODEBLOCK" > /tmp/3builddistro-boot-splash-translation
sed -i -f /tmp/3builddistro-boot-splash-translation build/boot.msg
fi
#translate help.msg...
sPTN="/^\[help.msg\]/,/^$/p" #this is a multi-line block find expression.
CODEBLOCK="`sed -n "$sPTN" ${SPLASHFILE} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
if [ "$CODEBLOCK" ];then
echo "$CODEBLOCK" > /tmp/3builddistro-boot-splash-translation
sed -i -f /tmp/3builddistro-boot-splash-translation build/help.msg
fi
fi
# new 160404 UEFI iso - see support/uefi_cd.sh
UFEI_ISO='no'
if [ "$WOOF_TARGETARCH" = "x86_64" ];then
if [ "$SDFLAG" = "" ];then
echo "Would you like to build an iso image that supports UEFI booting?"
echo "It also supports legacy BIOS booting."
echo "Hit 'y' for yes."
read uiso
case $uiso in
y|Y)UFEI_ISO='yes'
UFLG=-uefi
WOOF_OUTPUT="woof-output-${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}${UFLG}"
;;
esac
fi
fi

#110426 help file for Windows users
CUT2INSERT="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1,2`"
CUT3INSERT="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1,2,3`"
cut2PATTERN="s%CUT2INSERT%${CUT2INSERT}%"
cut3PATTERN="s%CUT3INSERT%${CUT3INSERT}%"
sed -e "$verPATTERN" -e "$prefixPATTERN" -e "$cut2PATTERN" -e "$cut3PATTERN" ../boot/README.HTM > build/README.HTM
# very big 'if'
if [ "$UFEI_ISO" = 'yes' ];then
../support/uefi_cd.sh
else

sync
WOOF_OUTPUT="woof-output-${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}" #woodenshoe-wi idea. #140619
[ -d ../$WOOF_OUTPUT ] || mkdir -p ../$WOOF_OUTPUT

#build live-cd .iso file...
echo "Now building ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso"
rm -f ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso 2>/dev/null
if [ -f rootfs-complete/usr/lib${lsuffix}/syslinux/isolinux.bin ];then
cp -a rootfs-complete/usr/lib${lsuffix}/syslinux/isolinux.bin build/
else
cp -a ../boot/isolinux.bin build/
fi

case $DISTRO_FILE_PREFIX in #091203
wary) #101026
BOOTLOGO="puppy"
BOOTLABEL="puppy"
#REMOVELINE1='pfix=copy' #100916
REMOVELINE1=''
VERPREFIX="wary "
[ "`echo "$DISTRO_NAME" | grep "Racy"`" != "" ] && VERPREFIX="racy " #110917
;;
racy) #110917
BOOTLOGO="racy-splash" #110928
BOOTLABEL="puppy"
REMOVELINE1=''
VERPREFIX="racy "
;;
sqzd) #110517 squeeze debian
BOOTLOGO="puppy"
BOOTLABEL="puppy"
REMOVELINE1=''
VERPREFIX="squeezed "
;;
drake|drak) #110721
BOOTLOGO="puppy"
BOOTLABEL="puppy"
REMOVELINE1=''
VERPREFIX="drake "
;;
q*) #quirky, qurky, qrky
BOOTLOGO="quirky"
BOOTLABEL="puppy" #"quirky"
#REMOVELINE1='pfix=copy'
VERPREFIX="puppy " #100319
[ "$DISTRO_FILE_PREFIX" = "qret" ] && VERPREFIX="retro " #100514 quirky-retro.
;;
*)
BOOTLOGO="puppy"
BOOTLABEL="puppy"
#REMOVELINE1='pfix=copy' #100916
VERPREFIX=""
;;
esac
#111006 generic mechanism, boot logo for any pup...
[ -f ../boot/boot-dialog/${DISTRO_FILE_PREFIX}-splash.gif ] && BOOTLOGO="${DISTRO_FILE_PREFIX}-splash"
blPATTERN="s%BOOTLABEL%${BOOTLABEL}%"
namePATTERN="s/DISTRO_NAME/${DISTRO_NAME}/"
verPATTERN="s/DISTRO_VERSION/${DISTRO_VERSION}/"
prefixPATTERN="s/DISTRO_FILE_PREFIX/${DISTRO_FILE_PREFIX}/"
sed -e "$namePATTERN" -e "$verPATTERN" -e "$prefixPATTERN" -e "$blPATTERN" ../boot/boot-dialog/help.msg > build/help.msg
if [ "$REMOVELINE1" != "" ];then
grep -v "$REMOVELINE1" build/help.msg > /tmp/3builddistro-help.msg
mv -f /tmp/3builddistro-help.msg build/help.msg
fi
#100916 second help screen...
sed -e "$namePATTERN" -e "$verPATTERN" -e "$prefixPATTERN" -e "$blPATTERN" ../boot/boot-dialog/help2.msg > build/help2.msg
if [ "$REMOVELINE1" != "" ];then
grep -v "$REMOVELINE1" build/help2.msg > /tmp/3builddistro-help2.msg
mv -f /tmp/3builddistro-help2.msg build/help2.msg
fi

#130515 asked above whether to disable 'pupdesk.flg' mechanism...
if [ "$PUPDESKFLG" != "" ];then
sed -i -e 's%next bootup will force run of Video Wizard: choose alternate driver/settings%next startup type boot param "puppy pfix=nox" to enable run of Video Wizard%' build/help.msg
fi

cp -f ../boot/boot-dialog/boot.msg build/boot.msg
cat ../boot/boot-dialog/isolinux.cfg | sed -e "$blPATTERN" > build/isolinux.cfg
export RGBDEF=/usr/share/X11/rgb.txt
../boot/boot-dialog/textongif.sh ../boot/boot-dialog/${BOOTLOGO}.gif "${VERPREFIX}${RIGHTVER}" > logo.gif
../boot/boot-dialog/gif2lss logo.gif > build/logo.16

#120217 translate early-boot splash screens... (expect building with langpack)
if [ "$DEFAULTLANG" != "en_US" ];then
DEFAULTLANG1="${DEFAULTLANG%_*}" #ex: de
DEFAULTLANG12="${DEFAULTLANG%.*}" #ex: de_DE
SPLASHFILE=""
[ -f ../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG12} ] && SPLASHFILE="../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG12}"
[ ! "$SPLASHFILE" ] && [ -f ../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG1} ] && SPLASHFILE="../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG1}"
if [ "$SPLASHFILE" ];then
#translate boot.msg...
sPTN="/^\[boot.msg\]/,/^$/p" #this is a multi-line block find expression.
CODEBLOCK="`sed -n "$sPTN" ${SPLASHFILE} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
if [ "$CODEBLOCK" ];then
echo "$CODEBLOCK" > /tmp/3builddistro-boot-splash-translation
sed -i -f /tmp/3builddistro-boot-splash-translation build/boot.msg
fi
#translate help.msg...
sPTN="/^\[help.msg\]/,/^$/p" #this is a multi-line block find expression.
CODEBLOCK="`sed -n "$sPTN" ${SPLASHFILE} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
if [ "$CODEBLOCK" ];then
echo "$CODEBLOCK" > /tmp/3builddistro-boot-splash-translation
sed -i -f /tmp/3builddistro-boot-splash-translation build/help.msg
fi
fi
fi

#110426 help file for Windows users
CUT2INSERT="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1,2`"
CUT3INSERT="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1,2,3`"
cut2PATTERN="s%CUT2INSERT%${CUT2INSERT}%"
cut3PATTERN="s%CUT3INSERT%${CUT3INSERT}%"
sed -e "$verPATTERN" -e "$prefixPATTERN" -e "$cut2PATTERN" -e "$cut3PATTERN" ../boot/README.HTM > build/README.HTM

sync


if [ "$SDFLAG" = "" ];then #120506
$MKISOFS -D -R -o ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ./build/
sync
# 131227 iguleder: made the generated ISO image hybrid, so it can be written to flash drives using dd
isohybrid="$(which isohybrid)"
[ -n "$isohybrid" ] && $isohybrid ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso
CUR_DIR="$PWD"
cd ../${WOOF_OUTPUT}
md5sum ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso > ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso.md5.txt
cd "$CUR_DIR"
if [ "$SDFLAG" = "" ];then #120506
$MKISOFS -D -R -o ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ./build/
sync
# 131227 iguleder: made the generated ISO image hybrid, so it can be written to flash drives using dd
isohybrid="$(which isohybrid)"
[ -n "$isohybrid" ] && $isohybrid ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso
CUR_DIR="$PWD"
cd ../${WOOF_OUTPUT}
md5sum ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso > ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso.md5.txt
cd "$CUR_DIR"
fi
fi #end very big if
if [ "$SDFLAG" = "" ];then
echo
echo "Would you like to burn it to a CD? "
echo -n "ENTER only for yes, or any printable char then ENTER not to: "
Expand All @@ -2692,7 +2716,7 @@ if [ "$SDFLAG" = "" ];then #120506
echo -n "Then hit ENTER key: "
read yayburn
# $CDRECORD $BURNMULTI -data -eject -v speed=4 padsize=300k dev=ATAPI:$CDR ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso
$CDRECORD $BURNMULTI -data -eject -v speed=4 padsize=300k dev=$CDR ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso
$CDRECORD $BURNMULTI -data -eject -v speed=4 padsize=300k dev=$CDR ../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}${UFLG}.iso
sync
eject $CDR
echo "...done"
Expand Down
Binary file added woof-code/support/UEFI/efi.img
Binary file not shown.
Binary file added woof-code/support/UEFI/puppy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added woof-code/support/UEFI/slacko.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added woof-code/support/UEFI/tahr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 64 additions & 18 deletions woof-code/support/uefi_cd.sh
@@ -1,25 +1,63 @@
#!/bin/sh

# efi.img is thanks to jamesbond
# basic CD structure is the same as Fatdog64
# called from 3builddistro-Z
. ../etc/DISTRO_SPECS
. ../DISTRO_SPECS

# make an UEFI iso
mk_iso() {
tmp_isoroot=$1 # input
OUTPUT=$2 # output

mkisofs -iso-level 4 -D -R -o $OUTPUT -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table \
-eltorito-alt-boot -eltorito-platform efi -b efi.img -no-emul-boot "$tmp_isoroot"
isohybrid -u $OUTPUT
}

RESOURCES=`find ../ -type d -name UEFI -maxdepth 2`
ISOLINUX=`find ../sandbox3/rootfs-complete/usr -type f -name 'isolinux.bin' -maxdepth 3`
VESAMENU=`find ../sandbox3/rootfs-complete/usr -type f -name 'vesamenu.c32' -maxdepth 3`
BUILD=../sandbox3/build/
HELP=${BUILD}/help
MSG1=../boot/boot-dialog/help.msg
MSG2=../boot/boot-dialog/help2.msg
BOOTLABEL=puppy
PPMLABEL=`which ppmlabel`
TEXT="-text $DISTRO_VERSION"
GEOM="-x 680 -y 380"
UFLG=-uefi
WOOF_OUTPUT="woof-output-${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}${UFLG}"
[ -d ../$WOOF_OUTPUT ] || mkdir -p ../$WOOF_OUTPUT
OUT=../${WOOF_OUTPUT}/${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}${UFLG}.iso

[ -z "$ISOLINUX" ] && echo "Can't find isolinux" && exit
[ -z "$VESAMENU" ] && echo "Can't find vesamenu" && exit

# custom backdrop
pic=puppy
case ${DISTRO_FILE_PREFIX} in
[Tt]ahr*)pic=tahrpup;;
[Tt]ahr*)pic=tahr;;
[Ss]lacko*)pic=slacko;;
esac

cp -a ${pic}.png build/
cp -a efi.img build/
ISOLINUX=`find ../sandbox3/rootfs-complete/usr -type f -name 'isolinux.bin' -maxdepth 3`
VESAMENU=`find ../sandbox3/rootfs-complete/usr -type f -name 'vesamenu.c32' -maxdepth 3`
cp -a $ISOLINUX build/
cp -a $VESAMENU build/
mkdir -p build/help/
cp -a help.msg build/help/
cp -a help2.msg build/help/

cat > build/grub.cfg <<GRUB
# update and transfer the skeleton files
if [ -n "$PPMLABEL" ];then # label the image with version
pngtopnm < ${RESOURCES}/${pic}.png | \
${PPMLABEL} ${GEOM} ${TEXT} | \
pnmtopng > ${BUILD}/${pic}.png
else
cp -a ${RESOURCES}/${pic}.png $BUILD
fi
cp -a ${RESOURCES}/efi.img $BUILD
cp -a $ISOLINUX $BUILD
cp -a $VESAMENU $BUILD
mkdir -p $HELP
sed -e "s/DISTRO_FILE_PREFIX/${DISTRO_FILE_PREFIX}/g" \
-e "s/BOOTLABEL/${BOOTLABEL}/g"< $MSG1 > $HELP/help.msg
sed "s/BOOTLABEL/${BOOTLABEL}/g" < $MSG2 > $HELP/help2.msg

# construct grub.cfg
cat > ${BUILD}/grub.cfg <<GRUB
insmod png
background_image /${pic}.png
set timeout=10
Expand Down Expand Up @@ -51,8 +89,8 @@ menuentry "Reboot" {
}
GRUB

cat > build/isolinux.cfg <<ISO

# construct isolinux.cfg
cat > ${BUILD}/isolinux.cfg <<ISO
#display help/boot.msg
default $DISTRO_FILE_PREFIX
prompt 1
Expand Down Expand Up @@ -119,7 +157,15 @@ initrd initrd.gz
append pfix=ram,nox
menu label For machines with severe video problems
text help
Start ${DISTRO_FILE_PREFIX} without savefile, without KMS, and launch xorgwizard
Start ${DISTRO_FILE_PREFIX} without savefile, without KMS, and run xorgwizard
to choose video resolutions before starting graphical desktop.
endtext
ISO
ISO

# build the iso
sync
mk_iso $BUILD $OUT
sync
(cd ../$WOOF_OUTPUT
md5sum ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}${UFLG}.iso \
> ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}${UFLG}.iso.md5.txt)

0 comments on commit ba2a9b8

Please sign in to comment.