Yocto Toolchain编译busybox
本文采用的是飞凌OKMX6DL-C开发板提供的Yocto工具
安装路径:/opt/fsl-imx-x11/4.1.15-2.1.0
开发环境:ubuntu14虚拟机
busybox版本:busybox-1.30.1
1、进入busybox目录、执行make menuconfig进行安装目录配置(本文使用默认路径):
(./_install) Destination path for ‘make install’”中指定文件系统的安装路目录,如果不指定,则在BusyBox 当前目录的_install 目录下。为了使用方便,建议设置为 NFS 共享目录下的一个子目录
2、导入Yocto环境变量(注意空格)
. /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
3、执行export查看环境变量内容
lin@ubuntu:~$ export
declare -x AR="arm-poky-linux-gnueabi-ar"
declare -x ARCH="arm"
declare -x AR_host="ar"
declare -x AS="arm-poky-linux-gnueabi-as "
declare -x CC="arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x CCACHE_PATH="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/../x86_64-pokysdk-linux/bin:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-uclibc:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-musl:"
declare -x CC_host="gcc"
declare -x CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/work/x86_64-nativesdk-pokysdk-linux/meta-environment-imx6qsabresd/1.0-r8=/usr/src/debug/meta-environment-imx6qsabresd/1.0-r8 -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-nativesdk-pokysdk-linux= "
declare -x CLUTTER_IM_MODULE="xim"
declare -x COLORTERM="gnome-terminal"
declare -x COMPIZ_CONFIG_PROFILE="ubuntu"
declare -x CONFIGURE_FLAGS="--target=arm-poky-linux-gnueabi --host=arm-poky-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x CONFIG_SITE="/opt/fsl-imx-x11/4.1.15-2.1.0/site-config-cortexa9hf-neon-poky-linux-gnueabi"
declare -x CPP="arm-poky-linux-gnueabi-gcc -E -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x CPPFLAGS=""
declare -x CROSS_COMPILE="arm-poky-linux-gnueabi-"
declare -x CXX="arm-poky-linux-gnueabi-g++ -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/work/x86_64-nativesdk-pokysdk-linux/meta-environment-imx6qsabresd/1.0-r8=/usr/src/debug/meta-environment-imx6qsabresd/1.0-r8 -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-nativesdk-pokysdk-linux= "
declare -x CXX_host="g++"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-Jnn8KGc04y"
declare -x DEFAULTS_PATH="/usr/share/gconf/ubuntu.default.path"
declare -x DESKTOP_SESSION="ubuntu"
declare -x DISPLAY=":0"
declare -x GDB="arm-poky-linux-gnueabi-gdb"
declare -x GDMSESSION="ubuntu"
declare -x GDM_LANG="zh_CN"
declare -x GNOME_DESKTOP_SESSION_ID="this-is-deprecated"
declare -x GNOME_KEYRING_CONTROL="/run/user/1000/keyring-bjnTRQ"
declare -x GNOME_KEYRING_PID="2138"
declare -x GPG_AGENT_INFO="/run/user/1000/keyring-bjnTRQ/gpg:0:1"
declare -x GTK_IM_MODULE="ibus"
declare -x GTK_MODULES="overlay-scrollbar:unity-gtk-module"
declare -x HOME="/home/lin"
declare -x IM_CONFIG_PHASE="1"
declare -x INSTANCE="Unity"
declare -x JOB="gnome-session"
declare -x KCFLAGS="--sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x LANG="zh_CN.UTF-8"
declare -x LANGUAGE="zh_CN:en"
declare -x LC_ADDRESS="zh_CN.UTF-8"
declare -x LC_IDENTIFICATION="zh_CN.UTF-8"
declare -x LC_MEASUREMENT="zh_CN.UTF-8"
declare -x LC_MONETARY="zh_CN.UTF-8"
declare -x LC_NAME="zh_CN.UTF-8"
declare -x LC_NUMERIC="zh_CN.UTF-8"
declare -x LC_PAPER="zh_CN.UTF-8"
declare -x LC_TELEPHONE="zh_CN.UTF-8"
declare -x LC_TIME="zh_CN.UTF-8"
declare -x LD="arm-poky-linux-gnueabi-ld --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"
declare -x LESSOPEN="| /usr/bin/lesspipe %s"
declare -x LINK_host="g++"
declare -x LOGNAME="lin"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"
declare -x M4="m4"
declare -x MANDATORY_PATH="/usr/share/gconf/ubuntu.mandatory.path"
declare -x NM="arm-poky-linux-gnueabi-nm"
declare -x OBJCOPY="arm-poky-linux-gnueabi-objcopy"
declare -x OBJDUMP="arm-poky-linux-gnueabi-objdump"
declare -x OECORE_ACLOCAL_OPTS="-I /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share/aclocal"
declare -x OECORE_DISTRO_VERSION="4.1.15-2.1.0"
declare -x OECORE_NATIVE_SYSROOT="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux"
declare -x OECORE_SDK_VERSION="4.1.15-2.1.0"
declare -x OECORE_TARGET_SYSROOT="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x OE_QMAKE_AR="arm-poky-linux-gnueabi-ar"
declare -x OE_QMAKE_CC="arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x OE_QMAKE_CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/work/x86_64-nativesdk-pokysdk-linux/meta-environment-imx6qsabresd/1.0-r8=/usr/src/debug/meta-environment-imx6qsabresd/1.0-r8 -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-nativesdk-pokysdk-linux= "
declare -x OE_QMAKE_CXX="arm-poky-linux-gnueabi-g++ -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x OE_QMAKE_CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/work/x86_64-nativesdk-pokysdk-linux/meta-environment-imx6qsabresd/1.0-r8=/usr/src/debug/meta-environment-imx6qsabresd/1.0-r8 -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/data/fsl-release-bsp/build-x11/tmp/sysroots/x86_64-nativesdk-pokysdk-linux= "
declare -x OE_QMAKE_INCDIR_QT="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5"
declare -x OE_QMAKE_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
declare -x OE_QMAKE_LIBDIR_QT="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib"
declare -x OE_QMAKE_LINK="arm-poky-linux-gnueabi-g++ -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x OE_QMAKE_MOC="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/moc"
declare -x OE_QMAKE_PATH_HOST_BINS="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5"
declare -x OE_QMAKE_QDBUSCPP2XML="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qdbuscpp2xml"
declare -x OE_QMAKE_QDBUSXML2CPP="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qdbusxml2cpp"
declare -x OE_QMAKE_QT_CONFIG="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/qconfig.pri"
declare -x OE_QMAKE_RCC="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/rcc"
declare -x OE_QMAKE_UIC="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/uic"
declare -x OLDPWD="/home/lin/workspace/imx6/OKMX6DL-C/linux-4/busybox-1.30.1"
declare -x PAPERSIZE="a4"
declare -x PATH="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/sbin:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/bin:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/sbin:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/../x86_64-pokysdk-linux/bin:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-uclibc:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-musl:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
declare -x PKG_CONFIG_PATH="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/pkgconfig"
declare -x PKG_CONFIG_SYSROOT_DIR="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x PWD="/home/lin"
declare -x QMAKESPEC="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++"
declare -x QT4_IM_MODULE="xim"
declare -x QT_CONF_PATH="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qt.conf"
declare -x QT_IM_MODULE="ibus"
declare -x QT_QPA_PLATFORMTHEME="appmenu-qt5"
declare -x RANLIB="arm-poky-linux-gnueabi-ranlib"
declare -x SDKTARGETSYSROOT="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi"
declare -x SELINUX_INIT="YES"
declare -x SESSIONTYPE="gnome-session"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/run/user/1000/keyring-bjnTRQ/ssh"
declare -x STRIP="arm-poky-linux-gnueabi-strip"
declare -x TARGET_PREFIX="arm-poky-linux-gnueabi-"
declare -x TERM="xterm"
declare -x TEXTDOMAIN="im-config"
declare -x TEXTDOMAINDIR="/usr/share/locale/"
declare -x UPSTART_EVENTS="started starting"
declare -x UPSTART_INSTANCE=""
declare -x UPSTART_JOB="unity-settings-daemon"
declare -x UPSTART_SESSION="unix:abstract=/com/ubuntu/upstart-session/1000/2140"
declare -x USER="lin"
declare -x VTE_VERSION="3409"
declare -x WINDOWID="31461733"
declare -x XAUTHORITY="/home/lin/.Xauthority"
declare -x XDG_CONFIG_DIRS="/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg"
declare -x XDG_CURRENT_DESKTOP="Unity"
declare -x XDG_DATA_DIRS="/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/"
declare -x XDG_GREETER_DATA_DIR="/var/lib/lightdm-data/lin"
declare -x XDG_RUNTIME_DIR="/run/user/1000"
declare -x XDG_SEAT="seat0"
declare -x XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
declare -x XDG_SESSION_ID="c2"
declare -x XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session0"
declare -x XDG_VTNR="7"
declare -x XMODIFIERS="@im=ibus"
可以发现“ARCH、CC、AR …”等等编译busybox需要用到的变量已经初始化成功。
4、编辑busybox目录下的Makefile文件、屏蔽掉一下内容(这些内容步骤3已经初始化成功了):
5、执行make
6、make install
下篇:
最小Linux文件系统