tmp1

 

关于O_CLOEXEC模式打开的文件描述符,我也不做什么过多解释了,大家只要知道进程调用exec时会关闭O_CLOEXEC模式打开的文件描述符就行了。

 

    其中U_BOOT_CMD命令格式如下:

U_BOOT_CMD(name,maxargs,rep,cmd,usage,help)

    各个参数的意义如下:

name:命令名,非字符串,但在U_BOOT_CMD中用“#”符号转化为字符串

maxargs:命令的最大参数个数

rep:是否自动重复(按Enter键是否会重复执行)

cmd:该命令对应的响应函数

usage:简短的使用说明(字符串)

help:较详细的使用说明(字符串)

Linux内核中的cmpxchg函数

cmpxchg(void *ptr, unsigned long old, unsigned long new);

函数完成的功能是:将old和ptr指向的内容比较,如果相等,则将new写入到ptr中,返回old,如果不相等,则返回ptr指向的内容。

cpumask_of()

* cpumask_of - the cpumask containing just a given cpu
* @cpu: the cpu (<= nr_cpu_ids)

#define cpumask_of(cpu) (get_cpu_mask(cpu))

 打印指定cpu当前task的callstack

void dump_cpu_task(int cpu)
{
    pr_info("Task dump for CPU %d:\n", cpu);
    sched_show_task(cpu_curr(cpu));
}

 

android misc分区layout

misc分区存放一个andr_bl_msg_ab struct

char slot_suffix[32]对应andr_bl_control struct,这个struct的size为32 byte

struct andr_bl_msg_ab {
    struct andr_bl_msg message;
    char slot_suffix[32];
    char update_channel[128];

    /* Round up the entire struct to 4096-byte */
    char reserved[1888];
};

 

struct andr_bl_control {
/* NULL terminated active slot suffix */
char slot_suffix[4]; /*0,4*/
/* Bootloader Control AB magic number (see BOOT_CTRL_MAGIC) */
u32 magic; /*4,4*/
/* Version of struct being used (see BOOT_CTRL_VERSION) */
u8 version; /*8,1*/
/* Number of slots being managed */
u8 nb_slot : 3;
/* Number of times left attempting to boot recovery */
u8 recovery_tries_remaining : 3; /*9,1*/
/* Ensure 4-bytes alignment for slot_info field */
u8 reserved0[2]; /*10,2*/
/* Per-slot information. Up to 4 slots */
struct andr_slot_metadata slot_info[4]; /*12,2(each)*/
/* Reserved for further use */
u8 reserved1[8];
/*
* CRC32 of all 28 bytes preceding this field (little endian
* format)
*/
u32 crc32_le;
} __packed;

 

 

 

 
 
 
 

 

posted @ 2023-05-23 14:27  aspirs  阅读(20)  评论(0编辑  收藏  举报