This repository has been archived by the owner on Jan 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
tftpd.mk
114 lines (85 loc) · 2.92 KB
/
tftpd.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#########################################################
# tftpd-hpa for uClinux and Asterisk,
# Jeff Knighton Feb 2008
#
# usage: make -f tftpd-hpa.mk tftpd-package
#
#########################################################
include rules.mk
TFTPD_SITE=http://freshmeat.net/redir/tftp-hpa/14040/url_tgz
TFTPD_VERSION=0.48
TFTPD_SOURCE=tftp-hpa-0.48.tar.gz
TFTPD_UNZIP=zcat
TFTPD_DIR=$(BUILD_DIR)/tftp-hpa-$(TFTPD_VERSION)
TFTPD_CONFIGURE_OPTS=--host=bfin-linux-uclibc
TARGET_DIR=$(BUILD_DIR)/tmp/tftpd/ipkg/tftpd
PKG_NAME:=tftpd
PKG_VERSION:=$(TFTPD_VERSION)
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/tmp/tftpd
$(DL_DIR)/$(TFTPD_SOURCE):
$(WGET) -P $(DL_DIR) $(TFTPD_SITE)/$(TFTPD_SOURCE)
tftpd-source: $(DL_DIR)/$(TFTPD_SOURCE)
$(TFTPD_DIR)/.unpacked: $(DL_DIR)/$(TFTPD_SOURCE)
tar -xzvf $(DL_DIR)/$(TFTPD_SOURCE)
touch $(TFTPD_DIR)/.unpacked
$(TFTPD_DIR)/.configured: $(TFTPD_DIR)/.unpacked
chmod a+x $(TFTPD_DIR)/configure
$(PATCH_KERNEL) $(TFTPD_DIR) patch tftpd.patch
cd $(TFTPD_DIR); CFLAGS=-D__BLACKFIN__ ./configure $(TFTPD_CONFIGURE_OPTS)
touch $(TFTPD_DIR)/.configured
# setup directories for package
rm -Rf $(TARGET_DIR)
mkdir -p $(TARGET_DIR)/bin
mkdir -p $(TARGET_DIR)/tftpboot
tftpd: $(TFTPD_DIR)/.configured
make -C $(TFTPD_DIR)/ STAGEDIR=$(STAGING_DIR)
#copy to the package location
cp -f $(TFTPD_DIR)/tftpd/tftpd $(TARGET_DIR)/bin/in.tftpd
touch $(PKG_BUILD_DIR)/.built
all: tftpd
dirclean:
rm -rf $(TFTPD_DIR)
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
TITLE:=tftpd
DESCRIPTION:=\
tftp (trivial file transfer protocol) server
URL:=http://www.kernel.org/pub/software/network/tftp/
endef
#post installation -
define Package/$(PKG_NAME)/postinst
#!/bin/sh
cp -f /etc/inetd.conf /etc/inetd.conf.pre-tftpd
echo "tftp dgram udp wait root /bin/in.tftpd -s /tftpboot" >> /etc/inetd.conf
kill -HUP `pidof inetd`
endef
#pre-remove
define Package/$(PKG_NAME)/prerm
#!/bin/sh
cat /etc/inetd.conf | sed '/tftp/ d' > /etc/inetd.conf.tmp
cp -f /etc/inetd.conf.tmp /etc/inetd.conf
rm /etc/inetd.conf.pre-tftpd /etc/inetd.conf.tmp
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
tftpd-package: tftpd $(PACKAGE_DIR)/$(PKG_NAME)_$(VERSION)_$(PKGARCH).ipk
#---------------------------------------------------------------------------
# CREATING PATCHES
#---------------------------------------------------------------------------
# Generate patches between vanilla tar ball and our
# version. Run this target after you have made any changes to
# to capture.
AO = tftp-hpa-$(TFTPD_VERSION)-orig
A = tftp-hpa-$(TFTPD_VERSION)
tftpd-make-patch:
# untar original, to save time we check if the orig is already there
if [ ! -d $(TFTPD_DIR)-orig ] ; then \
cd $(DL_DIR); tar xzf $(TFTPD_SOURCE); \
mv $(A) $(TFTPD_DIR)-orig; \
fi
# switch fork to vfork
-cd $(BUILD_DIR); diff -uN \
$(AO)/tftpd/tftpd.c \
$(A)/tftpd/tftpd.c \
> $(PWD)/patch/tftpd.patch