Skip to contentSkip to conversation

[2.6] Fix Makefiles for CONFIG_EMBEDDED_RAMDISK

PATCH In review Dimitri Torfs 3 participants 3 messages Jan 6, 2004 – Jan 9, 2004 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 [2.6] Fix Makefiles for CONFIG_EMBEDDED_RAMDISK

Hi,

here are patches that fix the arch/mips/Makefile and arch/mips/ramdisk/Makefile when an embedded ramdisk image needs to be included through the CONFIG_EMBEDDED_RAMDISK option.

arch/mips/Makefile +4 -6
@@ -187,13 +187,11 @@
 
 #
 # ramdisk/initrd support
-# You need a compressed ramdisk image, named ramdisk.gz in
-# arch/mips/ramdisk
+# You need a compressed ramdisk image, named
+# CONFIG_EMBEDDED_RAMDISK_IMAGE. Relative pathnames 
+# are relative to arch/mips/ramdisk/.
 #
-ifdef CONFIG_EMBEDDED_RAMDISK
-CORE_FILES	+= arch/mips/ramdisk/ramdisk.o
-SUBDIRS		+= arch/mips/ramdisk
-endif
+core-$(CONFIG_EMBEDDED_RAMDISK)	+= arch/mips/ramdisk/
 
 #
 # Firmware support
arch/mips/ramdisk/Makefile +15 -4
@@ -2,8 +2,19 @@
 # Makefile for a ramdisk image
 #
 
+obj-y += ramdisk.o
+
+
 O_FORMAT = $(shell $(OBJDUMP) -i | head -n 2 | grep elf32)
-img = $(CONFIG_EMBEDDED_RAMDISK_IMAGE)
-ramdisk.o: $(subst ",,$(img)) ld.script
-	echo "O_FORMAT:  " $(O_FORMAT)
-	$(LD) -T ld.script -b binary --oformat $(O_FORMAT) -o $@ $(img)
+img := $(subst ",,$(CONFIG_EMBEDDED_RAMDISK_IMAGE))
+# add $(src) when $(img) is relative
+img := $(subst $(src)//,/,$(src)/$(img))
+
+quiet_cmd_ramdisk = LD      $@
+define cmd_ramdisk
+	$(LD) -T $(src)/ld.script -b binary --oformat $(O_FORMAT) -o $@ $(img)
+endef
+
+$(obj)/ramdisk.o: $(img) $(src)/ld.script
+	$(call cmd,ramdisk)
+
Signature · 4 lines
Dimitri Torfs             |  NSCE 
[email protected] |  Sint Stevens Woluwestraat 55
tel: +32 2 2908451        |  1130 Brussel
fax: +32 2 7262686        |  Belgium
#1 lore raw
Quoted 3 lines · Dimitri Torfs

here are patches that fix the arch/mips/Makefile and arch/mips/ramdisk/Makefile when an embedded ramdisk image needs to be included through the CONFIG_EMBEDDED_RAMDISK option.

I'm curious as to why this is a mips specific feature. Does anyone know?

--
Charlie

#2 lore raw
Quoted 5 lines · Charlie Brady
Quoted 3 lines

here are patches that fix the arch/mips/Makefile and arch/mips/ramdisk/Makefile when an embedded ramdisk image needs to be included through the CONFIG_EMBEDDED_RAMDISK option.

I'm curious as to why this is a mips specific feature. Does anyone know?

There's little machine dependence as you noticed; just the linker script would need to be fixed as it's hardwired to mips.

Ralf