[oe] Getting Started -Makefile
David Farning
dfarning at gmail.com
Mon Nov 19 12:08:19 UTC 2007
I think that my getting started Makefile is ready for testing.
To setup a development BitBake\OpenEmbedded system:
##Do not run this from an existing bb/oe directory. It will##
##overwrite parts of your local.conf. ##
make a new test directory
change to the test directory
copy Makefile to directory
$make setup
$make build-package-vim
This eliminates many of problems the new users have setting up bb
and oe. There is no need to know any thing about svn of monotone.
I am caching sources in HOME to reduce traffic while testing.
I am still working on the quem testing image setup so I did not
include it.
Thanks
David Farning
# "Makefile" - a Makefile for setting up OpenEmbedded builds
#
# Copyright (c) 2007 David Farning <dfarning at gmail.com>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
# 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.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA
#
# Thanks to Rod Whitby for the OpenMokoMakefile
# Set BITBAKE_SVN_REV to either HEAD or 1.8
BITBAKE_SVN_REV = HEAD
ifeq ("${BITBAKE_SVN_REV}","HEAD")
BB_SVN_PATH := bitbake/trunk/bitbake
else
BB_SVN_PATH := bitbake/branches/bitbake-1.8
endif
MTN := mtn
#Set OPENEMBEDDED_MTM_REV to either head of a specific revision
OPENEMBEDDED_MTN_REV = HEAD
ifneq ("${OPENEMBEDDED_MTN_REV}","HEAD")
OPENEMBEDDED_REV_FLAGS = -r ${OPENEMBEDDED_MTN_REV}
endif
OE_SNAPSHOT_SITE := http://www.openembedded.org/snapshots
MACHINE := qemux86
DISTRO := angstrom-2007.1
CWD := pwd
###############################################################################
# Setup
###############################################################################
.PHONY: setup
setup: setup-bitbake setup-mtn setup-openembedded setup-config setup-env
.PHONY: setup-bitbake
setup-bitbake stamps/bitbake:
[ -e stamps/bitbake ] || \
( svn co -r ${BITBAKE_SVN_REV} svn://svn.berlios.de/${BB_SVN_PATH} bitbake )
[ -d stamps ] || mkdir stamps
touch stamps/bitbake
OE.mtn:
if [ -z "`${MTN} --version | awk '{ print $$2; }'`" ] ; then \
echo 'Cannot determine version for monotone using "${MTN} --version"' ; \
false ; \
fi
[ -e OE.mtn ] || \
( ( version=`${MTN} --version | awk '{ print $$2; }'` ; \
wget -c -O OE.mtn.bz2 \
${OE_SNAPSHOT_SITE}/OE-this-is-for-mtn-$$version.mtn.bz2 || \
wget -c -O OE.mtn.bz2 \
${OE_SNAPSHOT_SITE}/OE.mtn.bz2 ) && \
bunzip2 -c OE.mtn.bz2 > OE.mtn.partial && \
mv OE.mtn.partial OE.mtn )
.PHONY: setup-mtn
setup-mtn stamps/OE.mtn:
[ -e OE.mtn ] || \
${MAKE} OE.mtn
[ -e stamps/OE.mtn ] || \
( ${MTN} --db=OE.mtn db migrate && \
${MTN} --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev )
[ -d stamps ] || mkdir stamps
touch stamps/OE.mtn
.PHONY: setup-openembedded
setup-openembedded stamps/openembedded: stamps/OE.mtn
[ -e stamps/openembedded ] || \
( ${MTN} --db=OE.mtn checkout --branch=org.openembedded.dev \
${OPENEMBEDDED_REV_FLAGS} openembedded ) || \
( ${MTN} --db=OE.mtn checkout --branch=org.openembedded.dev \
-r `${MTN} --db=OE.mtn automate heads org.openembedded.dev | head -n1` openembedded )
[ -d stamps ] || mkdir stamps
touch stamps/openembedded
.PHONY: setup-config
setup-config build/conf/local.conf:
[ -e build/conf/local.conf ] || \
( mkdir -p build/conf; \
cp openembedded/conf/local.conf.sample build/conf/local.conf; \
sed -i -e 's/^#[[:space:]]*MACHINE[[:space:]]*=[[:space:]]*\".*\"/MACHINE = \"${MACHINE}\"/' build/conf/local.conf; \
sed -i -e 's/^#[[:space:]]*DISTRO[[:space:]]*=[[:space:]]*\".*\"/DISTRO = \"${DISTRO}\"/' build/conf/local.conf; \
sed -i -e 's|BBFILES := "$${@bb.*|BBFILES := "${shell pwd}/openembedded/packages/*/*.bb"|' build/conf/local.conf; \
sed -i -e 's|# EDIT THIS FILE.*||' build/conf/local.conf; \
sed -i -e 's|REMOVE_THIS_LINE.*||' build/conf/local.conf; )
setup-env:
[ -e setup-env ] || \
echo 'export OEDIR="'`pwd`'"' > setup-env
echo \
'export BBPATH="$${OEDIR}/build:$${OEDIR}/openembedded"' >> setup-env
echo \
'export PATH="$${OEDIR}/bitbake/bin:$${PATH}"' >> setup-env
###############################################################################
# Update
###############################################################################
.PHONY: update
update: update-bitbake update-mtn update-openembedded
.PHONY: update-bitbake
update-bitbake: stamps/bitbake
cd bitbake && svn update -r ${BITBAKE_SVN_REV}
.PHONY: update-mtn
update-mtn: stamps/OE.mtn
if [ "${OPENMOKO_MTN_REV}" != "`(cd openembedded && ${MTN} automate get_base_revision_id)`" ] ; then \
${MTN} --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev ; \
fi
.PHONY: update-openembedded
update-openembedded: update-mtn stamps/openembedded
( cd openembedded && ${MTN} update ${MTN_REV_FLAGS} ) || \
( cd openembedded && ${MTN} update \
-r `${MTN} automate heads | head -n1` )
###############################################################################
# Build Tests
###############################################################################
#FIXME build sdk should sdk be what I have been calling the cross compiler + tools?
#FIXME build test package
#FIXME build test distro
#FIXME build test qemu image
###############################################################################
# Build Package
###############################################################################
.PHONY: build-package-%
build-package-%: setup
( . ./setup-env \
&& echo $$PATH \
&& echo $$BBPATH \
&& bitbake -c build $* )
.PHONY: rebuild-package-%
rebuild-package-%: setup
( . ./setup-env && bitbake -c rebuild $* )
.PHONY: clean-package-%
clean-package-%: setup
( . ./setup-env && bitbake -c clean $* )
###############################################################################
# Clean
###############################################################################
.PHONY: clean
clean: clean-openembedded
.PHONY: clean-openembedded
clean-openembedded:
rm -rf tmp
###############################################################################
# Clobber
###############################################################################
.PHONY: clobber
clobber: clobber-bitbake clobber-openembedded clobber-config clobber-env
.PHONY: clobber-bitbake
clobber-bitbake:
rm -rf bitbake stamps/bitbake
.PHONY: clobber-openembedded
clobber-openembedded: clean-openembedded
rm -rf openembedded stamps/openembedded
.PHONY: clobber-config
clobber-config:
rm -rf build/conf/local.conf
.PHONY: clobber-env
clobber-env:
rm -rf setup-env
More information about the Openembedded-devel
mailing list