linux u启动,uCLinux 启动流程

本文详细阐述了uCLinux在S3C44B0处理器上的启动流程,从Blob加载到内存,再到LED状态检查,以及C代码的执行。主要涉及Blob的拷贝、中断向量的复制、内核的启动以及初始化过程。在启动过程中,系统会等待一段时间以允许用户干预自动启动,若无响应则继续加载Linux内核。最后,文章提及了内核启动后的处理和返回情况。
摘要由CSDN通过智能技术生成

uCLinuxxuyuanchao@263.nethttp://xuyuanchao.ie.cnu.edu.cn

blobSrc/blob/start.S

Blobstart.sl KB0x00000000FlashS3C44B0BlobFlashSDRAM lKBtrampoline.sSDRAM63KBtrampolineBSSmain.c.

relocate: adr r0, _start

/* relocate the second stage loader */ add r2, r0, #(64 * 1024) /* blob maximum size is 64kB */ add r0, r0, #0x400 ldr r1, BLOB_START

/* r0 = source address * r1 = target address * r2 = source end address */copy_loop: ldmia r0!, {r3-r10} stmia r1!, {r3-r10} cmp r0, r2 ble copy_loop

adr r0, real_vectors add r2, r0, #1024 ldr r1, =0x0c000000 add r1, r1, #0x08vector_copy_loop: ldmia r0!, {r3-r10} stmia r1!, {r3-r10} cmp r0, r2 ble vector_copy_loop

/* turn off the LED. if it stays off it is an indication that * we didn't make it into the C code *//* bl led_off */

/* blob is copied to ram, so jump to it */ ldr r0, BLOB_START mov pc, r0

Trampoline.S mrs r0, cpsr bic r0, r0, #0x80 msr cpsr, r0

/* jump to C code */ bl main /* if main ever returns we just call it again */ b _trampoline

Main.c /* wait 10 seconds before starting autoboot */ SerialOutputString("Autoboot in progress, press any key to stop "); for(i = 0; i < blob_status.boot_delay; i++) { serial_write('.');

retval = SerialInputBlock(commandline, 1, 1); if(retval > 0) break; }

/* no key was pressed, so proceed booting the kernel */ if(retval == 0) { commandline[0] = '\0'; parse_command("boot"); }

Linux.cstatic int boot_linux(int argc, char *argv[]){ void (*theKernel)(int zero, int arch) = (void (*)(int, int))KERNEL_RAM_BASE;

clif(); setup_start_tag(); setup_memory_tags(); setup_commandline_tag(argc, argv); setup_initrd_tag(); setup_ramdisk_tag(); setup_end_tag();

/* we assume that the kernel is in place */ SerialOutputString("\nStarting kernel ...\n\n"); serial_flush_output();

/* disable subsystems that want to be disabled before kernel boot */ exit_subsystems();

/* start kernel */ theKernel(0, ARCH_NUMBER);

SerialOutputString("Hey, the kernel returned! This should not happen.\n");

return 0;}

Linux 2.4.x (tagged list) ATAG_CORE ATAG_NONE tag_header Linux Boot Loader ATAG_CORE ATAG_MEMATAG_CMDLINEATAG_RAMDISKATAG_INITRD.

1 CPU R00@R1 ID@R2 RAM 2 CPU IRQsFIQsCPU SVC 3 Cache MMU MMU Cache Cache .

ROMdecompress_kernel()misc.cmisc.cuClinux-2.4.x\arch\armnommu\boot\compressed

initinit

rest_initstatic void rest_init(void){kernel_thread(init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); //kernel_threadinit,main.cinitunlock_kernel(); //current->need_resched = 1; //need_resched1 cpu_idle(); //init,init()}

Initdo_basic_setup()init()prepare_namespace()rootRAMDISKinit()free_initmem()/dev/consoleexecveshellinit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值