Home Forum Developers IP0x Experience building on Ubuntu Lucid 10.04

JRPassphrase Registration Control

In order to register on this site, you must first submit the passphrase below.

TODO list for each hardware target can be found as sticky topic in the corresponding forum


hads
useravatar
User Info

Experience building on Ubuntu Lucid 10.04

Well done to everyone on the excellent work with switchfin.

Just thought I would post on my experience building on Ubuntu Lucid.

I checked out switchfin trunk, installed the following dependencies;

sudo apt-get install build-essential liblzo2-dev ncurses-dev zlib1g-dev uuid-dev

with `make menuselect` I chose, Asterisk 1.6, GUI 4.0 and added vim, curl and dhcpd.

I then issued `make` which got a long way through but failed in;

/home/hads/switchfin/build_ip04/uClinux-dist/lib/libcurl/Makefile

In that file I changed libcurl.so.4 to libcurl.so.5 and was able to complete the build.

Cheers,

hads



Edited By:  admin
Jun-30-11 15:42:43

Administrator has disabled public posting
admin
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Hads,

Thank you for sharing the dependencies you had to install.

Keep in mind that:
-Asterisk 1.6 is still experimental. For production environments please use Asterisk 1.4 (1.4.32 at this moment) 
-vim is pretty big and seems to have some issues. I would recommend using vi which is built in.
-GUI 4.0 is getting our standard so seems to be a good choice for IP0x. (We may need to test it some more for BR4 and PR1 Appliances however)   
     
Best Regards
Dimitar


Administrator has disabled public posting
hads
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Dimitar,

Thanks for your thoughts.

I am not using this in a production environment yet - we sell the IP0x range over here in New Zealand so I am just testing things out.

I have added dnsmasq to my local build here (adapted from David Rowe's BAPS build) as an alternative to dhcpd from busybox. I believe it will be useful with regards to provisioning phones. Are you interested in my modifications?

Again, excellent work on Switchfin.

Cheers,

hads


Administrator has disabled public posting
hads
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Someone asked in a private message about it so here is the patch to add dnsmasq to trunk. Note that I haven't tested it yet but it builds and it shows basically how to add a package to the build system.

Code:

Index: package/dnsmasq/dnsmasq.sh

===================================================================
--- package/dnsmasq/dnsmasq.sh    (revision 0)
+++ package/dnsmasq/dnsmasq.sh    (revision 0)
@@ -0,0 +1,2 @@
+dnsmasq -d >/dev/null 2>/dev/null &
+
Index: package/dnsmasq/Config.in
===================================================================
--- package/dnsmasq/Config.in    (revision 0)
+++ package/dnsmasq/Config.in    (revision 0)
@@ -0,0 +1,18 @@
+#########################################################################
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# The Free Software Foundation; version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# Copyright @ 2010 SwitchFin <dpn@switchfin.org>
+#########################################################################
+
+config SF_PACKAGE_DNSMASQ
+    bool "dnsmasq"
+    default n
+    help
+        Dnsmasq DNS forwarder and DHCP server
+
Index: package/dnsmasq/dnsmasq.mk
===================================================================
--- package/dnsmasq/dnsmasq.mk    (revision 0)
+++ package/dnsmasq/dnsmasq.mk    (revision 0)
@@ -0,0 +1,49 @@
+#########################################################
+# dnsmasq.mk
+# Jose Luis Duran June 2009
+#
+# 13 Jun 2010 adopted from BAPS by hads
+# Copyright @ 2010 SwitchFin <dpn@switchfin.org>
+#########################################################
+
+DNSMASQ_VERSION=2.55
+DNSMASQ_SITE=http://thekelleys.org.uk/dnsmasq
+DNSMASQ_SOURCE=dnsmasq-$(DNSMASQ_VERSION).tar.gz
+DNSMASQ_DIR=$(BUILD_DIR)/dnsmasq-$(DNSMASQ_VERSION)
+
+DNSMASQ_COPTS=-DNO_IPV6 -DNO_TFTP -DNO_LARGEFILE -DHAVE_BROKEN_RTC \
+        -D__uClinux__
+
+$(DL_DIR)/$(DNSMASQ_SOURCE):
+    mkdir -p dl
+    wget -P $(DL_DIR) $(DNSMASQ_SITE)/$(DNSMASQ_SOURCE)
+
+$(DNSMASQ_DIR)/.unpacked: $(DL_DIR)/$(DNSMASQ_SOURCE)
+    zcat $(DL_DIR)/$(DNSMASQ_SOURCE) | tar -C $(BUILD_DIR) -xf -
+    touch $(DNSMASQ_DIR)/.unpacked
+
+dnsmasq: $(DNSMASQ_DIR)/.unpacked
+    make -C $(DNSMASQ_DIR) CC=bfin-linux-uclibc-gcc \
+        COPTS='$(DNSMASQ_COPTS)' \
+        BINDIR=/bin DESTDIR=$(TARGET_DIR) install
+    mkdir -p $(TARGET_DIR)/var/lib/misc
+    rm -rf $(TARGET_DIR)/usr
+    cp -f $(DNSMASQ_DIR)/dnsmasq.conf.example $(TARGET_DIR)/etc/dnsmasq.conf
+    touch $(DNSMASQ_DIR)/.built
+    mkdir -p $(TARGET_DIR)/etc/autorun
+    cp -fv package/dnsmasq/dnsmasq.sh $(TARGET_DIR)/etc/autorun
+
+all: dnsmasq
+
+dnsmasq-dirclean:
+    rm -rf $(DNSMASQ_DIR)
+
+################################################
+#
+# Toplevel Makefile options
+#
+#################################################
+ifeq ($(strip $(SF_PACKAGE_DNSMASQ)),y)
+TARGETS+=dnsmasq
+endif
+
Index: package/Config.in
===================================================================
--- package/Config.in    (revision 245)
+++ package/Config.in    (working copy)
@@ -40,5 +40,6 @@
source "package/vim/Config.in"
source "package/bonjour/Config.in"
source "package/curl/Config.in"
+source "package/dnsmasq/Config.in"
endmenu


Administrator has disabled public posting
Albi90
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Looks good Hads!!

Did you see the All Whites Play last night!!! was a good game :-)


