CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Cleanup and fixed issues with boot templates
[bootloader.git] / devices / cubieboard / Makefile
index 88031bfdd60bc966194354207bd69a50934ca3bf..8f2773174f1d9dae71ff28e9f3e2d211a59532eb 100644 (file)
@@ -1,5 +1,5 @@
 #
-# uboot/devices/cubieboard/Makefile
+# bootloader/devices/cubieboard/Makefile
 #
 
 PWD = $(shell pwd)
@@ -9,9 +9,13 @@ ZIMAGE = $(PWD)/../../../kernel/cubieboard/work/zImage
 INITRDGZ = $(PWD)/../../../initrd/work/initrd.gz
 INITRAMFS = $(PWD)/../../../initramfs/work/initramfs
 
-RAMDISK_TYPE = uInitrd # select between uInitramfs or uInitrd
+KERNEL_VERSION_STRING = $(shell readlink $(ZIMAGE) | sed s/zImage-//)
 
-CONSOLE = tty0 # tty0 / ttyS0,115200
+RAMDISK_TYPE = uInitrd
+#RAMDISK_TYPE = uInitramfs
+
+CONSOLE_DEVICE = tty0
+#CONSOLE_DEVICE = ttymxc0,115200
 
 .PHONY: all clean distclean kernel ramdisk bootscr
 
@@ -26,7 +30,7 @@ $(WORK):
 
 $(WORK)/uImage: $(WORK) $(MKIMAGE) $(ZIMAGE)
        $(MKIMAGE) -A arm -O linux -a 0x40008000 -e 0x40008000 \
-       -T kernel -C none -n "Linux-3.0.76-cubieboard" \
+       -T kernel -C none -n "Linux-$(KERNEL_VERSION_STRING)" \
        -d $(ZIMAGE) $(WORK)/uImage
 
 kernel: $(WORK)/uImage
@@ -58,16 +62,16 @@ ramdisk: $(RAMDISK_TYPE)
 
 ramdisk-clean: uInitrd-clean uInitramfs-clean
 
-templates: $(PWD)/boot-mmc.script
-       sed "s|#CONSOLE#|$(CONSOLE)|" $(PWD)/boot-mmc.script > $(WORK)/boot-mmc.script
+$(WORK)/%.script: %.script.in
+       sed -e "s|@@RAMDISK_TYPE@@|$(RAMDISK_TYPE)|" -e "s|@@CONSOLE_DEVICE@@|$(CONSOLE_DEVICE)|" $< > $@
 
-$(WORK)/boot-mmc.scr: $(WORK) $(MKIMAGE)
+$(WORK)/boot-mmc.scr: $(WORK)/boot-mmc.script $(MKIMAGE)
        $(MKIMAGE) -A arm -O linux -a 0 -e 0 \
-       -T script -C none -n "A10 Boot Script (mmc)" \
+       -T script -C none -n "Cubieboard Boot Script (mmc)" \
        -d $(WORK)/boot-mmc.script \
        $(WORK)/boot-mmc.scr
 
-bootscr: templates $(WORK)/boot-mmc.scr
+bootscr: $(WORK)/boot-mmc.scr
 
 bootscr-clean:
        rm -f $(WORK)/boot-*.scr*