diff --git a/share/live/arm.tmpl b/share/live/arm.tmpl new file mode 100644 index 00000000..bf6eef95 --- /dev/null +++ b/share/live/arm.tmpl @@ -0,0 +1,79 @@ +<%page args="kernels, runtime_img, runtime_base, basearch, outroot, arch"/> +<% +configdir="tmp/config_files/uboot" +PXEBOOTDIR="images/pxeboot" +BOOTDIR="boot" +KERNELDIR=PXEBOOTDIR +LIVEDIR="LiveOS" + +# different platforms use different kernel load addresses. +# include a 'baseline' kernel for no 'flavor'. +kernelAddress = { 'baseline' : '0x00008000', + 'highbank' : '0x00008000', + 'imx' : '0x90008000', + 'kirkwood' : '0x00008000', + 'mvebu' : '0x00008000', + 'omap' : '0x80008000', + 'tegra' : '0x00008000', + } +%> + +mkdir ${LIVEDIR} +install ${runtime_img} ${LIVEDIR}/squashfs.img +treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img + +## install kernels +mkdir ${KERNELDIR} +%for kernel in kernels: + %if kernel.flavor: + installkernel images-${kernel.flavor}-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor} + installinitrd images-${kernel.flavor}-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img + + # create U-Boot wrapped images + + runcmd mkimage \ + -A arm -O linux -T ramdisk -C none \ + -a 0 -e 0 \ + -n "${product.name} ${product.version} ${kernel.flavor} ${kernel.arch}" \ + -d ${outroot}/${KERNELDIR}/initrd-${kernel.flavor}.img \ + ${outroot}/${KERNELDIR}/uInitrd-${kernel.flavor} + + runcmd mkimage \ + -A arm -O linux -T kernel -C none \ + -a ${kernelAddress[kernel.flavor]} -e ${kernelAddress[kernel.flavor]} \ + -n "${product.name} ${product.version} ${kernel.flavor} ${kernel.arch}" \ + -d ${outroot}/${KERNELDIR}/vmlinuz-${kernel.flavor} \ + ${outroot}/${KERNELDIR}/uImage-${kernel.flavor} + + treeinfo images-${kernel.flavor}-${basearch} uimage ${KERNELDIR}/uImage-${kernel.flavor} + treeinfo images-${kernel.flavor}-${basearch} uinitrd ${KERNELDIR}/uInitrd-${kernel.flavor} + + %else: + installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz + installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img + + # create U-Boot wrapped images + + runcmd mkimage \ + -A arm -O linux -T ramdisk -C none \ + -a 0 -e 0 \ + -n "${product.name} ${product.version} ${kernel.arch}" \ + -d ${outroot}/${KERNELDIR}/initrd.img \ + ${outroot}/${KERNELDIR}/uInitrd + + runcmd mkimage \ + -A arm -O linux -T kernel -C none \ + -a ${kernelAddress['baseline']} -e ${kernelAddress['baseline']} \ + -n "${product.name} ${product.version} ${kernel.arch}" \ + -d ${outroot}/${KERNELDIR}/vmlinuz \ + ${outroot}/${KERNELDIR}/uImage + + treeinfo images-${basearch} uimage ${KERNELDIR}/uImage + treeinfo images-${basearch} uinitrd ${KERNELDIR}/uInitrd + + %endif +%endfor + + +## FIXME: ARM may need some extra boot config + diff --git a/share/config_files/live/x86/boot.msg b/share/live/config_files/x86/boot.msg similarity index 100% rename from share/config_files/live/x86/boot.msg rename to share/live/config_files/x86/boot.msg diff --git a/share/config_files/live/x86/grub.conf b/share/live/config_files/x86/grub.conf similarity index 100% rename from share/config_files/live/x86/grub.conf rename to share/live/config_files/x86/grub.conf diff --git a/share/config_files/live/x86/isolinux.cfg b/share/live/config_files/x86/isolinux.cfg similarity index 100% rename from share/config_files/live/x86/isolinux.cfg rename to share/live/config_files/x86/isolinux.cfg diff --git a/share/live/efi.tmpl b/share/live/efi.tmpl new file mode 100644 index 00000000..644f0099 --- /dev/null +++ b/share/live/efi.tmpl @@ -0,0 +1,51 @@ +<%page args="configdir, KERNELDIR, efiarch"/> +<% +EFIBOOTDIR="EFI/BOOT" +APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns" +APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol" +%> + +mkdir ${EFIBOOTDIR} +install boot/efi/EFI/redhat/grub.efi ${EFIBOOTDIR}/BOOT${efiarch}.efi +install boot/grub/splash.xpm.gz ${EFIBOOTDIR} + +## actually make the EFI images +${make_efiboot("images/efiboot.img")} +%if domacboot: + ${make_efiboot("images/macboot.img", imgtype="apple")} +%endif + +## This is kinda gross, but then... so's EFI. +<%def name="make_efiboot(img, include_kernel=False, disk=False, imgtype='default')"> + <% + kdir = EFIBOOTDIR if include_kernel else KERNELDIR + eficonf = "%s/BOOT%s.conf" % (EFIBOOTDIR, efiarch) + args = "--label=ANACONDA" + if disk: args += " --disk" + if imgtype == "apple": args += ' --apple --icon=%s --diskname=%s --product="%s %s"' % (APPLE_EFI_ICON, APPLE_EFI_DISKNAME, product.name, product.version) + %> + %if include_kernel: + copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR} + copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR} + %endif + install ${configdir}/grub.conf ${eficonf} + replace @PRODUCT@ '${product.name}' ${eficonf} + replace @VERSION@ ${product.version} ${eficonf} + replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf} + replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf} + replace @SPLASHPATH@ /EFI/BOOT/splash.xpm.gz ${eficonf} + %if disk: + ## FIXME: using root= causes problems with product.img (see bug 811979) + replace @ROOT@ root=live:LABEL=ANACONDA ${eficonf} + %else: + replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${eficonf} + %endif + %if efiarch == 'IA32': + copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf + %endif + runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img} + %if include_kernel: + remove ${EFIBOOTDIR}/vmlinuz + remove ${EFIBOOTDIR}/initrd.img + %endif + diff --git a/share/live/ppc.tmpl b/share/live/ppc.tmpl new file mode 100644 index 00000000..3ff15da2 --- /dev/null +++ b/share/live/ppc.tmpl @@ -0,0 +1,117 @@ +<%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel"/> +<% +configdir="tmp/config_files/ppc" +BOOTDIR="ppc" +LIVEDIR="LiveOS" +MACDIR=BOOTDIR+"/mac" +NETBOOTDIR="images/netboot" + +WRAPPER="usr/sbin/wrapper" +WRAPPER_DATA="usr/"+libdir+"/kernel-wrapper" + +bitsizes = set() +prepboot = "" + +## NOTE: yaboot freaks out and stops parsing its config if it sees a '\', +## so we can't use the udev escape sequences in the root arg. +## Instead we'll just replace any non-ASCII characters in the isolabel +## with '_', which means we won't need any udev escapes. +isolabel = ''.join(ch if ch.isalnum() else '_' for ch in isolabel) + +rootarg = "root=live:CDLABEL=%s" % isolabel +%> + +mkdir ${LIVEDIR} +install ${runtime_img} ${LIVEDIR}/squashfs.img +treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img + +## install bootloaders. +## NOTE: there's two different bootloader setups here: +## ppc/chrp: for normal PPC systems. needs 'addnote' run on yaboot. +## uses /etc/yaboot.conf, as is the default. +## ppc/mac: for PowerMacs. no 'addnote' (it breaks some Macs!) +## ofboot.b picks one of /ppc/ppc{32,64}/yaboot.conf for yaboot, +## thus automatically booting the correct kernel for the machine. +mkdir ${BOOTDIR} +## boot stuff for normal (CHRP/PREP) PPC systems +install ${configdir}/bootinfo.txt ${BOOTDIR} +install boot/efika.forth ${BOOTDIR} +mkdir ${BOOTDIR}/chrp +install usr/lib/yaboot/yaboot ${BOOTDIR}/chrp +runcmd ${inroot}/usr/lib/yaboot/addnote ${outroot}/${BOOTDIR}/chrp/yaboot +## special boot dir for PowerMacs +mkdir ${MACDIR} +install usr/lib/yaboot/yaboot ${MACDIR} +install ${configdir}/ofboot.b ${MACDIR} + +## copy mapping and magic files needed for isos +install ${configdir}/mapping ${BOOTDIR} +install ${configdir}/magic ${BOOTDIR} + +## NOTE: PPC is kind of funky. There's three possible "arch" setups here: +## ppc, ppc64, and 'hybrid' (ppc userspace, both ppc & ppc64 kernels). + +## Install kernel and bootloader config (in separate places for each arch) +%for kernel in kernels: + <% + bits = 64 if kernel.arch == "ppc64" else 32 + ## separate dirs/images for each arch + KERNELDIR=BOOTDIR+"/ppc%s" % bits + NETIMG=NETBOOTDIR+"/ppc%s.img" % bits + bitsizes.add(bits) + %> + ## install kernel + mkdir ${KERNELDIR} ${NETBOOTDIR} + installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz + installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img + + ## install arch-specific bootloader config + install ${configdir}/yaboot.conf.in ${KERNELDIR}/yaboot.conf + replace @BITS@ ${bits} ${KERNELDIR}/yaboot.conf + replace @PRODUCT@ '${product.name}' ${KERNELDIR}/yaboot.conf + replace @VERSION@ ${product.version} ${KERNELDIR}/yaboot.conf + replace @ROOT@ "${rootarg}" ${KERNELDIR}/yaboot.conf + + ## kernel-wrapper magic that makes the netboot combined ppc{32,64}.img + runcmd ${inroot}/${WRAPPER} -p of \ + -D ${inroot}/${WRAPPER_DATA} \ + -i ${outroot}/${KERNELDIR}/initrd.img \ + ${outroot}/${KERNELDIR}/vmlinuz \ + -o ${outroot}/${NETIMG} + treeinfo images-${kernel.arch} zimage ${NETIMG} + ## PReP is 32-bit only + %if bits == 32: + ## Yes, this is supposed to be a relative path + <% prepboot="-prep-boot " + NETIMG %> + %endif +%endfor + +## choose correct yaboot.conf +mkdir etc +%if len(bitsizes) == 2: + ## both kernels means hybrid - use the magic hybrid config + install ${configdir}/yaboot.conf.3264 etc/yaboot.conf + replace @PRODUCT@ ${product.name} etc/yaboot.conf + replace @VERSION@ ${product.version} etc/yaboot.conf + replace @ROOT@ "${rootarg}" etc/yaboot.conf +%else: + ## single arch - use the arch-specific yaboot.conf from above + copy ${KERNELDIR}/yaboot.conf etc/yaboot.conf +%endif + +## make boot.iso +runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \ + ${prepboot} -part -hfs -T -r -l -J \ + -A "${product.name} ${product.version}" -sysid PPC -V '${isolabel}' \ + -volset "${product.version}" -volset-size 1 -volset-seqno 1 \ + -hfs-volid ${product.version} -hfs-bless ${outroot}/${MACDIR} \ + -map ${inroot}/${configdir}/mapping \ + -no-desktop -allow-multidot -graft-points \ + etc=${outroot}/etc \ + ${BOOTDIR}=${outroot}/${BOOTDIR} \ + ${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \ + ${LIVEDIR}=${outroot}/${LIVEDIR} + +%for kernel in kernels: + treeinfo images-${kernel.arch} boot.iso images/boot.iso +%endfor diff --git a/share/live/s390.tmpl b/share/live/s390.tmpl new file mode 100644 index 00000000..f02963d5 --- /dev/null +++ b/share/live/s390.tmpl @@ -0,0 +1,33 @@ +<%page args="kernels, runtime_img, runtime_base, basearch, outroot"/> +<% +configdir="tmp/config_files/s390" +BOOTDIR="images" +KERNELDIR=BOOTDIR +INITRD_ADDRESS="0x02000000" +# The assumption seems to be that there is only one s390 kernel, ever +kernel = kernels[0] +%> + +mkdir images +install ${runtime_img} images +treeinfo stage2 mainimage images/${runtime_base} + +## install bootloader (such as it is) and bootloader config +install ${configdir}/redhat.exec ${BOOTDIR} +install ${configdir}/generic.prm ${BOOTDIR} +install ${configdir}/generic.ins . + +## configure bootloader +replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins + +## install kernel +installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img +installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img + +## s390 needs some extra boot config +createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize + +## s390 also has some special treeinfo data +treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize +treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm +treeinfo images-${basearch} generic.ins generic.ins diff --git a/share/live/sparc.tmpl b/share/live/sparc.tmpl new file mode 100644 index 00000000..2452f80b --- /dev/null +++ b/share/live/sparc.tmpl @@ -0,0 +1,38 @@ +<%page args="kernels, runtime_img, basearch, outroot, product, isolabel"/> +<% +configdir="tmp/config_files/sparc" +BOOTDIR="boot" +LIVEDIR="LiveOS" +%> + +mkdir ${LIVEDIR} +install ${runtime_img} ${LIVEDIR}/squashfs.img +treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img + +## install bootloader and config files +install boot/*.b ${BOOTDIR} +install ${configdir}/silo.conf ${BOOTDIR} +install ${configdir}/boot.msg ${BOOTDIR} + +## configure bootloader +replace @VERSION@ ${product.version} ${BOOTDIR}/boot.msg +replace @PRODUCT@ '${product.name}' ${BOOTDIR}/boot.msg +replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/silo.conf + +## install kernels +## FIXME: this will overwrite if there are multiple sparc kernels +%for kernel in kernels: + installkernel images-${basearch} ${kernel.path} ${BOOTDIR}/vmlinuz + installinitrd images-${basearch} ${kernel.initrd.path} ${BOOTDIR}/initrd.img +%endfor + +## make boot.iso +runcmd mkisofs -R -J -T -G /${BOOTDIR}/isofs.b -B ... \ + -s /${BOOTDIR}/silo.conf -r -V '${isolabel}' \ + -A "${product.name} ${product.version}" \ + -x Fedora -x repodata \ + -sparc-label "${product.name} ${product.version} Boot Disc" \ + -o ${outroot}/images/boot.iso \ + -graft-points ${BOOTDIR}=${outroot}/${BOOTDIR} \ + ${LIVEDIR}=${outroot}/${LIVEDIR} +treeinfo images-${basearch} boot.iso images/boot.iso diff --git a/share/live/x86.tmpl b/share/live/x86.tmpl new file mode 100644 index 00000000..023c1af2 --- /dev/null +++ b/share/live/x86.tmpl @@ -0,0 +1,77 @@ +<%page args="kernels, runtime_img, basearch, outroot, product, isolabel"/> +<% +configdir="tmp/config_files/x86" +SYSLINUXDIR="usr/share/syslinux" +PXEBOOTDIR="images/pxeboot" +BOOTDIR="isolinux" +KERNELDIR=PXEBOOTDIR +LIVEDIR="LiveOS" +%> + +mkdir ${LIVEDIR} +install ${runtime_img} ${LIVEDIR}/squashfs.img +treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img + +## install bootloader and config files +mkdir ${BOOTDIR} +install ${SYSLINUXDIR}/isolinux.bin ${BOOTDIR} +install ${SYSLINUXDIR}/vesamenu.c32 ${BOOTDIR} +install ${configdir}/isolinux.cfg ${BOOTDIR} +install ${configdir}/boot.msg ${BOOTDIR} +install ${configdir}/grub.conf ${BOOTDIR} +install usr/share/anaconda/boot/syslinux-splash.png ${BOOTDIR}/splash.png +install boot/memtest* ${BOOTDIR}/memtest + +## configure bootloader +replace @VERSION@ ${product.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg +replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg +replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg + +## install kernels +mkdir ${KERNELDIR} +%for kernel in kernels: + %if kernel.flavor: + installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor} + installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img + %else: + installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz + installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img + %endif +%endfor + +hardlink ${KERNELDIR}/vmlinuz ${BOOTDIR} +hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} +%if basearch == 'x86_64': + treeinfo images-xen kernel ${KERNELDIR}/vmlinuz + treeinfo images-xen initrd ${KERNELDIR}/initrd.img +%endif + +## WHeeeeeeee, EFI. +## We could remove the basearch restriction someday.. +<% efiargs=""; efigraft=""; efihybrid="" %> +%if exists("boot/efi/EFI/redhat/grub.efi") and basearch != 'i386': + <% + efiarch = 'X64' if basearch=='x86_64' else 'IA32' + efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) + images = ["images/efiboot.img"] + if domacboot: + images.append("images/macboot.img") + for img in images: + efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) + efigraft += " {0}={1}/{0}".format(img,outroot) + efihybrid = "--uefi --mac" if domacboot else "--uefi" + %> + <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch"/> +%endif + +## make boot.iso +runcmd mkisofs -o ${outroot}/images/boot.iso \ + -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \ + -boot-load-size 4 -boot-info-table -no-emul-boot \ + ${efiargs} -R -J -V '${isolabel}' -T -graft-points \ + ${BOOTDIR}=${outroot}/${BOOTDIR} \ + ${KERNELDIR}=${outroot}/${KERNELDIR} \ + ${LIVEDIR}=${outroot}/${LIVEDIR} \ + ${efigraft} +runcmd isohybrid ${efihybrid} ${outroot}/images/boot.iso +treeinfo images-${basearch} boot.iso images/boot.iso diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator index 04b8ac5b..4a37b590 100755 --- a/src/sbin/livemedia-creator +++ b/src/sbin/livemedia-creator @@ -466,7 +466,7 @@ def make_livecd( disk_img, squashfs_args="", templatedir=None, # TreeBuilder expects the config files to be in /tmp/config_files # I think these should be release specific, not from lorax, but for now - configdir = joinpaths(templatedir,"config_files/live/") + configdir = joinpaths(templatedir,"live/config_files/") configdir_path = "tmp/config_files" fullpath = joinpaths(installroot, configdir_path) if os.path.exists(fullpath): @@ -498,7 +498,8 @@ def make_livecd( disk_img, squashfs_args="", templatedir=None, tb = TreeBuilder( product=product, arch=arch, inroot=installroot, outroot=work_dir, - runtime=runtime, isolabel=isolabel, templatedir=templatedir) + runtime=runtime, isolabel=isolabel, + templatedir=joinpaths(templatedir,"live/")) log.info( "Rebuilding initrds" ) if not opts.dracut_args: dracut_args = DRACUT_DEFAULT