Administrator has disabled public posting
hads
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Fantastic game, good on the All Whites! smile


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Thanks Hads for the document. It looks like a patch ("@@ -0,0 +1,2 ") file to the tree.

Is there a HOWTO either here or elsewhere that explains how to add a "Hello, world" C source to the Switchfin source tree in ./package/ for inclusion in the uImage?

This article on the uClinux-dist Blackfin site shows how to compile the source into a binary and then include the binary in the buildroot, but if possible, I'd rather include an application as source code in the /package sub-dir in the Switchin source tree.

Thank you.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

I found this document in the uClinux-dist, but I notice that the directory structure is different in Switchfin (where apps are added under ./package/)

/usr/src/uClinux-dist/Documentation/Adding-User-Apps-HOWTO


Administrator has disabled public posting
hads
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

No problem. You are correct it is a patch, generated from `svn diff` after adding and editing the necessary files.

This is how you add a source package to the build though. If you apply the patch to your tree then it will create the files needed. The lines of the patch like so;

Index: package/dnsmasq/dnsmasq.sh

show the file that is referred to, this one will be created as it doesn't exist in the main tree.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Got it. 'svn diff' is required to build a patch before sending it to the Switchfin team for possible inclusion in the SVN tree on the server.

So apparently, to add a new package:

1. Under ./package/, create a sub-dir for the new package:
mkdir ./package/mypackage/

2. In this sub-dir, create the following files:
mypackage.sh
Config.in
mypackage.mk

3. Edit ./package/Config.in


Administrator has disabled public posting
hads
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Right on.

Of course you'll need to change the files to suit what you're downloading and building, and the mypackage.sh file is just used here as a crude method of starting a daemon at boot but all the gory details are in the files and they shouldn't be too hard to follow once you get the hang of things.

hads


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

OK, diver down. Thanks a lot.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

In ./package/Config.in, I notice that no library (libxml, sqlite3, etc.) is included.

Does it mean that they are always included in the image, and if yes, in which file is this set?


Administrator has disabled public posting
admin
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Guys,

This thread looks like a good tutorial about adding new package in Switchfin.
I think it will be good to add it in the FAQ section.
hads/gilles do you want me to give you an write permission for the site so you add it.

Hads how is dnsmasq going? Did you have time to test it?
I still haven't got a chance to take a look ... some emotional burden around wink

Best Regards
Dimitar


Administrator has disabled public posting
hads
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Dimitar,

Unfortunately I haven't had any time to test dnsmasq yet, our household has been ill so I haven't done much of anything. Hopefully this weekend.

If you want I can add it to the FAQ section for you when I get a chance.

All the best,

Hadley


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Since I have time and working full-time on learning how to build Switchfin and adding to it the applications I need, I make sure I document everything I learn along the way so that could be used as material for a FAQ.


Administrator has disabled public posting
hads
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Great stuff, if you want to do it then I'm more than happy, one less thing for me smile


