.
cmd/nvedit.c
1 ulong getenv_ulong(const char *name, int base, ulong default_val)
2 {
3 /*
4 * We can use getenv() here, even before relocation, since the
5 * environment variable value is an integer and thus short.
6 */
7 const char *str = getenv(name);
8
9 return str ? simple_strtoul(str, NULL, base) : default_val;
10 }
getenv_ulong
함수의 인자는 ("fdtcontroladdr", 16, (uintptr_t)gd->fdt_blob)입니다.- 7번 줄의
getenv
함수를 통해fdtcontroladdr
를 찾습니다. - 9번 줄의
simple_strtoul
함수는 string을 unsigned long으로 변환해 주는 간단한 함수입니다. 만약 환경설정에서fdtcontroladdr
를 찾으면 주소를 unsigned long으로 변환해 반환하고 아니라면(uintptr_t)gd->fdt_blob
를 반환합니다.