1 #############################################################
3 # mtd provides jffs2 utilities
5 #############################################################
6 ifeq ($(strip $(BR2_PACKAGE_MTD_SNAPSHOT
)),y
)
7 # Be aware that this changes daily....
8 #TODAY:=$(shell date -u +%Y%m%d)
10 MTD_DL_SOURCE
:=mtd-snapshot-
$(TODAY
).
tar.bz2
11 MTD_SOURCE
:=mtd-snapshot-
$(TODAY
).
tar.bz2
12 MTD_SITE
:=ftp
://ftp.uk.linux.org
/pub
/people
/dwmw2
/mtd
/cvs
13 MTD_HOST_DIR
:= $(TOOL_BUILD_DIR
)/mtd_snapshot
14 MTD_DIR
:=$(BUILD_DIR
)/mtd_snapshot
18 MTD_SOURCE
:=mtd-utils-
$(MTD_VERSION
).
tar.gz
19 MTD_SITE
:=ftp
://ftp.infradead.org
/pub
/mtd-utils
20 MTD_HOST_DIR
:= $(TOOL_BUILD_DIR
)/mtd-utils-
$(MTD_VERSION
)
21 MTD_DIR
:=$(BUILD_DIR
)/mtd-utils-
$(MTD_VERSION
)
27 #############################################################
29 # Build mkfs.jffs2 for use on the local host system if
30 # needed by target/jffs2root.
32 #############################################################
33 MKFS_JFFS2_HOST
:= $(MTD_HOST_DIR
)/mkfs.jffs2
34 SUMTOOL_JFFS2_HOST
:= $(MTD_HOST_DIR
)/sumtool
36 ifeq ($(strip $(BR2_PACKAGE_MTD_SNAPSHOT
)),y
)
37 $(DL_DIR
)/$(MTD_SOURCE
):
38 $(WGET
) -P
$(DL_DIR
) $(MTD_SITE
)/$(MTD_DL_SOURCE
)
39 #mv $(DL_DIR)/$(MTD_DL_SOURCE) $(DL_DIR)/$(MTD_SOURCE)
41 $(MTD_HOST_DIR
)/Makefile
: $(DL_DIR
)/$(MTD_SOURCE
)
42 $(MTD_UNZIP
) $(DL_DIR
)/$(MTD_SOURCE
) |
tar -C
$(TOOL_BUILD_DIR
) $(TAR_OPTIONS
) -
43 mv
$(TOOL_BUILD_DIR
)/$(shell tar tjf dl
/$(MTD_SOURCE
) | head
-n
1 | xargs
basename) $(MTD_HOST_DIR
)
44 touch
$(MTD_HOST_DIR
)/Makefile
46 ifneq ($(MTD_SOURCE
),)
47 $(DL_DIR
)/$(MTD_SOURCE
):
48 $(WGET
) -P
$(DL_DIR
) $(MTD_SITE
)/$(MTD_SOURCE
)
51 $(MTD_HOST_DIR
)/Makefile
: $(DL_DIR
)/$(MTD_SOURCE
)
52 $(MTD_UNZIP
) $(DL_DIR
)/$(MTD_SOURCE
) |
tar -C
$(TOOL_BUILD_DIR
) $(TAR_OPTIONS
) -
53 toolchain
/patch-kernel.sh
$(MTD_HOST_DIR
) package
/mtd \
*.patch
54 touch
$(MTD_HOST_DIR
)/Makefile
57 $(MKFS_JFFS2_HOST
): $(MTD_HOST_DIR
)/Makefile
58 CFLAGS
=-I
$(LINUX_HEADERS_DIR
)/include \
59 $(MAKE
) LINUXDIR
=$(LINUX_DIR
) -C
$(MTD_HOST_DIR
) mkfs.jffs2
61 $(SUMTOOL_JFFS2_HOST
): $(MTD_HOST_DIR
)/Makefile
62 CFLAGS
=-I
$(LINUX_HEADERS_DIR
)/include \
63 $(MAKE
) LINUXDIR
=$(LINUX_DIR
) -C
$(MTD_HOST_DIR
) sumtool
65 mtd-host-sumtool
: $(SUMTOOL_JFFS2_HOST
)
67 mtd-host
: $(MKFS_JFFS2_HOST
)
69 mtd-host-source
: $(DL_DIR
)/$(MTD_SOURCE
)
72 -$(MAKE
) -C
$(MTD_HOST_DIR
) clean
75 rm -rf
$(MTD_HOST_DIR
)
77 #############################################################
79 # build mtd for use on the target system
81 #############################################################
82 $(MTD_DIR
)/Makefile
: $(DL_DIR
)/$(MTD_SOURCE
)
83 $(MTD_UNZIP
) $(DL_DIR
)/$(MTD_SOURCE
) |
tar -C
$(BUILD_DIR
) $(TAR_OPTIONS
) -
84 ifeq ($(strip $(BR2_PACKAGE_MTD_SNAPSHOT
)),y
)
85 mv
$(BUILD_DIR
)/$(shell tar tjf dl
/$(MTD_SOURCE
) | head
-n
1 | xargs
basename) $(MTD_DIR
)
86 touch
$(MTD_DIR
)/Makefile
88 toolchain
/patch-kernel.sh
$(MTD_DIR
) package
/mtd \
*.patch
89 touch
$(MTD_DIR
)/Makefile
95 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FLASH_ERASE
) += flash_erase
96 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FLASH_ERASEALL
) += flash_eraseall
97 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FLASH_INFO
) += flash_info
98 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FLASH_LOCK
) += flash_lock
99 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FLASH_UNLOCK
) += flash_unlock
100 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FLASHCP
) += flashcp
101 MTD_TARGETS_
$(BR2_PACKAGE_MTD_MKFSJFFS2
) += mkfs.jffs2
102 MTD_TARGETS_
$(BR2_PACKAGE_MTD_MKFSJFFS
) += mkfs.jffs
103 MTD_TARGETS_
$(BR2_PACKAGE_MTD_JFFS2DUMP
) += jffs2dump
104 MTD_TARGETS_
$(BR2_PACKAGE_MTD_JFFS3DUMP
) += jffs3dump
105 MTD_TARGETS_
$(BR2_PACKAGE_MTD_SUMTOOL
) += sumtool
106 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FTL_CHECK
) += ftl_check
107 MTD_TARGETS_
$(BR2_PACKAGE_MTD_FTL_FORMAT
) += ftl_format
108 MTD_TARGETS_
$(BR2_PACKAGE_MTD_NFTLDUMP
) += nftldump
109 MTD_TARGETS_
$(BR2_PACKAGE_MTD_NFTL_FORMAT
) += nftl_format
110 MTD_TARGETS_
$(BR2_PACKAGE_MTD_NANDDUMP
) += nanddump
111 MTD_TARGETS_
$(BR2_PACKAGE_MTD_NANDWRITE
) += nandwrite
112 MTD_TARGETS_
$(BR2_PACKAGE_MTD_MTD_DEBUG
) += mtd_debug
113 MTD_TARGETS_
$(BR2_PACKAGE_MTD_DOCFDISK
) += docfdisk
114 MTD_TARGETS_
$(BR2_PACKAGE_MTD_DOC_LOADBIOS
) += doc_loadbios
116 MTD_BUILD_TARGETS
:= $(addprefix $(MTD_DIR
)/, $(MTD_TARGETS_y
))
118 $(MTD_BUILD_TARGETS
): $(MTD_DIR
)/Makefile
119 CFLAGS
="-I$(LINUX_HEADERS_DIR)/include $(TARGET_CFLAGS)" \
120 $(MAKE
) CC
=$(TARGET_CC
) LINUXDIR
=$(LINUX_DIR
) -C
$(MTD_DIR
)
122 MTD_TARGETS
:= $(addprefix $(TARGET_DIR
)/usr
/sbin
/, $(MTD_TARGETS_y
))
124 $(MTD_TARGETS
): $(TARGET_DIR
)/usr
/sbin
/% : $(MTD_DIR
)/%
128 mtd
: zlib
$(MTD_TARGETS
)
130 mtd-source
: $(DL_DIR
)/$(MTD_SOURCE
)
133 -$(MAKE
) -C
$(MTD_DIR
) clean
139 #############################################################
141 # Toplevel Makefile options
143 #############################################################
144 ifeq ($(strip $(BR2_PACKAGE_MTD
)),y
)