LINUX

android linux基础知识总结

日期:2015/6/28来源: IT猫扑网

  一、busybox的编译

  首先是交叉编译设置,打开busybox根目录下的Makefile,进行修改

  [attach]220792[/attach]

  一般情况下,为了让busybox能够独立于其他的库文件而可以单独运行,需要将busybox编译成静态的。

  #make menuconfig

  Busybox Settings --->

  Build Options --->

  Build BusyBox as a static binary (no shared libs)  //静态

  Installation Options --->

  Don't use /usr  //make install的时候不会安装到根目录,而是安装到./_install

  Linux System Utilities --->

  mdev  //相当于udev

  Support /etc/mdev.conf

  Support command execution at device addition/removal

  Shells --->

  Choose your default shell (msh)  //具有ash没有的功能,比如支持tab补齐,历史纪录等等的高级功能

  而编译成静态的分为glibc和uclibc,如果系统没有安装uclibc的话,那就会报下面的错

  [attach]220793[/attach]

  解决办法是打开 applets/applets.c 将其中的错误注释掉

  [attach]220794[/attach]

  其他的busybox选项根据需要进行选择!

  #make

  #make install

  这样就在./_install目录下生成了busybox

  [attach]220795[/attach]

  二、ramdisk文件系统生成

  [attach]220796[/attach]

  上图中首先创见了一个10M的文件系统映象

  然后使用losetup命令将此镜像与块设备/dev/loop0进行挂接

  如果出现"ioctl: LOOP_SET_FD:设备或资源忙",说明/dev/loop0设备还和一文件联系,可用losetup /dev/loop0查看地,并可用-d 删除

  [attach]220797[/attach]

  上图是用命令mke2fs来格式化此块设备/dev/loop0,其实就是格式化我们刚生成的那个文件系统镜像,ext2格式

  [attach]220798[/attach]

  上图是挂载文件系统镜像,可见经过刚才格式化之后的文件系统镜像里面只有lost+found这个文件夹

  之后可以将步骤一中生成的_install目录下的所有文件拷贝进来即可,

  /et/init.d/rcS文件如下修改

  [attach]220799[/attach]

  其他的系统配置文件可以根据需要进行更改

  三、u-boot加载内核和文件系统

  => tftp 800000 uImage; tftp a00000 rootfs.img; bootm 800000 a00000

  Using FCC1 ETHERNET device

  TFTP from server 192.168.0.102; our IP address is 192.168.0.20

  Filename 'uImage'.

  Load address: 0x800000

  Loading: #################################################################

  #################################################################

  #################################################################

  #################################################################

  #################################################################

  ###########################################

  done

  Bytes transferred = 1880231 (1cb0a7 hex)

  Using FCC1 ETHERNET device

  TFTP from server 192.168.0.102; our IP address is 192.168.0.20

  Filename 'rootfs.img'.

  Load address: 0xa00000

  Loading: #################################################################

  #################################################################

  #################################################################

  #################################################################

  #################################################################

  #################################################################

  #################################################################

  #################################################################

  #################################################################

  ###################################

  done

  Bytes transferred = 3170368 (306040 hex)

  ## Booting image at 00800000 ...

  Image Name:   Linux-2.6.11

  Image Type:   PowerpC Linux Kernel Image (gzip compressed)

  Data Size:    1880167 Bytes =  1.8 MB

  Load Address: 00000000

  Entry Point:  00000000

  Verifying Checksum ... OK

  Uncompressing Kernel Image ... OK

  ## cmdline at 0x007FFF00 ... 0x007FFF14

  memstart    = 0x00000000

  memsize     = 0x08000000

  Flashstart  = 0xFE000000

  flashsize   = 0x01000000

  flashoffset = 0x00033000

  sramstart   = 0x00000000

  sramsize    = 0x00000000

  immr_base   = 0xF0000000

  bootflags   = 0x00000001

  vco   =    400 MHz

  sccfreq     =    100 MHz

  brgfreq     =    100 MHz

  intfreq     =    400 MHz

  cpmfreq     =    200 MHz

  busfreq     =    100 MHz

  ethaddr     = 00:08:02:06:10:00

  IP addr     = 192.168.0.20

  baudrate    = 115200 bps

  ## Loading RAMDisk Image at 00a00000 ...

#p#副标题#e#

  Image Name:

  Image Type:   PowerPC Linux RAMDisk Image (uncompressed)

  Data Size:    3170304 Bytes =  3 MB

  Load Address: 00000000

  Entry Point:  00000000

  Verifying Checksum ... OK

  Loading Ramdisk to 07880000, end 07b86000 ... OK

  Linux version 2.6.11 (root@Embedded001) (gcc version 3.4.3) #1 Fri Sep 26 11:08:35 CST 2008

  Motorola PQ2 ADS PowerPC port

  arch/ppc/syslib/m82xx_pci.c: The PCI bus is 33333333 Mhz.

  Waiting 1 second after deasserting RST...

  Built 1 zonelists

  Kernel command line: console=ttyS0,115200

  PID hash table entries: 1024 (order: 10, 16384 bytes)

  Warning: real time clock seems stuck!

  Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)

  Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)

  Memory: 122272k available (2660k kernel code, 1524k data, 116k init, 0k highmem)

  Mount-cache hash table entries: 512 (order: 0, 4096 bytes)

  checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd

  Freeing initrd memory: 3096k freed

  NET: Registered protocol family 16

  PCI: Probing PCI hardware

  dev = 0, pin = 1

  slot = 0, dev = 0, pin = 1

  dev = a0, pin = 1

  slot = 20, dev = a0, pin = 1

  dev = b8, pin = 1

  slot = 23, dev = b8, pin = 1

  dev = b9, pin = 1

  slot = 23, dev = b9, pin = 1

  PCI: Cannot allocate resource region 0 of device 0000:00:00.0

  PCI: Cannot allocate resource region 1 of device 0000:00:00.0

  SCSI subsystem initialized

  Sangoma WANPIPE Router v1.1 (c) 1995-2000 Sangoma Technologies Inc.

  devfs: 2004-01-31 Richard Gooch ([email]rgooch@atnf.csiro.au[/email])

  devfs: boot_options: 0x1

  Initializing Cryptographic API

  Serial: CPM driver $Revision: 0.01 $

  ttyS0 at MMIO 0xf0011a80 (irq = 4) is a CPM UART

  ttyS1 at MMIO 0xf0011a00 (irq = 40) is a CPM UART

  ttyS2 at MMIO 0xf0011a60 (irq = 43) is a CPM UART

  io

相关文章

相关下载

网友评论

我要评论...
    没有更早的评论了
    取消