
Little Kernel
文章平均质量分 77
xichangbao
这个作者很懒,什么都没留下…
展开
-
LK源码解析 1 crt0.s
lk/arch/crt0.s中的_start函数为入口函数,crt0.s主要初始化CPU,然后长跳转(bl)到lk/kernel/main.c中kmain函数。lk的代码起始位置在crt0.S中。#define DSB .byte 0x4f, 0xf0, 0x7f, 0xf5#define ISB .byte 0x6f, 0xf0, 0x7f, 0xf5原创 2016-05-23 19:35:15 · 3783 阅读 · 1 评论 -
LK源码解析 2 main.c
kmain()。/* called from crt0.S */void kmain(void) __NO_RETURN __EXTERNALLY_VISIBLE;void kmain(void){ // get us into some sort of thread context thread_init_early(); // 初始化lk的线原创 2016-05-23 20:38:49 · 3193 阅读 · 0 评论 -
LK源码解析 3 thread.c
从thread_resume(thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE));展开对lk中thread的分析。struct thread。typedef struct thread { int magic; // thread魔数'thr原创 2016-05-23 20:42:21 · 1146 阅读 · 0 评论 -
LK源码解析 4 main.c
bootstrap2()。static int bootstrap2(void *arg){ dprintf(SPEW, "top of bootstrap2()\n"); arch_init(); // 目前为空函数 // XXX put this somewhere else#if WITH_LIB_BIO bio_ini原创 2016-05-23 20:44:18 · 1572 阅读 · 0 评论 -
LK源码解析 5 aboot.c
现在开始分析关键函数aboot_init(),岔开一句lk在分区表的名称即为aboot。aboot_init()。void aboot_init(const struct app_descriptor *app){ unsigned reboot_mode = 0; unsigned hard_reboot_mode = 0; bool boot_原创 2016-05-23 20:45:21 · 2659 阅读 · 1 评论 -
LK源码解析 6 aboot.c
听闻高通将弃用lk转用uefi,在想还有继续分析lk源码的必要吗?后来一想分析lk源码的目的与lk亦或是uefi无关,于是决定继续进行。boot_linux_from_mmc()。struct boot_img_hdr{ unsigned char magic[BOOT_MAGIC_SIZE]; // BOOT_MAGIC "ANDROID!"原创 2016-05-23 20:46:07 · 3601 阅读 · 0 评论 -
LK源码解析 7 aboot.c
boot_linux()。typedef void entry_func_ptr(unsigned, unsigned, unsigned*);void boot_linux(void *kernel, unsigned *tags, const char *cmdline, unsigned machtype, void *ramdisk, uns原创 2016-05-23 20:47:08 · 2107 阅读 · 0 评论 -
LK源码解析 8 exceptions.S
arm异常模式。#define FUNCTION(x) .global x; x:FUNCTION(arm_undefined) // 未定义指令异常 stmfd sp!, { r0-r12, r14 } // 批量数据存储指令,用于将r0-r12及r14压入堆栈,stmfd指令的寻址方式为事前递减方式(DB),后缀“!”表示更新sp的值,即s原创 2016-05-23 20:47:52 · 1321 阅读 · 0 评论 -
LK源码解析 9 总结
little kernel做为Android系统的bootloader,最早用google工程师实现,其后由高通,MTK的芯片厂商做了各自平台的适配。lk的主要功能:初始化硬件模块,如时钟,中断,UART,USB,LCD,PMIC,eMMC/UFS等。更新cmdline。其中重要的是区分启动模式。 选择和更新device tree。设置好系统状态,跳转到kernel。 MMU原创 2016-05-23 20:48:45 · 2955 阅读 · 0 评论