2 # Copyright (C) 2006-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/kernel.mk
10 include $(INCLUDE_DIR
)/host.mk
11 include $(INCLUDE_DIR
)/version.mk
12 include $(INCLUDE_DIR
)/feeds.mk
16 IB_NAME
:=$(VERSION_DIST
)-ImageBuilder-
$(if
$(CONFIG_VERSION_FILENAMES
),$(VERSION_NUMBER
)-)$(BOARD
)$(if
$(SUBTARGET
),-$(SUBTARGET
)).
$(HOST_OS
)-$(HOST_ARCH
)
17 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(IB_NAME
)
18 IB_KDIR
:=$(patsubst $(TOPDIR
)/%,$(PKG_BUILD_DIR
)/%,$(KERNEL_BUILD_DIR
))
19 IB_LDIR
:=$(patsubst $(TOPDIR
)/%,$(PKG_BUILD_DIR
)/%,$(LINUX_DIR
))
20 IB_DTSDIR
:=$(patsubst $(TOPDIR
)/%,$(PKG_BUILD_DIR
)/%,$(LINUX_DIR
))/arch
/$(ARCH
)/boot
/dts
/
24 $(BIN_DIR
)/$(IB_NAME
).
tar.bz2
: clean
25 rm -rf
$(PKG_BUILD_DIR
)
26 mkdir
-p
$(IB_KDIR
) $(IB_LDIR
) $(PKG_BUILD_DIR
)/staging_dir
/host
/lib \
27 $(PKG_BUILD_DIR
)/target
$(PKG_BUILD_DIR
)/scripts
$(IB_DTSDIR
)
28 -cp
$(TOPDIR
)/.config
$(PKG_BUILD_DIR
)/.config
30 $(INCLUDE_DIR
) $(SCRIPT_DIR
) \
33 .
/files
/repositories.conf \
34 $(TMP_DIR
)/.targetinfo \
35 $(TMP_DIR
)/.packageinfo \
38 ifeq ($(CONFIG_IB_STANDALONE
),)
39 echo
'## Remote package repositories' >> $(PKG_BUILD_DIR
)/repositories.conf
40 $(call FeedSourcesAppend
,$(PKG_BUILD_DIR
)/repositories.conf
)
43 echo
'' >> $(PKG_BUILD_DIR
)/repositories.conf
44 echo
'## This is the local package repository, do not remove!' >> $(PKG_BUILD_DIR
)/repositories.conf
45 echo
'src imagebuilder file:packages' >> $(PKG_BUILD_DIR
)/repositories.conf
47 $(VERSION_SED
) $(PKG_BUILD_DIR
)/repositories.conf
49 ifeq ($(CONFIG_IB_STANDALONE
),)
50 (cd
$(PACKAGE_DIR
); $(FIND
) -type f
-name
'libc_*.ipk' -or
-name
'kernel_*.ipk' -or
-name
'kmod-*.ipk') | \
52 mkdir
-p
"$(PKG_BUILD_DIR)/packages/$${path%/*}"; \
53 cp
"$(PACKAGE_DIR)/$$path" "$(PKG_BUILD_DIR)/packages/$$path"; \
56 $(CP
) $(PACKAGE_DIR
) $(PKG_BUILD_DIR
)/packages
59 $(CP
) $(TOPDIR
)/target
/linux
$(PKG_BUILD_DIR
)/target
/
60 if
[ -d
$(TOPDIR
)/staging_dir
/host
/lib
/grub
]; then \
61 $(CP
) $(TOPDIR
)/staging_dir
/host
/lib
/grub
/ $(PKG_BUILD_DIR
)/staging_dir
/host
/lib
; \
64 $(PKG_BUILD_DIR
)/target
/linux
/*/files
{,-*} \
65 $(PKG_BUILD_DIR
)/target
/linux
/*/patches
{,-*}
66 -cp
$(KERNEL_BUILD_DIR
)/* $(IB_KDIR
)/ # don't copy subdirectories here
67 -cp
$(LINUX_DIR
)/.config
$(IB_LDIR
)/
68 -$(SCRIPT_DIR
)/bundle-libraries.sh
$(IB_LDIR
)/scripts
/dtc \
69 $(LINUX_DIR
)/scripts
/dtc
/dtc
70 if
[ -d
$(LINUX_DIR
)/arch
/$(ARCH
)/boot
/dts
]; then \
71 $(CP
) $(LINUX_DIR
)/arch
/$(ARCH
)/boot
/dts
/* $(IB_DTSDIR
); \
73 $(SED
) 's,^# REVISION:=.*,REVISION:=$(REVISION),g' $(PKG_BUILD_DIR
)/include/version.mk
74 find
$(PKG_BUILD_DIR
) -name CVS
-o
-name .git
-o
-name .svn \
76 find
$(STAGING_DIR_HOST
)/bin
-maxdepth
1 -type f
-perm
-u
=x \
77 |
$(XARGS
) $(SCRIPT_DIR
)/bundle-libraries.sh
$(PKG_BUILD_DIR
)/staging_dir
/host
/bin
/
78 STRIP
=sstrip
$(SCRIPT_DIR
)/rstrip.sh
$(PKG_BUILD_DIR
)/staging_dir
/host
/bin
/
79 $(TAR
) -cf
- -C
$(BUILD_DIR
) $(IB_NAME
) | bzip2
-c
> $@
83 compile
: $(BIN_DIR
)/$(IB_NAME
).
tar.bz2
87 rm -rf
$(PKG_BUILD_DIR
) $(BIN_DIR
)/$(IB_NAME
).
tar.bz2