Success! Subscription added.
Success! Subscription removed.
Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your profile.
Before you do the porting, you should check if if the apps/libs are already ported in uClinux-dist (uclinux.org) or Blackfin uclinux-dist.
If none exist, you can add the apps/libs into uClinux-dist. The uClinux-dist uses the build system from Linux kernel, with Kconfig and Makefile. You will need to add an config entry in Kconfig, and a rule in Makefile. Please read about Kconfig in the file nios2-linux/linux-2.6/Documentation/kbuild/kconfig-language.txt.
Take the hello apps example,
1. edit file user/Kconfig, add an entry after the line of menu "Miscellaneous Applications",
config USER_HELLO_HELLO
bool "hello"
help
The hello example
2. add a line to user/Makefile , dir_$(CONFIG_USER_HELLO_HELLO) += hello
3. mkdir ~/uClinux-dist/user/hello
put hello.c in user/hello dir,
4. create Makefile in user/hello dir,
EXEC = hello
OBJS = hello.o
all: $(EXEC)
$(EXEC): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
romfs:
$(ROMFSINST) /bin/$(EXEC)
clean:
-rm -f $(EXEC) *.elf *.gdb *.o
In nios2 uclinux, a staging dir is created at built time, and libs/apps are installed to this dir. Then "make romfs" will copy them to "romfs" dir.
This is very similar to the staging dir of "buildroot".
You may take exmples from user/net-snmp, lib/libgmp.
In user/net-snmp, there are
Makefile net-snmp-5.2.1
In lib/libgmp, there are
gmp-4.2.2 Makefile
The sources are located in a subdir, and a Makefile is added to build and install. You should take a look at the Makefile.
all: build-$(VER)/Makefile
$(MAKE) -C build-$(VER) install DESTDIR=$(STAGEDIR)
Many packages use to configure or automake/autoconf tools. Please find documents about them from gnu.org or Redhat's.
GNU Autoconf, Automake, and Libtool (http://sources.redhat.com/autobook/ )
You can find out options with "./configure --help".
If you got unknow machine type error, add nios2 to config.sub .
--- config.sub~ 2003-12-23 20:07:13.000000000 +0800
+++ config.sub 2006-07-12 14:47:00.000000000 +0800
@@ -278,6 +278,11 @@
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
+ nios2 | nios2-* | nios2 | nios2-*)
+ basic_machine=nios2-altera
+ os=-linux
+ ;;
+
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
Many packages use autotools to configure. The configure option is defined in uClinux-dist/vendors/Altera/nios2/config.arch,
CONFIGURE_HOST = nios2-linux-uclibc
CONFIGURE_SHARED_ENABLE := --disable-shared
CONFIGURE_SHARED_WITH := --without-shared
CONFIGURE_BUILD := $(shell sh $(ROOTDIR)/tools/config.guess)
CONFIGURE_OPTS := \\\\\\\
--host=$(CONFIGURE_HOST) \\\\\\\
--build=$(CONFIGURE_BUILD) \\\\\\\
--prefix=/usr \\\\\\\
--sysconfdir=/etc \\\\\\\
--datadir=/usr/share \\\\\\\
--mandir=/usr/share/man \\\\\\\
--infodir=/usr/share/info \\\\\\\
--localstatedir=/var/lib \\\\\\\
$(CONFIGURE_SHARED_ENABLE) \\\\\\\
$(CONFIGURE_SHARED_WITH) \\\\\\\
--disable-dependency-tracking \\\\\\\
--enable-fast-install
ifneq ($(findstring s,$(MAKEFLAGS)),)
CONFIGURE_OPTS += --quiet
endif
You may use the uClinux-dist/tools/autotools.mk to port packages. Please look at the Makefile of,
lib/flex/Makefile:include $(ROOTDIR)/tools/autotools.mk
lib/ncurses/Makefile:include $(ROOTDIR)/tools/autotools.mk
lib/libpng/Makefile:include $(ROOTDIR)/tools/autotools.mk
lib/lzo/Makefile:include $(ROOTDIR)/tools/autotools.mk
fork() is not supported for nommu, so you should use vfork() instead.
These func are marked legacy. They should not be used. You can replace them with memmove/memset/strchr/strrchr.
Community support is provided during standard business hours (Monday to Friday 7AM - 5PM PST). Other contact methods are available here.
Intel does not verify all solutions, including but not limited to any file transfers that may appear in this community. Accordingly, Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.
For more complete information about compiler optimizations, see our Optimization Notice.