Merge ../linus
[pandora-kernel.git] / arch / x86_64 / boot / Makefile
index 18c6e91..deb063e 100644 (file)
@@ -60,8 +60,12 @@ $(obj)/setup $(obj)/bootsect: %: %.o FORCE
 $(obj)/compressed/vmlinux: FORCE
        $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
 
-# Set this if you want to pass append arguments to the zdisk/fdimage kernel
+# Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel
 FDARGS = 
+# Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel
+FDINITRD =
+
+image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,)
 
 $(obj)/mtools.conf: $(src)/mtools.conf.in
        sed -e 's|@OBJ@|$(obj)|g' < $< > $@
@@ -70,8 +74,11 @@ $(obj)/mtools.conf: $(src)/mtools.conf.in
 zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
        MTOOLSRC=$(obj)/mtools.conf mformat a:                  ; sync
        syslinux /dev/fd0                                       ; sync
-       echo 'default linux $(FDARGS)' | \
+       echo '$(image_cmdline)' | \
                MTOOLSRC=$(obj)/mtools.conf mcopy - a:syslinux.cfg
+       if [ -f '$(FDINITRD)' ] ; then \
+               MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \
+       fi
        MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux  ; sync
 
 # These require being root or having syslinux 2.02 or higher installed
@@ -79,18 +86,44 @@ fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf
        dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
        MTOOLSRC=$(obj)/mtools.conf mformat v:                  ; sync
        syslinux $(obj)/fdimage                                 ; sync
-       echo 'default linux $(FDARGS)' | \
+       echo '$(image_cmdline)' | \
                MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
+       if [ -f '$(FDINITRD)' ] ; then \
+               MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \
+       fi
        MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux  ; sync
 
 fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf
        dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
        MTOOLSRC=$(obj)/mtools.conf mformat w:                  ; sync
        syslinux $(obj)/fdimage                                 ; sync
-       echo 'default linux $(FDARGS)' | \
+       echo '$(image_cmdline)' | \
                MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg
+       if [ -f '$(FDINITRD)' ] ; then \
+               MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \
+       fi
        MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux  ; sync
 
+isoimage: $(BOOTIMAGE)
+       -rm -rf $(obj)/isoimage
+       mkdir $(obj)/isoimage
+       for i in lib lib64 share end ; do \
+               if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \
+                       cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \
+                       break ; \
+               fi ; \
+               if [ $$i = end ] ; then exit 1 ; fi ; \
+       done
+       cp $(BOOTIMAGE) $(obj)/isoimage/linux
+       echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg
+       if [ -f '$(FDINITRD)' ] ; then \
+               cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \
+       fi
+       mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \
+               -no-emul-boot -boot-load-size 4 -boot-info-table \
+               $(obj)/isoimage
+       rm -rf $(obj)/isoimage
+
 zlilo: $(BOOTIMAGE)
        if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
        if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
@@ -98,5 +131,5 @@ zlilo: $(BOOTIMAGE)
        cp System.map $(INSTALL_PATH)/
        if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
 
-install: $(BOOTIMAGE)
+install:
        sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"