2013年5月17日 星期五

uboot


#define PHYS_OFFSET     0x80000000
#define BOOT_PARAMS_OFFSET  (PHYS_OFFSET + 0x100)

(uboot)m6_chinach_v1.c
gd->bd->bi_boot_params = BOOT_PARAMS_OFFSET; 說明參數位置在0x80000100 (傳遞给kernel的參數的位址)
可以利用 /proc/cmdline 看傳了些什麼
(定義在:device/txxx/BoardConfigCommon.mk,BOARD_KERNEL_CMDLINE)
0x80000100 這個值可以随意指定, 但要和kernel裡的mach_type相同

(kernel)board-m6g24.c
MACHINE_START(MESON6_G24, "Amlogic Meson6 g24 customer platform")
    .boot_params    = BOOT_PARAMS_OFFSET, //0x80000100
    .map_io         = meson_map_io,///2
    .init_early     = meson_init_early,///3
    .init_irq       = meson_init_irq,///0
    .timer          = &meson_sys_timer,
    .init_machine   = meson_init_machine,
    .fixup          = meson_fixup,///1
MACHINE_END

(uboot)main.c
void main_loop (void)
{
    前略
    s = getenv ("bootcmd");
    # ifndef CONFIG_SYS_HUSH_PARSER
    run_command (s, 0);
    # else
    parse_string_outer(s, FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
    # endif
}


/**
 * boot_get_kernel - find kernel image
 * @os_data: pointer to a ulong variable, will hold os data start address
 * @os_len: pointer to a ulong variable, will hold os data length
 *
 * boot_get_kernel() tries to find a kernel image, verifies its integrity
 * and locates kernel data.
 *
 * returns:
 *     pointer to image header if valid image was found, plus kernel start
 *     address and length, otherwise NULL
 */
(kernel)cmd_bootm.c
static void *boot_get_kernel()
{
    if (argc < 2) {
        img_addr = load_addr;
    debug ("*  kernel: default image load address = 0x%08lx\n", load_addr);

    case IMAGE_FORMAT_LEGACY:
        printf ("## Booting kernel from Legacy Image at %08lx ...\n", img_addr);

}

沒有留言:

張貼留言