$ cat eix-update-wrapper
修改 gentoo-openmoko 的tools目录下的eix-wrapper,方便实现 eix-update功能
使用方法:
eix-update-wrapper --init
armv4tl-softfloat-linux-gnueabi-eix-update
$ ./eix-armv4tl-softfloat-linux-gnueabi -e openrc
[I] sys-apps/openrc
Available versions: (~)0.4.3-r3[1] ~0.6.0 **9999 {debug elibc_glibc kernel_FreeBSD kernel_linux ncurses pam unicode}
Installed versions: 0.4.3-r3[1](00时01分24秒 2009年12月27日)(elibc_glibc kernel_linux ncurses pam unicode -debug -kernel_FreeBSD)
Homepage: http://roy.marples.name/openrc
Description: OpenRC manages the services, startup and shutdown of a host
[1] "openmoko-target" /usr/local/portage/layman/openmoko/trunk/openmoko-target
$ emerge-armv4tl-softfloat-linux-gnueabi -pv udev
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R ] sys-fs/udev-146-r1 to /usr/armv4tl-softfloat-linux-gnueabi/ USE="devfs-compat -extras (-selinux)" 0 kB [1]
Total: 1 package (1 reinstall), Size of downloads: 0 kB
Portage tree and overlays:
[0] /usr/portage
[1] /usr/local/portage/layman/openmoko/trunk/openmoko-target
看来gentoo 做嵌入式还是很棒的,有eix工具比 openembedded查包信息好太多了,不过还是常遇到编译失败的情况,看来有空还是要学一下 autoconf, automake这些东东,下午看了一下 libtool 挺不错的玩意,要是用cmake的话可能会更简单一些吧
#!/bin/bash
# Copyright 2008-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: Exp $
# - solar
# - sleipnir
cross_wrap_etc() {
local chost=$1
conf=/usr/$chost/etc/eixrc.conf
echo "EIX_PREFIX=/usr/$chost" >> ${conf}
echo "EXEC_EBUILD_SH=/usr/$chost/usr/lib/portage/bin/ebuild.sh" >> ${conf}
}
cross_update_init() {
bn=$(basename $0)
[[ $bn != eix-update-wrapper ]] && { echo "I wont understand things" ; exit 1; }
dn=$(dirname $(readlink -f $0))
chosts=$(gcc-config -l | awk '{print $2}'| grep -- -| cut -d '-' -f 1-4| sort -u)
cd $dn || { echo "Failed to cd to $dn" ; exit 1; }
export overlay=$(portageq envvar PORTDIR_OVERLAY)
#cross_wrap_etc $chost
#EIX_PREFIX=/usr/${CHOST} eix-update
for chost in $chosts; do
[[ $chost == $CBUILD ]] && continue
[[ $(type -p ${chost}-gcc) == "" ]] && continue
echo " * Setting up symlinks for $chost"
ln -sf eix-update-wrapper eix-update-${chost}
#ln -sf eix-update-wrapper ${chost}-eix-update
#ln -sf eix-wrapper ${chost}-eix
# if [ -d /usr/${chost} ] ; then
# if [[ ! -f /usr/${chost}/etc/eixrc.conf ]]; then
# echo " * Setting up cross basics in /usr/${chost}/etc"
# cross_wrap_etc $chost
# fi
# fi
done
}
# CBUILD must be the first thing we export
export CBUILD=$(portageq envvar CBUILD)
if [[ $1 == "--init" ]]; then
cross_update_init
exit 0
fi
CHOST=$(basename $0)
CHOST=${CHOST/-eix-update}
CHOST=${CHOST/eix-update-}
export CHOST
if [[ $CHOST == wrapper ]]; then
if [[ $1 == "--target" ]]; then
export CHOST=$2
shift 2
else
echo "After running this program with the --init option as root"
echo "you can call it directly like eix-wrapper --target CHOST <emerge options>"
echo "or using the emerge-CHOST wrappers"
exit 1
fi
fi
[[ $(type -p ${CHOST}-gcc) == "" ]] && { echo "You need to 'crossdev $CHOST' first" ; exit 1; }
EIX_PREFIX=/usr/${CHOST} eix-update
转载于:https://blog.51cto.com/axlrose/1287290