歡迎您光臨本站 註冊首頁

android linux基礎知識總結

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0

  一、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 ...

  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 scheduler noop registered

  io scheduler anticipatory registered

  io scheduler deadline registered

  io scheduler cfq registered

  RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize

  loop: loaded (max 8 devices)

  nbd: registered device at major 43

  Intel(R) PRO/1000 Network Driver - version 5.6.10.1-k2

  Copyright (c) 1999-2004 Intel Corporation.

  e100: Intel(R) PRO/100 Network Driver, 3.3.6-k2-NAPI

  e100: Copyright(c) 1999-2004 Intel Corporation

  ipddp.c:v0.01 8/28/97 Bradford W. Johnson <[email]johns393@maroon.tc.umn.edu[/email]>

  ipddp0: Appletalk-IP Encap. mode by Bradford W. Johnson <[email]johns393@maroon.tc.umn.edu[/email]>

  i2c /dev entries driver

  eth0: FCC ENET Version 0.3, 00:08:02:86:10:00

  eth1: FCC ENET Version 0.3, 00:08:02:46:10:00

  NET: Registered protocol family 26

  NET: Registered protocol family 2

  IP: routing cache hash table of 1024 buckets, 8Kbytes

  TCP established hash table entries: 8192 (order: 4, 65536 bytes)

  TCP bind hash table entries: 8192 (order: 3, 32768 bytes)

  TCP: Hash tables configured (established 8192 bind 8192)

  IPv4 over IPv4 tunneling driver

  GRE over IPv4 tunneling driver

  ip_conntrack version 2.1 (1024 buckets, 8192 max) - 248 bytes per conntrack

  ip_tables: (C) 2000-2002 Netfilter core team

  ipt_recent v0.3.1: Stephen Frost <[email]sfrost@snowman.net[/email]>. http://snowman.net/projects/ipt_recent/

  ClusterIP Version 0.6 loaded successfully

  arp_tables: (C) 2002 David S. Miller

  IPVS: Registered protocols (TCP, UDP, AH, ESP)

  IPVS: Connection hash table configured (size=4096, memory=32Kbytes)

  IPVS: ipvs loaded.

  IPVS: [rr] scheduler registered.

  IPVS: [wrr] scheduler registered.

  IPVS: [lc] scheduler registered.

  IPVS: [wlc] scheduler registered.

  IPVS: [lblc] scheduler registered.

  IPVS: [lblcr] scheduler registered.

  IPVS: [dh] scheduler registered.

  IPVS: [sh] scheduler registered.

  IPVS: [sed] scheduler registered.

  IPVS: [nq] scheduler registered.

  Initializing IPsec netlink socket

  NET: Registered protocol family 1

  NET: Registered protocol family 17

  NET: Registered protocol family 15

  Bridge firewalling registered

  Ebtables v2.0 registered

  NET: Registered protocol family 4

  NET: Registered protocol family 5

  NET: Registered protocol family 9

  X.25 for Linux. Version 0.2 for Linux 2.1.15

  NET: Registered protocol family 8

  NET: Registered protocol family 20

  lec.c: Sep 26 2008 11:07:03 initialized

  mpoa: /proc/mpoa initialized

  mpc.c: Sep 26 2008 11:07:01 initialized

  NET4: DECnet for Linux: V.2.5.68s (C) 1995-2003 Linux DECnet Project Team

  DECnet: Routing cache hash table of 1024 buckets, 8Kbytes

  NET: Registered protocol family 12

  NET: Registered protocol family 19

  802.1Q VLAN Support v1.8 Ben Greear <[email]greearb@candelatech.com[/email]>

  All bugs added by David S. Miller <[email]davem@redhat.com[/email]>

  SCTP: Hash tables configured (established 4096 bind 8192)

  RAMDISK: ext2 filesystem found at block 0

  RAMDISK: Loading 3096KiB [1 disk] into ram disk... done.

  VFS: Mounted root (ext2 filesystem) readonly.

  Mounted devfs on /dev

  init started: BusyBox v1.7.2 (2008-09-26 10:46:55 CST)

  starting pid 810, tty '': '/etc/init.d/rcS'

  mdev: /sys/block: No such file or directory

  mdev: /sys/class: No such file or directory

  starting pid 813, tty '': '/bin/sh'

  Processing /etc/profile... Done


[火星人 ] android linux基礎知識總結已經有537次圍觀

http://coctec.com/docs/linux/show-post-50649.html