Vivi Study Notes (commands and linux loading)-Linux general technology-Linux programming and kernel information, the following is a detailed description. Vivi command:
Every vivi command is a struct variable:
Typedef struct user_command {
Const char * name;
Void (* prop func) (int argc, const char **);
Struct user_command * next_cmd;
Const char * helpstr;
} User_command_t
Example: boot command
User_command_t boot_cmd = {
"Boot ",
Command_boot,
NULL,
"Boot [{cmds}] \ t -- Booting linux kernel"
}
The main function of vivi forms a linked list by calling misc () and init_buildin_cmds (), and uses the global variable head_cmd as the header node. When executing a command, first parse the input command through the parseargs () function, and then call execcmd () to find the corresponding function void (* javasfunc) (int argc, const char **) Call.
Linux loading:
Call exec_string ("boot"), find the command_boot function, run it, find mtd_partition_t * kernel_part, and call boot_kernel () copy the kernel and set the startup parameter struct param_struct * params = (struct param_struct *) param_base. Call call_linux () and use mov pc and r2 to complete the jump.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.