嵌入式Linux在Ubuntu上的编译方法

一. 安装交叉编译器

1. mkdir -p /opt/freescale/usr/local

2. 将文件gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.gz拷贝到/opt/freescale/usr/local目录

3. tar zxvf gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.gz解压

4. gedit /etc/profile,添加以下内容:

export ARCH=arm
export CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-
export PATH=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin:$PATH

5. source /etc/profile

6. arm-fsl-linux-gnueabi-gcc -v验证交叉编译器是否安装成功

二. 安装依赖包

#!/bin/bash
# Install packages needed by LTIB(首先要先安装aptitude : sudo apt-get install aptitude)
apt-get install aptitude
aptitude -y install gettext libgtk2.0-dev rpm bison m4 libfreetype6-dev
aptitude -y install libdbus-glib-1 -dev liborbit2-dev intltool
aptitude -y install ccache ncurses-dev zlib1g zlib1g-dev gcc g++ libtool
aptitude -y install uuid-dev liblzo2-dev
aptitude -y install tcl dpkg
aptitude -y install asciidoc texlive-latex-base dblatex xutils-dev
apt-get install texinfo
# Packages required for 64-bit Ubuntu
# Do "uname -a" and see if the word "x86_64" shows up.
if uname -a|grep -sq 'x86_64'; then
aptitude -y install ia32-libs libc6-dev-i386 lib32z1
# The following recommended for Linux development.
# They are not required by LTIB.
aptitude -y install gparted emacs22-nox openssh-server
aptitude -y install nfs-common nfs-kernel-server lintian
aptitude -y install git-core git-doc git-email git-gui gitk
aptitude -y install diffstat indent tofrodos fakeroot doxygen uboot-mkimage
aptitude -y install sendmail mailutils meld atftpd sharutils
aptitude -y install manpages-dev manpages-posix manpages-posix-dev linux-doc
aptitude -y install vnc4server xvnc4viewer

三. 编译u-boot

编译四核uboot:

1. tar zxvf uboot2009-08.tar.gz

2.  cd uboot2009-08

3. ./build.sh, 编译1G内存的uboot映像

4. ./build_2gddr.sh, 编译2G内存的uboot映像

编译成功后,将在‘uboot2009-08’目录下产生名为‘u-boot.bin’的二进制文件。该文件即我们需要烧写到Emmc上的U-boot映像文件

 

编译双核uboot:

1. tar zxvf uboot2015-04.tar.gz

2. cd uboot2015-04

3. ./build_6dl.sh, 编译1G内存的uboot映像

4. ./build_6dl_2gddr.sh, 编译2G内存的uboot映像

编译成功后,将在‘uboot2015-04’目录下产生名为‘u-boot.imx’的二进制文件。该文件即我们需要烧写到emmc上的U-boot映像文件。

四. 编译Linux-3.0.35

1. tar zxvf linux-3.0.35.tar.gz

2. cd linux-3.0.35

3. make distclean

4. cp arch/arm/configs/imx6_defconfig .config

5. make menuconfig, 配置完后选exit, 保存退出

6. 双核编译内核命令: make zImage, 编译结束后将在内核源码目录的arch/arm/boot 中得到Linux内核映像文件zImage.

7. 四核编译内核命令: make uImage, 编译结束后将在内核源码目录的arch/arm/boot 中得到Linux内核映像文件uImage.

注: 四核编译时, 如果出现"mkimage" command not found - U-Boot image will not be built错误, 可以uboot2009-08/tools目录下找到mkimage复制到/sbin目录,再重新编译即可.

五. 制作文件系统

console文件系统制作:

1. tar -jxvf rootfs.tar.bz2

2. cd rootfs

3. rm rootfs.tar.bz2

4. ./pack-rootfs.sh

QT文件系统制作

1. tar -jxvf rootfs.qt4.tar.bz2

2. cd rootfs

3. ./pack-rootfs.sh

最后生成rootfs.tar.bz2是可以下载到开发板emmc中的文件系统映像

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值