所谓技术

-----simple,sometimes naive!
posts - 11, comments - 0, trackbacks - 0, articles - 0
  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

       事实上,如果CONFIG_BOOTCOMMAND在配置文件./include/configs/.h中没有给bootcmd赋值,那么U-boot就不知道kernel的入口地址,U-boot启动后将会等待命令。
       具体实现过程:
           Uboot:Start.s -> start_armboot ()<./lib_arm/board.c>  ->  main_loop ()<./common/main.c>
       main_loop()会调用abortboot (bootdelay)判断在delay time内有没有键按下,并给出prompt“Hit any key to stop autoboot”,若没有键按下则run_command (s, 0)(s为默认的bootcmd)。这里默认的bootcmd需要根据内核的位置设置,若bootcmd未赋值,Uboot就会一直等待。
      若此时内核已在RAM中,bootm <add>就可以启动内核了;若内核从(nor)Flash启动,则首先要将内核从Flash中拷贝到RAM:setenv bootcmd cp.b <source add in Flash> <target add in RAM> <count>\;bootm <target add>;当然也可以设置从其它(如tftp)启动·····

posted @ 2008-04-02 10:06 vsolo 阅读(2719) | 评论 (0)编辑 收藏

通过开发板上的u-boot测试自己的u-boot.bin的方法:

最简单的只需修改两处即可:
             <1>将自己的u-boot的./board/<board name>/config.mk中TEXT_BASE修改到一个合适的未被分配的RAM地址,因为板上的u-boot自己启动时会将自己复制到RAM中TEXT_BASE开始的一段空间,则新的u-boot复制自己所占的RAM空间不能与之有重合。(注意:u-boot在TEXT_BASE的下方还会开辟一段栈空间以作运行之用,且kernel的在RAM中地址一般也事先确定,新的TEXT_BASE也不应与之重合)
             <2>将start.S中的初始化RAM控制寄存器的代码注释掉(因为板上的u-boot启动时已经初始化了)。
       然后编译,将得到uboot.bin的loadb  <ramadd>,go <ramadd>,此时新的uboot就驻在RAM中新的TEXT_BASE开始的空间了,go <TEXT_BASE>,呵呵·········

posted @ 2008-03-30 20:48 vsolo 阅读(683) | 评论 (0)编辑 收藏

/*
 *  armboot - Startup Code for ARM926EJS CPU-core
 *
 *  Copyright (c) 2003  Texas Instruments
 *
 *  ----- Adapted for OMAP1610 from ARM925t code ------
 *

#if defined(CONFIG_OMAP1610)
#include <./configs/omap1510.h>
#endif

/*
 *************************************************************************
 *
 * Jump vector table as in table 3.1 in [1]
 *
 *************************************************************************
 */


.globl _start
_start:                  //U-boot入口
 b reset                //跳到reset,下面是复位异常中断向量表,对应于interrupts.c中的各中断函数
 ldr pc, _undefined_instruction
 ldr pc, _software_interrupt
 ldr pc, _prefetch_abort
 ldr pc, _data_abort
 ldr pc, _not_used
 ldr pc, _irq
 ldr pc, _fiq

_undefined_instruction:
 .word undefined_instruction
_software_interrupt:
 .word software_interrupt
_prefetch_abort:
 .word prefetch_abort
_data_abort:
 .word data_abort
_not_used:
 .word not_used
_irq:
 .word irq
_fiq:
 .word fiq

 .balignl 16,0xdeadbeef


/*
 *************************************************************************
 *
 * Startup Code (reset vector)
 *
 * do important init only if we don't start from memory!
 * setup Memory and board specific bits prior to relocation.
 * relocate armboot to ram
 * setup stack
 *
 *************************************************************************
 */

_TEXT_BASE:         
 .word TEXT_BASE  //分配给U-boot被搬运到RAM的起始地址
                         //OSK has 1 bank of 256 MB SDRAM
                         //Physical Address:
                         //1000'0000 to 2000'0000
                         //
                         // Linux-Kernel is expected to be at 1000'8000, entry 1000'8000
                         //(mem base + reserved)
                         //
                         // we load ourself to 1108'0000
                         // TEXT_BASE = 0x11080000

.globl _armboot_start    //下面是一些地址的全局符号
_armboot_start:    
 .word _start      //U-boot在ROM(flash)中的入口地址
                         //U-boot在ROM(flash)存储是由text段,data段,cmd参数区和bss段组成
                         //为了加快启动速度,stage1将把text段,data段和cmd参数区复制到RAM中运行
                         //并且对flash的设置代码不能在flash自己中运行
