zoukankan      html  css  js  c++  java
  • 【原创】-- uboot,kennel,fs,rootfs 编译制作

    环境:ubuntu14.04  内核版本 linux 3.13.0   OK6410

       内核编译环境   linux 3.0.1   

            uboot版本    1.1.6

         交叉编译工具链   arm-linux-gcc 4.3.2

    1、  编译前要首先安装好交叉工具链,安装过程见博文http://www.cnblogs.com/apolloenterprise/p/4324726.html

    2、  编译uboot

      下载uboot源码,下载地址 http://pan.baidu.com/s/1qWINJre 》》》目前使用的是 uboot1.1.6

      进入uboot源码目录,

      $ make clean

      $ make forlinx_nand_ram256_config

      $ make  ARCH=arm CROSS_COMPILE=arm-linux-

      会生成  u-boot.bin

    3  配置及编译kernel

      下载kernel源代码,下载地址 http://pan.baidu.com/s/1sjvfnKp   》》》目前使用的是 kernel 3.0.1

          进入kernel源码目录

      $ make menuconfig ARCH=arm

      进入图形界面,进行相关配置(),如果需要采用nfs方式挂载根文件系统,此时需设置

      $ make uImage ARCH=arm  CROSS_COMPILE=arm-linux-

          

      第一次编译时会显示错误如下:

      (1)"mkimage" command not found - U-Boot images will not be built
      make[1]: *** [arch/arm/boot/uImage] 错误 1
      make: *** [uImage] 错误 2

      为避免此错误修改如下:

      进入  Uboot源代码目录

      cp mkimage /bin

      修改完成,再次编译即可

      (2)

      Unable to find the ncurses libraries or the
       required header files.
          'make menuconfig' requires the ncurses libraries.
       Install ncurses (ncurses-devel) and try again.

      解决:sudo apt-get install libncurses5-dev

      Ncurses是一个能提供功能键定义(快捷键),屏幕绘制以及基于文本终端的图形互动功能的动态库

      在内核源代码目录的  arch/arm/boot 中  生成uImage

        

    4、 制作文件系统 

      linux可能包含多个文件系统,根文件系统必须要有

      (1) 创建目录

      $ mkdir rootfs

      $ cd rootfs

      $ mkdir bin dev etc lib proc sbin sys usr mnt tmp var

      $ mkdir usr/bin usr/lib usr/sbin  lib/modules

      (2) 创建设备文件

      $ cd rootfs/dev

      $ mknod -m 666 console c 5 1

      $ mknod -m 666 null c 1 3

      (3)添加配置文件

      配置文件下载地址  http://pan.baidu.com/s/1kTyFipL 》》》》链接

      $ tar zxvf etc.tar.gz

      $ cp etc/* rootfs/etc/ -rf

      (4)添加内核模块

      $ 进入编译使用的内核源代码

      $ make modules ARCH=arm CROSS_COMPILE=arm-linux-

      $ make modules_install ARCH=arm INSTALL_MOD_PATH=/work/rootfs     (/work/rootfs 为制作的文件系统目录)

      运行完成后,可在/work/rootfs/lib/modules中看到新文件

      注意:如果运行   make modules_install 出现如下错误:

      ##Warning: you may need to install module-init-tools
      See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt
      make: 没有什么可以做的为 `/work/rootfs'

      则需要对 module-init-tools进行更新,更新方法如下:

        接下来, 按照下列步骤安装module-init-tools工具包:  

        下载地址:http://download.chinaunix.net/download.php?id=13907&ResourceID=6901
        $ tar -zxvf module-init-tools-3.2.2.tar.gz  
        在module-init-tools-3.2.2目录下,  
        $ ./configure --prefix=/  
        $ make moveold  
        $ make all install  
        $ ./generate-modprobe.conf /etc/modprobe.conf

        执行过这几行代码就可以使用make modules_install

      

      (5)编译安装busybox  

      busybox 下载地址:http://pan.baidu.com/s/1kTLFLVh》》》

      $ 进入busybox 目录

      $ make menuconfig

        setting-build Options-

        选中    "Build busybox as a static binary"

        "Cross Compiler prefix "  填写  arm-linux-

        setting-Installation Options-

        选中  “Don't use/use”   ,   此项可避免busybox被安装到宿主系统的usr目录中,破坏宿主系统

        "(./_install)busyBox installtion prefix"   填写   /work/rootfs      此目录为制作的rootfs的路径

      $ make

      $ make install

      在/work/rootfs/bin 中新生成许多命令

  • 相关阅读:
    MJRefreshFooterView
    UIActionSheet
    UIAlertView带textField
    SIAlertView
    旋转 锚点
    centos7.2 Apache+PHP7.2+Mysql5.6环境搭建
    ubuntu16.04 mysql 开启远程连接
    Ubuntu16.04重新安装MySQL数据库
    Ubuntu16.04彻底卸载MySQL
    laravel框架基础(2)---laravel项目加载机制
  • 原文地址:https://www.cnblogs.com/apolloenterprise/p/4351408.html
Copyright © 2011-2022 走看看