Wednesday, October 20, 2010
APPLE BONJOUR 214.3.2 PORT TO Uclinux 2.4.29 for Coldfire m5272
If you read this, and find it useful or not, please leave a comment below. Thank you.
I don't usually post something non surveillance related, but I had to do the steps below and thought it was too painstaking to not share with the world. So here goes my post on how to port Apple's Bonjour service to uClinux. I just happened to be using a Coldfire 5272 processor, but I'm sure this is similar for other processors using uClinux:
Thanks to Rob Brown for his post on this subject back in 2007. This includes
some of his instructions mixed with my own instructions and experiences to
address the newer version of Apple's BONJOUR.
Step 1. Download the Bonjour for Posix package from the Apple site. Make sure
the Bonjour version matches 214.3.2. If the latest version is newer than
214.3.2, goto the archives and get the 214.3.2 version. If you'd rather port the
newer version than the steps below may not cover everything that is needed.
Step 2. Create an empty "mDNSResponder" directory and place that directory in
the same place as all the other Linux applications for your device. In my case
that directory was USR\SRC\C\.
Step 3. Copy only the following files from the Apple package (most are in the
POSIX source directory) into the empty mDNSResponder directory:
makefile (from template below)
uDNS.h
uDNS.c
Responder.c
mDNSUNP.h
mDNSUNP.c
mDNSPosix.h
mDNSPosix.c
mDNSEmbeddedAPI.h
mDNSDebug.h
mDNSDebug.c
mDNS.c
GenLinkedList.h
GenLinkedList.c
DNSDigest.c
DNSCommon.h
DNSCommon.c
dns_sd.h
PlatformCommon.c
PlatformCommon.h
Step 4. Copy the makefile template from below, then modify it (as well as any
parent makefiles) to accomadate your particular device and uclinux structure. As
a tip, take the other makefiles for your other device applications and look at
how they are created. You will likely have to change your paths for the OBJSDIR,
INCLUDEDIR, SCRIPTDIR, etc.
Step 5. Once you have your 'make' building without issues, and your image file
running on your device, you should be able to call 'mDNSResponder'from your
linux OS.
Step 6. Usage: From the linux command prompt on your device, call mDNSResponder.
Use the flags to customize the way that your device will be displayed on the
Bonjour client app or IE plugin. See example below:
Example:
mDNSResponder -n MyDEvice -t _http._tcp. -p 80 &
I included the line above in my linux /etc/RC file. This allows bonjour to begin
at startup and is called with the following flags.
-n = The name that will be displayed in the Bonjour client app or IE plugin
-t = This is the 'type' that Bonjour uses. This is important because the Bonjour
IE plugin only sees devices with the '_http._tcp.' type. Most printers use this
type. If you want your device to be seen with the IE plugin, use this type...not
the default type that mDNSResponder starts with.
-p = This is the port that Bonjour binds to. I did a bind to port 80 to allow me
to click on the name in the IE Plugin and pull up the configuration webpage on
my device. My device runs BOA webserver on port 80, so this allows me to
configure my device's IP without having to know what the IP is initially.
& = If you don't know linux, you need to add the '&' to make the process run in
the background. I tried using the flag to make mDNSResponder run as a deamon,
but it failed every time within my uclinux build, so this works well enough for
my application.
Usage: I start the IE Bonjour plugin ; power up my device and it appears as
'MyDevice' in the Bonjour window of IE. I then click on it to instantly take me
to the device's configuration page. I can then set the IP, view the IP, or
configure my device in whatever way I want. This is the end goal! Enjoy!
Hope this helps someone. Feel free to post questions and comments.
Cut and paste the text below to generate the makefile that goes into the
mDNSResponder folder above.
###########################################################
# makefile writen to produce mDNSResponder app for uClinux
OBJSDIR = ../../../build/user_obj
INCLUDEDIR = ../../include
SCRIPTDIR = ../../scripts
EXEC = mDNSResponder
OBJS = $(OBJSDIR)/$(EXEC)/mDNSPosix.o $(OBJSDIR)/$(EXEC)/GenLinkedList.o
$(OBJSDIR)/$(EXEC)/mDNSUNP.o
OBJS += $(OBJSDIR)/$(EXEC)/mDNS.o $(OBJSDIR)/$(EXEC)/DNSCommon.o
$(OBJSDIR)/$(EXEC)/mDNSDebug.o $(OBJSDIR)/$(EXEC)/uDNS.o
OBJS += $(OBJSDIR)/$(EXEC)/DNSDigest.o $(OBJSDIR)/$(EXEC)/Responder.o
$(OBJSDIR)/$(EXEC)/PlatformCommon.o
CFILES = mDNSPosix.c GenLinkedList.c mDNSUNP.c mDNS.c DNSCommon.c mDNSDebug.c
uDNS.c DNSDigest.c Responder.c PlatformCommon.c
OBJSCALL = $(OBJS)
CFLAGS_OS = -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX
CFLAGS += -DPID_FILE=\"/var/run/mdnsd.pid\"
-DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\"
CFLAGS += -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DNOT_HAVE_DAEMON
CFLAGS += -Wall
CFLAGS += -I$(INCLUDEDIR)
$(OBJSDIR)/$(EXEC)/%.o : %.c
$(SCRIPTDIR)/mkdirs $(OBJSDIR)/$(EXEC)/$(CFILES)
$(CC) -c $(CFLAGS) $< -o $@
all: $(EXEC)
$(EXEC): $(OBJS)
$(CC) $(LDFLAGS) -o $(OBJSDIR)/$(EXEC)/$@ $(OBJS) $(LDLIBS)
romfs:
$(ROMFSINST) $(OBJSDIR)/$(EXEC)/$(EXEC) /bin/$(EXEC)
clean:
-rm -f $(OBJSDIR)/$(EXEC)/$(EXEC) $(OBJSDIR)/$(EXEC)/*.elf
$(OBJSDIR)/$(EXEC)/*.gdb $(OBJSDIR)/$(EXEC)/*.o
Labels:
APPLE BONJOUR,
Bonjour Service,
Coldfire,
M5272,
Port to uClinux,
Uclinux
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment