Skip to content

Feeds: What or How do you use them?

ronniebrash edited this page Dec 3, 2015 · 10 revisions

The IntelliPi project leverage's a software distribution process (for those who have used Linux or apt-get like facilities) similar to repository listings called feeds.

Borrowing liberally from the OpenWRT documentation (IntelliPi is built upon this distro/collage), a more concrete explanation of what a feed is as follows:

In OpenWrt, a "feed" is a collection of packages which share a common location. Feeds may reside on a remote server, in a version control system, on the local filesystem, or in any other location addressable by a single name (path/URL) over a protocol with a supported feed method.

Feeds basics

Now that you know what a feed is, feeds work like an index which can be updated and installed - while being controlled by a file which contains which feeds to receive updates from. This file is called: feeds.conf.default

Which contains definitions such as:

src-git nonatlants https://github.com/AtlantsEmbedded/feed-nonatlants.git

src-git atlants https://github.com/AtlantsEmbedded/feed-atlants.git

These feeds once updated and installed through the following commands, let the menuconfig utility know which software/features are able to be built and installed into your IntelliPi image.

./scripts/feeds update -a

./scripts/feeds install -a

How do I add my own local feed?

Creating a custom local feed doesn't necessarily need to include of the following files, but for example completeness, we have included some source code and Makefiles.

Create a directory for source code

mkdir src

Create a directory for package inside src directory, add main file and Makefile.

mkdir Package_name

Add a main.c and Makefile (contents following) inside the package directory.

MAKEFILE      = Makefile

####### Compiler, tools and options

CC            = $(CC)
CXX           = $(CC)
DEFINES       = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS        = -pipe -O2 -Wall -W -D_REENTRANT -fPIE $(DEFINES)
CXXFLAGS      = -pipe -O2 -Wall -W -D_REENTRANT -fPIE $(DEFINES)
INCPATH       = -Iinclude $(STAGING_DIR)/include
LINK          = $(CC)
LFLAGS        = -L$(STAGING_DIR)/lib
LIBS          = -lwiringPi -lwiringPiDev
AR            = ar cqs
RANLIB        = 
TAR           = tar -cf
COMPRESS      = gzip -9f
COPY          = cp -f
SED           = sed
COPY_FILE     = cp -f
COPY_DIR      = cp -f -R
STRIP         = strip
INSTALL_FILE  = install -m 644 -p
INSTALL_DIR   = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE      = rm -f
SYMLINK       = ln -f -s
DEL_DIR       = rmdir
MOVE          = mv -f
CHK_DIR_EXISTS= test -d
MKDIR         = mkdir -p

####### Output directory

OBJECTS_DIR   = ./

####### Files

SOURCES       = main.c 
OBJECTS       = main.o

# Target is the resulting binary or executable after compiling and linking your code
TARGET        = myBinary


first: all
####### Implicit rules

.SUFFIXES: .o .c .cpp .cc .cxx .C

.cpp.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.cc.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.cxx.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.C.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.c.o:
	$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"

####### Build rules

all: Makefile $(TARGET)

$(TARGET):  $(OBJECTS)  
	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

clean:compiler_clean 
	-$(DEL_FILE) $(OBJECTS)
	-$(DEL_FILE) *~ core *.core


distclean: clean 
	-$(DEL_FILE) $(TARGET) 

####### Compile

main.o: main.c
	$(CC) -c $(CFLAGS) $(INCPATH) -o main.o main.c

####### Install

install:   FORCE

uninstall:   FORCE

FORCE:

Create a directory for feeds and add Makefile for openwrt:

mkdir feeds

mkdir feeds/customfeed

mkdir feeds/customfeed/Package_name

Create Makefile for openwrt inside Package_name directory

include $(TOPDIR)/rules.mk
	
#including the package name, version, release
PKG_NAME:= Package_name
PKG_VERSION:=2014-26-14
PKG_RELEASE:=1
PKG_SOURCE_SUBDIR:=$(PKG_NAME)

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk

#defining the package
define Package/ Package_name
	SECTION:=Utilities
	CATEGORY:=Atlants-GPL
	TITLE:= Package_name
	SUBMENU:=Utilities
	DEPENDS:=+wiringPi
endef

#Adding a description about the package
define Package/ Package_name /description
	This is my first package
endef

#copying symbolic link into (PKG_BUILD_DIR)
# copying the link of the package to the package build directory
define Build/Prepare
	cp -R /home/user/src/ Package_name /* $(PKG_BUILD_DIR)
endef

define Package/ Package_name /install
	$(INSTALL_DIR) $(1)/usr
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ <binary name here> $(1)/usr/bin
endef

$(eval $(call BuildPackage, Package_name)

Adding the local custom feeds to existing one

Open intelliroot directory and edit intelliroot/feeds.conf.default

Add new line (based on the above example)

src-link customfeed /home/user/feeds/customfeed

Updating and installing the newly added feeds

./scripts/feeds update -a

./scripts/feeds install -a

Using make menuconfig, we can add the package to the image

Binary can be found in the path intelliroot/build_dir/target-arm-1176jzf-s+vfp_uClibc-0.9.33.2_eabi/myBeeper

Building a single package

make package/ Package_name/compile

make package/ Package_name/install

make package/index

Newly build package can be found in bin/directory

Extended documentation

For more information about feeds and the functionality OpenWRT provides around this, please checkout their official documentation.