/*
 * These are defined in the board-specific linker script.
 */
.globl _bss_start
_bss_start:       
 .word __bss_start //bss段的起始地址(也就是U-boot执行代码的尾地址,可用于计算U-boot代码长度)

.globl _bss_end
_bss_end:
 .word _end


/*
 * the actual reset code
 */

reset:                 //复位开始
 /*
  * set the cpu to SVC32 mode
  */
 mrs r0,cpsr
 bic r0,r0,#0x1f
 orr r0,r0,#0xd3
 msr cpsr,r0

 /*
  * we do sys-critical inits only at reboot,
  * not when booting from ram!
  */
#ifdef CONFIG_INIT_CRITICAL       //开发调试过程中,当从RAM中启动时则此初始化不是必须的
 bl cpu_init_crit       //否则初始化CPU和RAM控制寄存器
#endif

relocate:    /* relocate U-Boot to RAM     */
 adr r0, _start  /* r0 <- current position of code   */
 ldr r1, _TEXT_BASE  /* test if we run from flash or RAM */
 cmp    r0, r1                  /* don't reloc during debug         */
 beq    stack_setup         //如果相等即为开发过程,说明U-boot在RAM中启动(不是从flash启动),跳转

 ldr r2, _armboot_start  //否则从flash启动,将U-boot搬运到RAM中
 ldr r3, _bss_start      //确定源结束地址,此运算的必要性源自adr和ldr的区别
 sub r2, r3, r2  /* r2 <- size of armboot            */
 add r2, r0, r2  /* r2 <- source end address         */

copy_loop:
 ldmia r0!, {r3-r10}  /* copy from source address [r0]    */
 stmia r1!, {r3-r10}  /* copy to   target address [r1]    */
 cmp r0, r2   /* until source end addreee [r2]    */
 ble copy_loop           //这样U-boot就可以在RAM中运行了

 /* Set up the stack          */
stack_setup:                      //在RAM中分配stack空间(包括动态内存区和boardinfo存储区)位于U-boot的下方
 ldr r0, _TEXT_BASE  /* upper 128 KiB: relocated uboot   */
 sub r0, r0, #CFG_MALLOC_LEN /* malloc area  = 128K +  128K      */
                                 //define CFG_MALLOC_LEN    (CFG_ENV_SIZE + 128*1024)
                                 //define CFG_ENV_SIZE 0x20000   /* Total Size of Environment Sector */
                                
 sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo                        */
#ifdef CONFIG_USE_IRQ
 sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
#endif
 sub sp, r0, #12  /* leave 3 words for abort-stack    */

clear_bss:                        //bss段清零
 ldr r0, _bss_start  /* find start of bss segment        */
 add r0, r0, #4  /* start at first byte of bss       */
 ldr r1, _bss_end  /* stop here                        */
 mov  r2, #0x00000000  /* clear                            */

clbss_l:str r2, [r0]  /* clear loop...                    */
 add r0, r0, #4
 cmp r0, r1
 bne clbss_l

 ldr pc, _start_armboot  //stage1完成,转到stage2:C代码./lib_arm/broard.c中的start_armboot
                                  //stage1主要完成了CPU的配置,并将U-boot复制到RAM中运行
_start_armboot:
 .word start_armboot


/*
 *************************************************************************
 *
 * CPU_init_critical registers
 *
 * setup important registers
 * setup memory timing
 *
 *************************************************************************
 */


cpu_init_crit:
 /*
  * flush v4 I/D caches
  */
 mov r0, #0
 mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
 mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */

 /*
  * disable MMU stuff and caches
  */
 mrc p15, 0, r0, c1, c0, 0
 bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */
 bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
 orr r0, r0, #0x00000002 /* set bit 2 (A) Align */
 orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
 mcr p15, 0, r0, c1, c0, 0

 /*
  * Go setup Memory and board specific bits prior to relocation.
  */
 mov ip, lr  /* perserve link reg across call */
 bl platformsetup /* go setup pll,mux,memory */
                           //跳到./board/<boardname>/platform.s中配置RAM控制寄存器,需要根据具体型号的RAM设置
 mov lr, ip  /* restore link */
 mov pc, lr  /* back to my caller */