Administrator has disabled public posting
admin
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Guys,

I made you both publisher. smile

Please let me know if everything is OK and you can publish/edit stuff on this site.
If issues. Please let me know.

Cheers
Dimitar


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Thank you.

Another couple of questions after spending the evening going through the Switchfin source code and before going to bed:

1. Due to differences between x86/Linux and Blackfin/uClinux, applications may need to be modified (use of malloc(), fork(), etc.)

In ./package/, I noticed that some applications have ".patch" files: Is it to modify the source code to make it Blackfin/uClinux-compatible? If so, why not modify the source code directly and send the patches to the original author of the application?

2. Still in ./package/, I noticed that some applications have both ".mk" and "Config.in", some have just "Config.in", while others have just ".mk":
- Why three different situations?
- I thought ".mk" where used to turn a compiled application into a BAPS package. Is this the case here, or are ".mk" also used for other uses?

Thank you.


Administrator has disabled public posting
Albi90
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Gilles

The Config.in files contain settings used in Switchfin make menu for example
this is a section of package/asterisk/Config.in

Code:


config SF_PACKAGE_ASTERISK
    bool "Asterisk"
    default y
    help
        Open source PBX
choice
        prompt "Asterisk version"
        default SF_ASTERISK_1_4
        depends on SF_PACKAGE_ASTERISK

config SF_ASTERISK_1_4
        bool "Asterisk 1.4"
        depends on SF_PACKAGE_ASTERISK
        help
          Asterisk 1.4 recommend for production boxes

if you look in the "make menuconfig" you will see asterisk with a choice of 1.4 or 1.6 (1.4 is the default as its defined in the above Config.in)
So each selectable application will have a Config.in associated to it this file will be referenced in the package/Config.in like so

Code:


comment "Asterisk"
source "package/asterisk/Config.in"

The .mk files on the other hand are the make files called by the SwitchFin make system to unpack, compile and install the application.
NOTE at each stage of the make blank files are touched (.unpacked and .configured) to the build dirs to tell the installer not unpack or configure the file next make.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Thanks Albi.

So to be displayed in "make menuconfig", and then compiled into ./package/myapp/src/ and ultimately added to the image, each application in ./package/ must have a Config.in and a .mk file.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

More questions:

1. ./package/ : If a package has only a .mk file and no Config.in, is this because the package hasn't been integrated in Switchfin yet, ie. left-over from Astfin?

2. Who takes cares of rewriting applications and its Makefile so that those packages compile and run OK on a Blackfin + uClinux platform? Are those applications taken from OpenWrt/DD-Wrt projects? Is this the best locations where I should head to find applications that could run on the Blackfin + uClinux?

Thank you.


Administrator has disabled public posting
admin
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Gilles,

1. Well Config.in is used for creation of the menuconfig structure.
If you see directory in ./package/ without Config.in it just means that we don't provide option to the user to enable/disable/adjust but the *.mk file will be included in the building process.
All the ./package/xxx represent given package and should be functional.
 
2. It is the coresponding mk file which downloads and patches the source code so it can be compiled/installed by the Blackfin toolchain.
 
Thanks
Dimitar


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Thanks for the clarification. The reason I asked, is that I saw that the SQLite3 package had an .mk but no Config.in, so was wondering if that was intentional (eg. not ready to be included to Switchfin).

Besides the difficulty of finding applications that have been modified to run on Blackfin + uClinux, I'm concerned about the reliability of those changes and ending up with fragmented memory after a while :-/

For those of you using Atcom appliances in the field, have you had problems with this? I was thinking of writing a CRON job to reboot the unit every night to reduce the risk/consequences of fragmented memory.


Administrator has disabled public posting
Albi90
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Hi Gilles

The procwatch app in the latest SVN should solve this issue and also reboot the PBX if asterisk dies for some reason.


Administrator has disabled public posting
Gilles
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Thanks for the tip.


Administrator has disabled public posting
luckman212
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

Do we need to do any custom configuration to enable this watchdog function, or is simply checking it off in the menuconfig enough? 

also Gilles have you had any success yet in adding new packages to switchfin?  I am most curious about this, as I desperately would like to add mpg123 to the switchfin and see if it can run in a simple way.  Please do let me know if you had any luck.


Administrator has disabled public posting
Albi90
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

enabling it in the menuconfig will turn procwatch on by default.
Why do you want mpg123??


Administrator has disabled public posting
luckman212
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

It would be great to have Jason,
here is my other post about it
http://switchfin.org/index.php?option=c … ;Itemid=54


