You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
7.3 KiB

7 years ago
# targets to create rootfs
# rootfs targets
rootfs: .version update.urls $(BOX) cleanup strip softlinks
.version: $(TARGET_DIR)/.version
$(TARGET_DIR)/.version:
7 years ago
echo "version="$(IMAGE_TYPE)$(IMAGE_VERSION)$(IMAGE_DATE) > $@
# determinate last NI-release-tag an use this to git describe
GITTAG=`cd $(SOURCE_DIR)/$(NI_NEUTRINO); git tag -l "NI-*" | tail -n1`; \
GITDESCRIBE=`cd $(SOURCE_DIR)/$(NI_NEUTRINO); git describe --always --dirty --tags --match $$GITTAG`; \
7 years ago
GITDESCRIBE=$${GITDESCRIBE%-dirty}; \
echo "describe="$$GITDESCRIBE >> $@
# determinate current branch in origin repo
BRANCH=`cd $(SOURCE_DIR)/$(NI_NEUTRINO); git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`; \
7 years ago
echo "branch="$$BRANCH >> $@
# determinate last commit in origin repo
COMMIT=`cd $(SOURCE_DIR)/$(NI_NEUTRINO); git fetch origin; git show origin/$(NI_NEUTRINO_BRANCH) --stat | grep ^commit | cut -d' ' -f2 | cut -c1-7`; \
7 years ago
echo "commit="$$COMMIT >> $@
echo "builddate="`date` >> $@
echo "creator=$(MAINTAINER)" >> $@
ifeq ($(USE_LIBSTB-HAL), yes)
echo "imagename=NI-Neutrino-MP" >> $@
else
7 years ago
echo "imagename=NI-Neutrino-HD" >> $@
endif
7 years ago
echo "homepage=www.neutrino-images.de" >> $@
update.urls: $(TARGET_DIR)/var/etc/update.urls
$(TARGET_DIR)/var/etc/update.urls:
echo "$(NI-SERVER)/update.php" > $@
7 years ago
echo "$(CHANLIST_URL)/$(CHANLIST_MD5FILE)" >> $@
# create filesystem for our images
$(BOX): | $(TARGET_DIR)
7 years ago
rm -rf $(BOX)
cp -a $(TARGET_DIR) $(BOX)
7 years ago
# cleanup filesystem from useless stuff
cleanup: $(BOX)
rm -rf $(BOX)/{include,mymodules}
rm -rf $(BOX)/share/{aclocal,gdb,locale,man,doc,info,common-lisp}
rm -rf $(BOX)/lib/pkgconfig
rm -f $(BOX)/lib/libvorbisenc*
rm -rf $(BOX)/lib/sigc++*
rm -rf $(BOX)/lib/glib-2.0
7 years ago
find $(BOX) \( -name .gitignore -o -name .gitkeep \) -type f -print0 | xargs --no-run-if-empty -0 rm -f
find $(BOX)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs --no-run-if-empty -0 rm -f
@echo -e "$(TERM_YELLOW)"
7 years ago
@du -sh $(BOX)
@echo -e "$(TERM_NORMAL)"
7 years ago
# strip bins and libs in filesystem
strip: $(BOX)
ifneq ($(DEBUG), yes)
7 years ago
@echo "*******************************************************"
@echo "*** The following warnings from strip are harmless! ***"
@echo "*******************************************************"
find $(BOX)/bin -type f -print0 | xargs -0 $(TARGET)-strip || true
find $(BOX)/sbin -type f -print0 | xargs -0 $(TARGET)-strip || true
find $(BOX)/lib \( \
-path $(BOX)/lib/libnexus.so -o \
-path $(BOX)/lib/libnxpl.so -o \
-path $(BOX)/lib/libv3ddriver.so -o \
\
-path $(BOX)/lib/modules \) -prune -o \
-type f -print0 | xargs -0 $(TARGET)-strip || true
7 years ago
ifeq ($(BOXSERIES), hd2)
find $(BOX)/lib/modules/$(KERNEL_VERSION_FULL)/kernel -type f -name '*.ko' | xargs -n 1 $(TARGET)-objcopy --strip-unneeded
7 years ago
endif
@echo -e "$(TERM_YELLOW)"
7 years ago
@du -sh $(BOX)
@echo -e "$(TERM_NORMAL)"
7 years ago
endif
ifeq ($(DEBUG), yes)
@echo "*******************************************************"
@echo "*** The following warnings from strip are harmless! ***"
@echo "*******************************************************"
find $(BOX)/bin -path $(BOX)/bin/neutrino -prune -o -type f -print0 | xargs -0 $(TARGET)-strip || true
find $(BOX)/sbin -type f -print0 | xargs -0 $(TARGET)-strip || true
find $(BOX)/lib/valgrind -type f -print0 | xargs -0 $(TARGET)-strip || true
@echo "*******************************************************"
@echo "*** Strip samba for debug image ***"
@echo "*******************************************************"
$(TARGET)-strip $(TARGET_DIR)/bin/smbclient
$(TARGET)-strip $(TARGET_DIR)/bin/smbpasswd
$(TARGET)-strip $(TARGET_DIR)/lib/libsmbsharemodes.so.0
$(TARGET)-strip $(TARGET_DIR)/lib/libsmbclient.so.0
$(TARGET)-strip $(TARGET_DIR)/lib/libnetapi.so.0
$(TARGET)-strip $(TARGET_DIR)/lib/libtdb.so.1
$(TARGET)-strip $(TARGET_DIR)/lib/libtalloc.so.1
$(TARGET)-strip $(TARGET_DIR)/lib/libwbclient.so.0
7 years ago
find $(BOX)/lib/samba -type f -print0 | xargs -0 $(TARGET)-strip || true
@echo -e "$(TERM_YELLOW)"
7 years ago
@du -sh $(BOX)
@echo -e "$(TERM_NORMAL)"
7 years ago
endif
# create softlinks in filesystem
softlinks: $(BOX)
pushd $(BOX) && \
ln -sf /var/root root
ifeq ($(BOXSERIES), hd51)
pushd $(BOX) && \
ln -sf /var/root home
endif
7 years ago
pushd $(BOX)/usr && \
ln -sf /share share
7 years ago
pushd $(BOX)/usr/bin && \
ln -sf /bin/env env
7 years ago
pushd $(BOX)/var && \
ln -sf /tmp run && \
ln -sf /tmp tmp
7 years ago
pushd $(BOX)/etc/init.d && \
ln -sf fstab K99fstab && \
ln -sf fstab S01fstab && \
ln -sf syslogd K98syslogd && \
ln -sf crond S55crond && \
ln -sf crond K55crond && \
ln -sf inetd S53inetd && \
ln -sf inetd K80inetd
7 years ago
ifeq ($(BOXSERIES), hd2)
pushd $(BOX)/etc && \
ln -sf /var/etc/exports exports && \
ln -sf /var/etc/fstab fstab && \
ln -sf /var/etc/hostname hostname && \
ln -sf /var/etc/localtime localtime && \
ln -sf /var/etc/passwd passwd && \
ln -sf /var/etc/resolv.conf resolv.conf && \
ln -sf /var/etc/wpa_supplicant.conf wpa_supplicant.conf
7 years ago
pushd $(BOX)/etc/network && \
ln -sf /var/etc/network/interfaces interfaces
7 years ago
pushd $(BOX)/lib && \
ln -sf libuClibc-$(UCLIBC_VER).so libcrypt.so.0 && \
ln -sf libuClibc-$(UCLIBC_VER).so libdl.so.0 && \
ln -sf libuClibc-$(UCLIBC_VER).so libpthread.so.0 && \
ln -sf libuClibc-$(UCLIBC_VER).so libm.so.0 && \
ln -sf libuClibc-$(UCLIBC_VER).so librt.so.0
ifeq ($(NEWIMAGE), yes)
7 years ago
touch -f $(BOX)/var/etc/.newimage
endif
7 years ago
endif
mkdir -p $(BOX)/var/tuxbox/config && \
pushd $(BOX)/var/tuxbox/config && \
ln -sf /var/keys/SoftCam.Key SoftCam.Key
get-update-info: get-update-info-$(BOXSERIES)
get-update-info-hd2:
@echo " ============================================================================== "
@echo " Get update info for model $(shell echo $(BOXMODEL) | sed 's/.*/\u&/')"
@echo ""
@cd $(SOURCE_DIR)/$(NI_DRIVERS-BIN)/$(DRIVERS_DIR); \
test -e ./u-boot.bin && ( \
strings u-boot.bin | grep -m1 "U-Boot "; \
); \
test -e ./uldr.bin && ( \
strings uldr.bin | grep -m1 "Microloader "; \
); \
cd $(BASE_DIR)/root/var/update; \
test -e ./vmlinux.ub.gz && ( \
dd if=./vmlinux.ub.gz bs=1 skip=$$(LC_ALL=C grep -a -b -o $$'\x1f\x8b\x08\x00\x00\x00\x00\x00' ./vmlinux.ub.gz \
| cut -d ':' -f 1) | zcat | grep -a "Linux version"; \
);
@echo " ============================================================================== "
get-update-info-hd1:
@echo " ============================================================================== "
@echo " Get update info for model $(shell echo $(BOXMODEL) | sed 's/.*/\u&/')"
@echo ""
@cd $(BASE_DIR)/root/var/update; \
test -e ./zImage && ( \
dd if=./zImage bs=1 skip=$$(LC_ALL=C grep -a -b -o $$'\x1f\x8b\x08\x00\x00\x00\x00\x00' ./zImage \
| cut -d ':' -f 1) | zcat | grep -a "Linux version"; \
);
@echo " ============================================================================== "
personalize: | $(TARGET_DIR)
$(call local-script,$(notdir $@),start)
@LOCAL_ROOT=$(LOCAL_DIR)/root; \
if [ -n "$$(ls -A $$LOCAL_ROOT)" ]; then \
cp -a -v $$LOCAL_ROOT/* $(TARGET_DIR)/; \
7 years ago
fi
$(call local-script,$(notdir $@),stop)
7 years ago
# -----------------------------------------------------------------------------
PHONY += rootfs
PHONY += .version $(TARGET_DIR)/.version
PHONY += update.urls $(TARGET_DIR)/var/etc/update.urls
PHONY += $(BOX)
PHONY += cleanup
PHONY += strip
PHONY += softlinks
PHONY += personalize