posted @ 2008-03-29 22:08 vsolo 阅读(1175) | 评论 (0)编辑 收藏

VMware下用NFS把自己的busybox挂到目标板上,启动过程:
··············································································
Looking up port of RPC 100005/1 on 192.168.1.3
VFS: Mounted root (nfs filesystem).
Mounted devfs on /dev
Freeing init memory: 80K
init started:  BusyBox v1.1.3 (2008.03.27-03:43+0000) multi-call binary
Starting pid 11, console /dev/tts/0: '/etc/init.d/rcS'
Bummer, could not run '/etc/init.d/rcS': No such file or directory
Bummer, could not run '/etc/init.d/rcS': No such file or directory
Starting pid 13, console /dev/console: '/sbin/getty'
Bummer, could not run '/sbin/getty': No such file or directory

·················································································
可是/etc/init.d/rcS和/sbin/getty分明就是存在着
而且由上面启动过程可见没有另外写linuxrc
那么就是直接从/sbin/init(/bin/busybox)启动
不存在说把目录/etc挂空的情况

只好把/etc/inittab删掉,让busybox使用缺省的initab配置
仍然提示:
·················································································
Starting pid 11, console /dev/tts/0: '/etc/init.d/rcS'
Bummer, could not run '/etc/init.d/rcS': No such file or directory
Bummer, could not run '/etc/init.d/rcS': No such file or directory

Please press Enter to activate this console.
Starting pid 13, console /dev/tts/0: '/bin/sh'
·················································································
不过总算是可以进去shell了
几天了,这算什么撒
疑似版本不匹配,arm-linux-gcc-3.4.1改为arm-linux-gcc-3.3.2
重新编译BusyBox v1.1.3,启动:
·················································································
init started:  BusyBox v1.1.3 (2008.03.27-04:25+0000) multi-call binary
Starting pid 11, console /dev/tts/0: '/etc/init.d/rcS'

Welcome to MontaVista Linux Preview Kit
-------by soloo-------
Starting system...
mounting /proc: done.
Mounting '/' read-only: done.
brining up loopback interface: done.
Mounting /tmp: done.
Starting inetd: done.
System started.
Starting pid 34, console /dev/console: '/sbin/getty'
getty: ioctl() TIOCSPGRP call failed: Inappropriate ioctl for device

MontaVista(R) Linux(R) Professional Edition 3.1, Preview Kit

192.168.1.1 login: root
Password:

MontaVista(R) Linux(R) Professional Edition 3.1, Preview Kit

login[34]: root login  on `console'


BusyBox v1.1.3 (2008.03.27-04:25+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

-sh: can't access tty; job control turned off
-sh: id: not found
-sh: id: not found
# ls
·················································································
虽然提示failed,终于能login进去了

----------------
在配置busybox时有一点需要非常注意:

        Shells  --->     (要回车到子菜单选中ash)
                    (*) ash
       Choose your default shell (ash)  --->      

还有就是busybox-1.1.3已经集成了tinylogin的功能
在配置时选中Login那一栏中相关的选项就无需另外的tinylogin了  

posted @ 2008-03-27 21:29 vsolo 阅读(4848) | 评论 (0)编辑 收藏

cat : /dev/fb0 : no such device
ls    /dev /fb0   存在
cat  /proc/fb    存在

在安装了Redhat 9.0时,如果显卡驱动选择默认的通用驱动vesa 会出现上述情况
解决办法:

     vi  /boot/grub/grub.conf
     kernel *****     后面加上vga=×××

    vga值可选:
    | 640x480  800x600  1024x768 1280x1024
----+-------------------------------------
256 |  0x301    0x303    0x305    0x307  
32k |  0x310    0x313    0x316    0x319  
64k |  0x311    0x314    0x317    0x31A  
16M |  0x312    0x315    0x318    0x31B   

重启就可以看到企鹅了

有人说可设置vga=ask,reboot,Press <RETURN> (就是回车)
试过了仍然无解,至少在Grub中不行

LILO不知情况如何,据说可以:<documentation\fb\vesafb.txt>

To enable one of those modes you have to specify "vga=ask" in the
lilo.conf file and rerun LILO. Then you can type in the desired
mode at the "vga=ask" prompt. For example if you like to use
1024x768x256 colors you have to say "305" at this prompt.

posted @ 2008-03-19 21:42 vsolo 阅读(1239) | 评论 (0)编辑 收藏

仅列出标题
共3页: 1 2 3