ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • int fdtdec_setup(void)
    Boot Loader/U-BOOT 2019. 9. 25. 23:12

     

    /lib/fdtdec.c

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    int fdtdec_setup(void)
    {
    #if CONFIG_IS_ENABLED(OF_CONTROL)
    # ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
        gd->fdt_blob = __dtb_dt_begin;
    # elif defined CONFIG_OF_SEPARATE
    #  ifdef CONFIG_SPL_BUILD
        /* FDT is at end of BSS unless it is in a different memory region */
        if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
            gd->fdt_blob = (ulong *)&_image_binary_end;
        else
            gd->fdt_blob = (ulong *)&__bss_end;
    #  else
        /* FDT is at end of image */
        gd->fdt_blob = (ulong *)&_end;
    #  endif
    # elif defined(CONFIG_OF_HOSTFILE)
        if (sandbox_read_fdt_from_file()) {
            puts("Failed to read control FDT\n");
            return -1;
        }
    # endif
    # ifndef CONFIG_SPL_BUILD
        /* Allow the early environment to override the fdt address */
        gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr"16,
                            (uintptr_t)gd->fdt_blob);
    # endif
    #endif
        return fdtdec_prepare_fdt();
    }
     

     

    16번 라인이 실행

    근데 _image_binary_end랑 _end랑 같다.

    24번 라인 CONFIG_SPL_BUILD가 정의되어있지 않기때문에 26번라인 실행

     

    fdt_blob은 디바이스트리의 위치를 나타내는것 같다.

    26번라인 getenv_ulong은 fdtcontroladdr의 환경변수 값을 얻어올수 있다.

    더적확히는 getenv함수에서 fdtcontroladdr의 환경변수값을 읽어올수 있고,

     

    'Boot Loader > U-BOOT' 카테고리의 다른 글

    static int initf_console_record(void)  (0) 2019.09.26
    int initf_malloc(void)  (0) 2019.09.26
    static int setup_mon_len(void)  (0) 2019.09.25
    _main  (0) 2019.09.25
    static const init_fnc_t init_sequence_f[]  (0) 2019.09.25

    댓글

Designed by Tistory.