Administrator has disabled public posting
rterbush
useravatar
User Info

Re: Experience building on Ubuntu Lucid 10.04

I'd like to add my +1 for inclusion of dnsmasq in the add-on packages. I've included a patch for the current trunk. Had some whitespace problems with the original patch. Not sure if that was artifact of cut and paste or what.

Code:



Index: package/dnsmasq/dnsmasq.sh
===================================================================
--- package/dnsmasq/dnsmasq.sh  (revision 0)
+++ package/dnsmasq/dnsmasq.sh  (revision 0)
@@ -0,0 +1,2 @@
+dnsmasq -d >/dev/null 2>/dev/null &
+
Index: package/dnsmasq/Config.in
===================================================================
--- package/dnsmasq/Config.in   (revision 0)
+++ package/dnsmasq/Config.in   (revision 0)
@@ -0,0 +1,17 @@
+#########################################################################
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# The Free Software Foundation; version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# Copyright @ 2010 SwitchFin <dpn@switchfin.org>
+#########################################################################
+
+config SF_PACKAGE_DNSMASQ
+       bool "dnsmasq"
+       default n
+       help
+       Dnsmasq DNS forwarder and DHCP server
Index: package/dnsmasq/dnsmasq.mk
===================================================================
--- package/dnsmasq/dnsmasq.mk  (revision 0)
+++ package/dnsmasq/dnsmasq.mk  (revision 0)
@@ -0,0 +1,49 @@
+#########################################################

+# dnsmasq.mk
+# Jose Luis Duran June 2009
+#
+# 13 Jun 2010 adopted from BAPS by hads
+# Copyright @ 2010 SwitchFin <dpn@switchfin.org>
+#########################################################
+
+DNSMASQ_VERSION=2.55
+DNSMASQ_SITE=http://thekelleys.org.uk/dnsmasq
+DNSMASQ_SOURCE=dnsmasq-$(DNSMASQ_VERSION).tar.gz
+DNSMASQ_DIR=$(BUILD_DIR)/dnsmasq-$(DNSMASQ_VERSION)
+
+DNSMASQ_COPTS=-DNO_IPV6 -DNO_TFTP -DNO_LARGEFILE -DHAVE_BROKEN_RTC \
+       -D__uClinux__
+
+$(DL_DIR)/$(DNSMASQ_SOURCE):
+       mkdir -p dl
+       wget -P $(DL_DIR) $(DNSMASQ_SITE)/$(DNSMASQ_SOURCE)
+
+$(DNSMASQ_DIR)/.unpacked: $(DL_DIR)/$(DNSMASQ_SOURCE)
+       zcat $(DL_DIR)/$(DNSMASQ_SOURCE) | tar -C $(BUILD_DIR) -xf -
+       touch $(DNSMASQ_DIR)/.unpacked
+
+dnsmasq: $(DNSMASQ_DIR)/.unpacked
+       make -C $(DNSMASQ_DIR) CC=bfin-linux-uclibc-gcc \
+       COPTS='$(DNSMASQ_COPTS)' \
+       BINDIR=/bin DESTDIR=$(TARGET_DIR) install
+       mkdir -p $(TARGET_DIR)/var/lib/misc
+       rm -rf $(TARGET_DIR)/usr
+       cp -f $(DNSMASQ_DIR)/dnsmasq.conf.example $(TARGET_DIR)/etc/dnsmasq.conf
+       touch $(DNSMASQ_DIR)/.built
+       mkdir -p $(TARGET_DIR)/etc/autorun
+       cp -fv package/dnsmasq/dnsmasq.sh $(TARGET_DIR)/etc/autorun

+
+all: dnsmasq
+
+dnsmasq-dirclean:
+       rm -rf $(DNSMASQ_DIR)
+
+################################################
+#
+# Toplevel Makefile options
+#
+#################################################
+ifeq ($(strip $(SF_PACKAGE_DNSMASQ)),y)
+TARGETS+=dnsmasq
+endif
+
Index: package/Config.in
===================================================================
--- package/Config.in   (revision 286)
+++ package/Config.in   (working copy)
@@ -42,6 +42,7 @@
source "package/vim/Config.in"
source "package/bonjour/Config.in"
source "package/curl/Config.in"
+source "package/dnsmasq/Config.in"
source "package/procwatch/Config.in"
source "package/libtiff/Config.in"
source "package/lua/Config.in"


Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 2587  Total Topics: 299  Total Polls: 1  Total Posts: 1727  Dormant
User Info:   Newest User :  user2553   Members Online: 0   Guests Online: 233
Online  There are no members online
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked