1#
2# Makefile for a ramdisk image
3#
4
5BIG_ENDIAN	:= $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big)
6
7ifeq ($(BIG_ENDIAN),1)
8OBJCOPY_ARGS    := -O elf32-xtensa-be
9else
10OBJCOPY_ARGS    := -O elf32-xtensa-le
11endif
12
13obj-y = ramdisk.o
14
15RAMDISK_IMAGE = arch/$(ARCH)/boot/ramdisk/$(CONFIG_EMBEDDED_RAMDISK_IMAGE)
16
17arch/$(ARCH)/boot/ramdisk/ramdisk.o:
18	$(Q)echo -e "dummy:" | $(AS) -o $@;
19	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS)					    \
20		--add-section .initrd=$(RAMDISK_IMAGE)			    \
21		--set-section-flags .initrd=contents,alloc,load,load,data   \
22		arch/$(ARCH)/boot/ramdisk/ramdisk.o $@
23
24