宁阳移动网站制作免费做背景调查的网站

news/2025/9/22 16:21:13/文章来源:
宁阳移动网站制作,免费做背景调查的网站,伍佰亿官方网站,校园招聘网站开发研究背景内核生命周期uboot 打印完 Starting kernel . . .#xff0c;就完成了自己的使命#xff0c;控制权便交给了 kernel 的第一条指令#xff0c;也就是下面这个函数init/main.casmlinkage __visible void __init start_kernel(void){...rest_init();}start_kernel 相当于内核的…内核生命周期uboot 打印完 Starting kernel . . .就完成了自己的使命控制权便交给了 kernel 的第一条指令也就是下面这个函数init/main.casmlinkage __visible void __init start_kernel(void){...rest_init();}start_kernel 相当于内核的 main 函数内核的生命周期就是从执行这个函数的第一条语句开始的直到最后一个函数 reset_init()内核将不再从这个函数中返回而是陷入这个函数里面的一个 while(1) 死循环这个死循环被作为 idle 进程也就是 0 号进程。所以内核的生命周期就是一个完整的 start_kernel 函数。始于 start_kernel 函数的第一条语句停留在最后的死循环。init 进程kernel 会创建众多内核线程来持续致力于内存、磁盘、CPU 的管理其中有两个内核线程比较重要需要我们重点讲解那就是 1 号内核线程 kernel_init 和 2 号内核线程 kthreadd。1 号内核线程最终会被用户的第一个进程 init 代替也就成了 1 号进程。如下# psPID   USER     COMMAND1 root     init2 root     [kthreadd]3 root     [rcu_gp]4 root     [rcu_par_gp]7 root     [kworker/u4:0-ev]8 root     [mm_percpu_wq]9 root     [ksoftirqd/0]...COMMAND 这一列带中括号的是内核线程不带中括号的是用户进程。从 PID 统一编址就可以看出它俩地位是一样的。下面我们深入分析一下从 start_kernel 到最终运行 init 进程kernel 都经历了什么打印添加打印是分析流程的好方法。asmlinkage __visible void __init start_kernel(void){char *command_line;char *after_dashes;set_task_stack_end_magic(init_task);smp_setup_processor_id();debug_objects_early_init();cgroup_init_early();local_irq_disable();early_boot_irqs_disabled  true;/** Interrupts are still disabled. Do necessary setups, then* enable them.*/boot_cpu_init();page_address_init();pr_notice(%s, linux_banner);setup_arch(command_line);/** Set up the the initial canary and entropy after arch* and after adding latent and command line entropy.*/add_latent_entropy();add_device_randomness(command_line, strlen(command_line));boot_init_stack_canary();mm_init_cpumask(init_mm);setup_command_line(command_line);setup_nr_cpu_ids();setup_per_cpu_areas();smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */boot_cpu_hotplug_init();build_all_zonelists(NULL);page_alloc_init();pr_notice(Kernel command line: %s\n, boot_command_line);parse_early_param();after_dashes  parse_args(Booting kernel,static_command_line, __start___param,__stop___param - __start___param,-1, -1, NULL, unknown_bootoption);if (!IS_ERR_OR_NULL(after_dashes))parse_args(Setting init args, after_dashes, NULL, 0, -1, -1,NULL, set_init_arg);jump_label_init();/** These use large bootmem allocations and must precede* kmem_cache_init()*/setup_log_buf(0);vfs_caches_init_early();sort_main_extable();trap_init();mm_init();ftrace_init();/* trace_printk can be enabled here */early_trace_init();/** Set up the scheduler prior starting any interrupts (such as the* timer interrupt). Full topology setup happens at smp_init()* time - but meanwhile we still have a functioning scheduler.*/sched_init();/** Disable preemption - early bootup scheduling is extremely* fragile until we cpu_idle() for the first time.*/preempt_disable();if (WARN(!irqs_disabled(),Interrupts were enabled *very* early, fixing it\n))local_irq_disable();radix_tree_init();/** Set up housekeeping before setting up workqueues to allow the unbound* workqueue to take non-housekeeping into account.*/housekeeping_init();/** Allow workqueue creation and work item queueing/cancelling* early.  Work item execution depends on kthreads and starts after* workqueue_init().*/workqueue_init_early();rcu_init();/* Trace events are available after this */trace_init();if (initcall_debug)initcall_debug_enable();context_tracking_init();/* init some links before init_ISA_irqs() */early_irq_init();init_IRQ();tick_init();rcu_init_nohz();init_timers();hrtimers_init();softirq_init();timekeeping_init();time_init();sched_clock_postinit();printk_safe_init();perf_event_init();profile_init();call_function_init();WARN(!irqs_disabled(), Interrupts were enabled early\n);early_boot_irqs_disabled  false;local_irq_enable();kmem_cache_init_late();/** HACK ALERT! This is early. Were enabling the console before* weve done PCI setups etc, and console_init() must be aware of* this. But we do want output early, in case something goes wrong.*/console_init();printk(## start_kernel() -- console_init()\n);if (panic_later)panic(Too many boot %s vars at %s, panic_later,panic_param);lockdep_info();/** Need to run this when irqs are enabled, because it wants* to self-test [hard/soft]-irqs on/off lock inversion bugs* too:*/locking_selftest();/** This needs to be called before any devices perform DMA* operations that might use the SWIOTLB bounce buffers. It will* mark the bounce buffers as decrypted so that their usage will* not cause plain-text data to be decrypted when accessed.*/mem_encrypt_init();#ifdef CONFIG_BLK_DEV_INITRDif (initrd_start  !initrd_below_start_ok page_to_pfn(virt_to_page((void _)initrd_start))  min_low_pfn) {pr_crit(initrd overwritten (0x%08lx  0x%08lx) - disabling it.\n,page_to_pfn(virt_to_page((void _)initrd_start)),min_low_pfn);initrd_start  0;}#endifpage_ext_init();kmemleak_init();debug_objects_mem_init();setup_per_cpu_pageset();numa_policy_init();acpi_early_init();if (late_time_init)late_time_init();calibrate_delay();pid_idr_init();anon_vma_init();#ifdef CONFIG_X86if (efi_enabled(EFI_RUNTIME_SERVICES))efi_enter_virtual_mode();#endifthread_stack_cache_init();cred_init();fork_init();proc_caches_init();uts_ns_init();buffer_init();key_init();security_init();dbg_late_init();vfs_caches_init();pagecache_init();signals_init();seq_file_init();proc_root_init();nsfs_init();cpuset_init();cgroup_init();taskstats_init_early();delayacct_init();check_bugs();acpi_subsystem_init();arch_post_acpi_subsys_init();sfi_init_late();if (efi_enabled(EFI_RUNTIME_SERVICES)) {efi_free_boot_services();}printk(## run rest_init()\n);/_ Do the rest non-\_\_inited, were now alive _/rest_init();printk(## after rest_init()\n);}一开始尝试在函数刚开始就添加 printk 打印结果发现添加完 printk 后内核起不来最后保守起见在 131 行 console_init(); 后才开始添加打印。Starting kernel ...[ 0.000000] Booting Linux on physical CPU 0x0[ 0.000000] Linux version 4.18.12 (liyongjunBox) (gcc version 9.3.0 (Buildroot 2021.05)) #14 SMP Thu Nov 25 00:37:30 CST 2021[ 0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr10c5387d[ 0.000000] CPU: div instructions available: patching division code[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache[ 0.000000] OF: fdt: Machine model: LeMaker Banana Pi[ 0.000000] Memory policy: Data cache writealloc[ 0.000000] cma: Reserved 16 MiB at 0x7ec00000[ 0.000000] psci: probing for conduit method from DT.[ 0.000000] psci: Using PSCI v0.1 Function IDs from DT[ 0.000000] random: get_random_bytes called from start_kernel0xa0/0x430 with crng_init0[ 0.000000] percpu: Embedded 16 pages/cpu (ptrval) s34444 r8192 d22900 u65536[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 260202[ 0.000000] Kernel command line: consolettyS0,57600 earlyprintk root/dev/mmcblk0p2 rootwait[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)[ 0.000000] Memory: 1011460K/1046952K available (6144K kernel code, 418K rwdata, 1524K rodata, 1024K init, 240K bss, 19108K reserved, 16384K cma-reserved, 244136K highmem)[ 0.000000] Virtual kernel memory layout:[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)[ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)[ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (7136 kB)[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 419 kB)[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 241 kB)[ 0.000000] SLUB: HWalign64, Order0-3, MinObjects0, CPUs2, Nodes1[ 0.000000] Hierarchical RCU implementation.[ 0.000000] RCU restricting CPUs from NR_CPUS8 to nr_cpu_ids2.[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf16, nr_cpu_ids2[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16[ 0.000000] GIC: Using split EOI/Deactivate mode[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns[ 0.000007] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns[ 0.000021] Switching to timer-based delay loop, resolution 41ns[ 0.000334] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns[ 0.000586] clocksource: hstimer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6370868154 ns[ 0.000822] Console: colour dummy device 80x30[ 0.000844] ## start_kernel() -- console_init() // 132 行的打印可是发现在 console_init() 之前就有不少打印了这个地方还是有些不解。猜测要么是在 console_init() 之前就已经可以打印了要么是在 console_init() 之前先将打印缓存着等初始化之后再打印。这点以后再研究吧。先插个眼。接着看打印[    0.000844] ## start_kernel() -- console_init()[    0.000872] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj240000)[    0.000886] pid_max: default: 32768 minimum: 301[    0.001054] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)[    0.001070] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)[    0.001727] CPU: Testing write buffer coherency: ok[    0.001779] ## run rest_init()从 133 行到 206 行代码不少打印却只有寥寥 5 行。少就说明不重要那就不分析了哈哈。看下面的代码乖乖就剩一句了rest_init();并且第 210 行的 printk 等到系统完全起来都没有打印说明 rest_init() 就没返回。看来是个扛把子。static noinline void __ref rest_init(void){struct task_struct *tsk;int pid;printk(## rcu_scheduler_starting()\n);rcu_scheduler_starting();/** We need to spawn init first so that it obtains pid 1, however* the init task will end up wanting to create kthreads, which, if* we schedule it before we create kthreadd, will OOPS.*/pid  kernel_thread(kernel_init, NULL, CLONE_FS);/** Pin init on the boot CPU. Task migration is not properly working* until sched_init_smp() has been run. It will set the allowed* CPUs for init to the non isolated CPUs.*/rcu_read_lock();tsk  find_task_by_pid_ns(pid, init_pid_ns);set_cpus_allowed_ptr(tsk, cpumask_of(smp_processor_id()));rcu_read_unlock();printk(## bb\n);numa_default_policy();pid  kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);rcu_read_lock();kthreadd_task  find_task_by_pid_ns(pid, init_pid_ns);rcu_read_unlock();printk(## cc\n);/** Enable might_sleep() and smp_processor_id() checks.* They cannot be enabled earlier because with CONFIG_PREEMPTy* kernel_thread() would trigger might_sleep() splats. With* CONFIG_PREEMPT_VOLUNTARYy the init task might have scheduled* already, but its stuck on the kthreadd_done completion.*/system_state  SYSTEM_SCHEDULING;printk(## dd\n);complete(kthreadd_done);/** The boot idle thread must execute schedule()* at least once to get things moving:*/printk(## ee\n);schedule_preempt_disabled();printk(## ff\n);/_ Call into cpu_idle with preempt disabled _/cpu_startup_entry(CPUHP_ONLINE);// printk(## ff\n);}对应打印如下[    0.001779] ## run rest_init()[    0.001786] ## rcu_scheduler_starting()[    0.002030] ## bb[    0.002089] ## cc[    0.002097] ## dd[    0.002104] ## ee[    0.002150] ## kernel_init()[    0.002199] /cpus/cpu0 missing clock-frequency property[    0.002214] /cpus/cpu1 missing clock-frequency property[    0.002228] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000[    0.002799] Setting up static identity map for 0x40100000 - 0x40100060[    0.002972] Hierarchical SRCU implementation.[    0.003776] smp: Bringing up secondary CPUs ...[    0.014335] ## ff打印了 kernel_init()是因为调用了 schedule_preempt_disabled()其内部调用了 schedule() 执行进程切换进入睡眠。当然在当前进程被唤醒时程序也是从这个断点开始运行。void __sched schedule_preempt_disabled(void){sched_preempt_enable_no_resched();schedule();preempt_disable();}执行进程切换后kernel_init() 才有机会运行static int __ref kernel_init(void *unused){int ret;printk(## kernel_init()\n);kernel_init_freeable();/* need to finish all async __init code before freeing the memory */async_synchronize_full();ftrace_free_init_mem();jump_label_invalidate_initmem();free_initmem();printk(## 2.\n);mark_readonly();printk(## 3.\n);system_state  SYSTEM_RUNNING;numa_default_policy();rcu_end_inkernel_boot();printk(## 4.\n);if (ramdisk_execute_command) {ret  run_init_process(ramdisk_execute_command);if (!ret)return 0;pr_err(Failed to execute %s (error %d)\n,ramdisk_execute_command, ret);}/** We try each of these until one succeeds.** The Bourne shell can be used instead of init if we are* trying to recover a really broken machine.*/if (execute_command) {ret  run_init_process(execute_command);if (!ret)return 0;panic(Requested init %s failed (error %d).,execute_command, ret);}if (!try_to_run_init_process(/sbin/init) ||!try_to_run_init_process(/etc/init) ||!try_to_run_init_process(/bin/init) ||!try_to_run_init_process(/bin/sh)) {printk(## kernel_init() -- /sbin/init\n);return 0;}panic(No working init found.  Try passing init option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.);}对应打印如下[    0.002150] ## kernel_init()[    0.002199] /cpus/cpu0 missing clock-frequency property[    0.002214] /cpus/cpu1 missing clock-frequency property[    0.002228] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000[    0.002799] Setting up static identity map for 0x40100000 - 0x40100060[    0.002972] Hierarchical SRCU implementation.[    0.003776] smp: Bringing up secondary CPUs ...[    0.014335] ## ff[    0.014540] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001[    0.014681] smp: Brought up 1 node, 2 CPUs[    0.014697] SMP: Total of 2 processors activated (96.00 BogoMIPS).[    0.014704] CPU: All CPU(s) started in HYP mode.[    0.014709] CPU: Virtualization extensions available.[    0.015730] devtmpfs: initialized[    0.015786] ## 11.[    0.015802] ## 22.[    0.015811] ## 33.[    0.015820] ## 44.[    0.015825] ## 55.[    0.015918] ## 66.[    0.015999] ## 77.[    0.016006] ## 88.[    0.016058] ## 99.[    0.021654] ## AA.[    0.021836] ### AAA.[    0.022450] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4[    0.022721] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns[    0.022747] futex hash table entries: 512 (order: 3, 32768 bytes)[    0.023540] pinctrl core: initialized pinctrl subsystem[    0.024726] NET: Registered protocol family 16[    0.026025] DMA: preallocated 256 KiB pool for atomic coherent allocations[    0.027158] hw-breakpoint: found 5 (1 reserved) breakpoint and 4 watchpoint registers.[    0.027173] hw-breakpoint: maximum watchpoint size is 8 bytes.[    0.042711] reg-fixed-voltage gmac-3v3: could not find pctldev for node /soc1c00000/pinctrl1c20800/gmac_power_pin0, deferring probe[    0.043233] SCSI subsystem initialized[    0.043811] usbcore: registered new interface driver usbfs[    0.043864] usbcore: registered new interface driver hub[    0.043933] usbcore: registered new device driver usb[    0.044199] pps_core: LinuxPPS API ver. 1 registered[    0.044209] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giomettilinux.it[    0.044230] PTP clock support registered[    0.044563] Advanced Linux Sound Architecture Driver Initialized.[    0.045501] clocksource: Switched to clocksource arch_sys_counter[    0.046238] simple-framebuffer 7fe79000.framebuffer: framebuffer at 0x7fe79000, 0x178e00 bytes, mapped to 0x(ptrval)[    0.046258] simple-framebuffer 7fe79000.framebuffer: formatx8r8g8b8, mode656x536x32, linelength2880[    0.052472] Console: switching to colour frame buffer device 82x33[    0.058369] simple-framebuffer 7fe79000.framebuffer: fb0: simplefb registered![    0.066686] NET: Registered protocol family 2[    0.067281] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)[    0.067316] TCP established hash table entries: 8192 (order: 3, 32768 bytes)[    0.067395] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)[    0.067522] TCP: Hash tables configured (established 8192 bind 8192)[    0.067655] UDP hash table entries: 512 (order: 2, 16384 bytes)[    0.067722] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)[    0.067964] NET: Registered protocol family 1[    0.068567] RPC: Registered named UNIX socket transport module.[    0.068583] RPC: Registered udp transport module.[    0.068590] RPC: Registered tcp transport module.[    0.068596] RPC: Registered tcp NFSv4.1 backchannel transport module.[    0.069204] hw perfevents: no interrupt-affinity property for /pmu, guessing.[    0.069499] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available[    0.071072] workingset: timestamp_bits30 max_order18 bucket_order0[    0.077754] NFS: Registering the id_resolver key type[    0.077803] Key type id_resolver registered[    0.077812] Key type id_legacy registered[    0.079006] bounce: pool size: 64 pages[    0.079106] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)[    0.079119] io scheduler noop registered[    0.079127] io scheduler deadline registered[    0.079295] io scheduler cfq registered (default)[    0.079307] io scheduler mq-deadline registered[    0.079315] io scheduler kyber registered[    0.080074] sun4i-usb-phy 1c13400.phy: could not find pctldev for node /soc1c00000/pinctrl1c20800/usb0_id_detect_pin0, deferring probe[    0.083501] sun4i-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver[    0.140590] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled[    0.143240] console [ttyS0] disabled[    0.163431] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq  48, base_baud  1500000) is a U6_16550A[    1.630962] console [ttyS0] enabled[    1.661099] 1c28c00.serial: ttyS1 at MMIO 0x1c28c00 (irq  49, base_baud  1500000) is a U6_16550A[    1.702024] 1c29c00.serial: ttyS2 at MMIO 0x1c29c00 (irq  50, base_baud  1500000) is a U6_16550A[    1.723737] sun4i-backend 1e60000.display-backend: Couldnt find matching frontend, frontend features disabled[    1.744080] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc07482cc)[    1.759592] sun4i-backend 1e40000.display-backend: Couldnt find matching frontend, frontend features disabled[    1.779827] sun4i-drm display-engine: bound 1e40000.display-backend (ops 0xc07482cc)[    1.795785] sun4i-drm display-engine: No panel or bridge found... RGB output disabled[    1.811456] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc074724c)[    1.827130] sun4i-drm display-engine: No panel or bridge found... RGB output disabled[    1.842825] sun4i-drm display-engine: bound 1c0d000.lcd-controller (ops 0xc074724c)[    1.858540] sun4i-drm display-engine: bound 1c16000.hdmi (ops 0xc0748cd0)[    1.872123] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).[    1.885344] [drm] No driver support for vblank timestamp query.[    1.897182] fb: switching to sun4i-drm-fb from simple[    1.907391] Console: switching to colour dummy device 80x30[    2.418984] [drm] Cannot find any crtc or sizes[    2.428711] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0[    2.545528] ahci-sunxi 1c18000.sata: controller cant do PMP, turning off CAP_PMP[    2.560532] ahci-sunxi 1c18000.sata: SSS flag set, parallel bus scan disabled[    2.574817] ahci-sunxi 1c18000.sata: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode[    2.592721] ahci-sunxi 1c18000.sata: flags: ncq sntf stag pm led clo only pio slum part ccc[    2.610642] scsi host0: ahci-sunxi[    2.617874] ata1: SATA max UDMA/133 mmio [mem 0x01c18000-0x01c18fff] port 0x100 irq 36[    2.635546] libphy: Fixed MDIO Bus: probed[    2.643735] CAN device driver interface[    2.652152] sun7i-dwmac 1c50000.ethernet: PTP uses main clock[    2.663680] sun7i-dwmac 1c50000.ethernet: no reset control found[    2.676345] ehci_hcd: USB 2.0 Enhanced Host Controller (EHCI) Driver[    2.689416] ehci-platform: EHCI generic platform driver[    2.700248] ohci_hcd: USB 1.1 Open Host Controller (OHCI) Driver[    2.712647] ohci-platform: OHCI generic platform driver[    2.725114] sunxi-rtc 1c20d00.rtc: registered as rtc0[    2.735252] sunxi-rtc 1c20d00.rtc: RTC enabled[    2.744274] i2c /dev entries driver[    2.752374] axp20x-i2c 1-0034: AXP20x variant AXP209 found[    2.778365] input: axp20x-pek as /devices/platform/soc1c00000/1c2ac00.i2c/i2c-1/1-0034/axp20x-pek/input/input0[    2.799556] ldo1: supplied by regulator-dummy[    2.808582] ldo2: supplied by regulator-dummy[    2.818392] ldo3: supplied by regulator-dummy[    2.827795] ldo4: supplied by regulator-dummy[    2.836730] ldo5: supplied by regulator-dummy[    2.846544] dcdc2: supplied by regulator-dummy[    2.856093] dcdc3: supplied by regulator-dummy[    2.866705] axp20x-i2c 1-0034: AXP20X driver loaded[    2.877918] Registered IR keymap rc-empty[    2.886099] rc rc0: sunxi-ir as /devices/platform/soc1c00000/1c21800.ir/rc/rc0[    2.900854] input: sunxi-ir as /devices/platform/soc1c00000/1c21800.ir/rc/rc0/input1[    2.916966] sunxi-ir 1c21800.ir: initialized sunXi IR driver[    2.930370] sunxi-wdt 1c20c90.watchdog: Watchdog enabled (timeout16 sec, nowayout0)[    2.949908] sunxi-mmc 1c0f000.mmc: Got CD GPIO[    2.957174] ata1: SATA link down (SStatus 0 SControl 300)[    2.984443] sunxi-mmc 1c0f000.mmc: base:0x(ptrval) irq:30[    2.996403] sun4i-ss 1c15000.crypto-engine: Die ID 0[    3.008208] usbcore: registered new interface driver usbhid[    3.019411] usbhid: USB HID core driver[    3.028477] random: fast init done[    3.038082] sun4i-codec 1c22c00.codec: ASoC: Failed to create component debugfs directory[    3.055988] sun4i-codec 1c22c00.codec: Codec - 1c22c00.codec mapping ok[    3.070975] NET: Registered protocol family 17[    3.079931] can: controller area network core (rev 20170425 abi 9)[    3.092458] NET: Registered protocol family 29[    3.101361] can: raw protocol (rev 20170425)[    3.109908] can: broadcast manager protocol (rev 20170425 t)[    3.121240] can: netlink gateway (rev 20170425) max_hops1[    3.132444] Key type dns_resolver registered[    3.141113] Registering SWP/SWPB emulation handler[    3.155150] mmc0: host does not support reading read-only switch, assuming write-enable[    3.162888] sun7i-dwmac 1c50000.ethernet: PTP uses main clock[    3.182777] sun7i-dwmac 1c50000.ethernet: no reset control found[    3.194864] mmc0: new high speed SDHC card at address 59b4[    3.206939] mmcblk0: mmc0:59b4 USD00 7.32 GiB[    3.217882]  mmcblk0: p1 p2[    3.305735] sun7i-dwmac 1c50000.ethernet: Version ID not available[    3.318137] sun7i-dwmac 1c50000.ethernet:    DWMAC1000[    3.328068] sun7i-dwmac 1c50000.ethernet: DMA HW capability register supported[    3.342498] sun7i-dwmac 1c50000.ethernet: Normal descriptors[    3.353804] sun7i-dwmac 1c50000.ethernet: Ring mode enabled[    3.372879] libphy: stmmac: probed[    3.379711] mdio_bus stmmac-0:00: attached PHY driver [unbound] (mii_bus:phy_addrstmmac-0:00, irqPOLL)[    3.398646] mdio_bus stmmac-0:01: attached PHY driver [unbound] (mii_bus:phy_addrstmmac-0:01, irqPOLL)[    3.437826] ehci-platform 1c14000.usb: EHCI Host Controller[    3.449048] ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1[    4.445622] [drm] Cannot find any crtc or sizes[    4.454972] ehci-platform 1c14000.usb: irq 32, io mem 0x01c14000[    4.495500] ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00[    4.508602] hub 1-0:1.0: USB hub found[    4.516156] hub 1-0:1.0: 1 port detected[    4.524842] ehci-platform 1c1c000.usb: EHCI Host Controller[    4.536034] ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 2[    4.551813] ehci-platform 1c1c000.usb: irq 37, io mem 0x01c1c000[    4.585504] ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00[    4.598505] hub 2-0:1.0: USB hub found[    4.606055] hub 2-0:1.0: 1 port detected[    4.614695] ohci-platform 1c14400.usb: Generic Platform OHCI controller[    4.627974] ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 3[    4.643687] ohci-platform 1c14400.usb: irq 33, io mem 0x01c14400[    4.730281] hub 3-0:1.0: USB hub found[    4.737832] hub 3-0:1.0: 1 port detected[    4.746524] ohci-platform 1c1c400.usb: Generic Platform OHCI controller[    4.759793] ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 4[    4.775542] ohci-platform 1c1c400.usb: irq 38, io mem 0x01c1c400[    4.860311] hub 4-0:1.0: USB hub found[    4.867876] hub 4-0:1.0: 1 port detected[    4.876658] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator[    4.898584] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver[    4.910112] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 5[    4.926629] hub 5-0:1.0: USB hub found[    4.934193] hub 5-0:1.0: 1 port detected[    4.942801] sunxi-rtc 1c20d00.rtc: setting system clock to 1970-01-01 00:00:11 UTC (11)[    4.959189] vcc3v0: disabling[    4.965121] vcc5v0: disabling[    4.971086] usb0-vbus: disabling[    4.977556] ALSA device list:[    4.983479]   #0: sun4i-codec[    4.989417] ### BBB.[    4.997149] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem[    5.011809] EXT4-fs (mmcblk0p2): write access will be enabled during recovery[    5.029755] EXT4-fs (mmcblk0p2): recovery complete[    5.090424] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)[    5.106669] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.[    5.121202] devtmpfs: mounted[    5.127186] ## 111.[    5.132783] Freeing unused kernel memory: 1024K[    5.141851] ## 2.可以看到从第 5 行到第 12 行区区几个函数竟然打印了那么多而且还看到了众多驱动相关的打印如 usb、Console、Key、io、pinctrl、Serial、CAN、RTC、input、mmc、mdio_bus说明我们整天开发的驱动是在这个阶段初始化的呀。这里我直接给出调用关系可以看到驱动相关的打印是在 do_initcalls() 中产生的kernel_init()kernel_init_freeable()do_basic_setup()printk(### AAA.\n);do_initcalls();printk(### BBB.\n);static void __init do_initcalls(void){int level;for (level  0; level  ARRAY_SIZE(initcall_levels) - 1; level)do_initcall_level(level);}do_initcalls() 函数循环将编译进内核的内核模块的初始化函数依次调用一遍。这些初始化函数也是有等级的总共有 7 个级别 1-7数字越大级别越低被调用的就越晚。其中我们最长用的 module_init() 为第 6 级等级算是比较低的了调用也会较晚想想也是好多外部模块都是使用的 module_init()它们可都是在内核完全启动后再手动安装的呀更晚。这个阶段打印了很多 log说明内核中大部分的代码都是驱动内核中写了大量的内核模块初始化的函数。驱动初始化完内核也就接近尾声了[    4.989417] ### BBB.[    4.997149] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem[    5.011809] EXT4-fs (mmcblk0p2): write access will be enabled during recovery[    5.029755] EXT4-fs (mmcblk0p2): recovery complete[    5.090424] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)[    5.106669] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.[    5.121202] devtmpfs: mounted[    5.127186] ## 111.[    5.132783] Freeing unused kernel memory: 1024K[    5.141851] ## 2.[    5.145862] ## 3.[    5.149703] ## 4.[    5.162188] ## kernel_init() -- /sbin/init## init_main()[    5.232554] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)Starting syslogd: OKStarting klogd: OKRunning sysctl: OKInitializing random number generator: OKSaving random seed: [    5.377468] random: dd: uninitialized urandom read (512 bytes read)OKStarting network: OKWelcome to Bananapi M1buildroot login:挂载根文件系统内核收尾工作kernel_init 内核线程调用 do_execve 函数去执行 init 程序产生 init 进程1 号进程。该内核线程终结。rest_init() 函数的最后一句 cpu_startup_entry(CPUHP_ONLINE); 最终变成了 idle 进程0 号进程。void cpu_startup_entry(enum cpuhp_state state){/** This #ifdef needs to die, but its too late in the cycle to* make this generic (ARM and SH have never invoked the canary* init for the non boot CPUs!). Will be fixed in 3.11*/#ifdef CONFIG_X86/** If were the non-boot CPU, nothing set the stack canary up* for us. The boot CPU already has it initialized but no harm* in doing it again. This is a good place for updating it, as* we wont ever return from this function (so the invalid* canaries already on the stack wont ever trigger).*/boot_init_stack_canary();#endifarch_cpu_idle_prepare();cpuhp_online_idle(state);while (1)do_idle();}而在 kernel_init 同期稍晚创建的 kthreadd 内核线程则一直存在成为 2 号进程# psPID   USER     COMMAND1 root     init2 root     [kthreadd]3 root     [rcu_gp]4 root     [rcu_par_gp]7 root     [kworker/u4:0-ev]8 root     [mm_percpu_wq]9 root     [ksoftirqd/0]...转自https://liyongjun.blog.csdn.net/article/details/121529063这个大佬的其他文章写的也非常不错对初学者有很大的借鉴意义虽然说csdn有些地方做得不是很好但是确实是国内内容最丰富的技术平台。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/909619.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

鸿蒙项目实战(九):get请求参数的处理

get请求将键值对数据拼接到url后面,并且进行编码处理(编码空格(转为%20)和中文字符等非保留字符)static async get<T>(url: string, params?: HashMap<string,object>): Promise<T> {if (params…

20250806_信安一把梭_test

流量分析, 应急响应, Webshell, 信安一把梭Tags:流量分析, 应急响应, Webshell, 信安一把梭 0x00. 题目 流量包描述:可恶的黑客,在我的电脑上传了几个奇怪的文件,老师教了我排查但是我没学会,但是我认识大佬你,请…

专业 RAW 图像处理利器!DxO PhotoLab 让你的照片质感飙升

对于摄影爱好者、专业摄影师以及图像后期从业者而言,一款能精准挖掘 RAW 文件潜力、兼顾操作效率与专业功能的图像处理软件,是提升作品质感的核心工具。DxO PhotoLab 作为专业级 RAW 图像处理软件,凭借强大的智能校…

mysql时间转字符串,自定义格式将日期时间值转换为字符串

在 MySQL 中,将时间 / 日期类型转换为字符串可以使用 DATE_FORMAT() 函数,该函数允许你根据自定义格式将日期时间值转换为字符串。 基本语法 sql DATE_FORMAT(date, format) date:要转换的日期 / 时间字段或值(可以…

网站制作工作室制作平台国外网站后缀

指针常量 指针常量&#xff1a;顾名思义它就是一个常量&#xff0c;但是是指针修饰的。 格式为&#xff1a; int * const p //指针常量在这个例子下定义以下代码&#xff1a; int a&#xff0c;b&#xff1b; int * const p&a //指针常量 //那么分为一下两种操作 *p9;//操…

怎么做原创电影视频网站海口智能建站详情

&#x1f64a;作者简介&#xff1a;多年一线开发工作经验&#xff0c;原创团队&#xff0c;分享技术代码帮助学生学习&#xff0c;独立完成自己的网站项目。 代码可以查看文章末尾⬇️联系方式获取&#xff0c;记得注明来意哦~&#x1f339;赠送计算机毕业设计600个选题excel文…

苏州吴中长桥网站建设wordpress获取标签链接

目录 一、Nginx概述 1.1 负载均衡概述 1.2 负载均衡的作用 1.3 四/七层负载均衡 1.3.1 网络模型简介 1.3.2 四层和七层负载均衡对比 1.3.3 Nginx七层负载均衡实现 1.4 Nginx负载均衡配置 1.5 Nginx负载均衡状态 1.6 Nginx负载均衡策略 二、负载均衡实战 2.1 测试服…

茌平网站建设菜谱制作小公司企业简介300字

单例模式,是设计模式当中非常重要的一种,在面试中也常常被考察到。 正文如下: 一、什么时候使用单例模式? 单例模式可谓是23种设计模式中最简单、最常见的设计模式了,它可以保证一个类只有一个实例。我们平时网购时用的购物车,就是单例模式的一个例子。想一想,如果购物…

菏泽住房和城乡建设部网站常德论坛市民留言尚一网

目录 一、环境准备二、工作区限制三、什么是计算目标&#xff1f;四、本地计算机五、远程虚拟机六、Apache Spark 池七、Azure HDInsight八、Azure Batch九、Azure Databricks十、Azure Data Lake Analytics十一、Azure 容器实例十二、Kubernetes 了解如何用 SDK v1 将 Azure 计…

万州网站制作凡科建站怎样建站中站

&#xff08;1&#xff09;线程属性 Linux下线程的属性是可以根据实际项目需要&#xff0c;进行设置&#xff0c;之前我们讨论的线程都是采用线程的默认属性&#xff0c;默认属性已经可以解决绝大多数开发时遇到的问题。如我们对程序的性能提出更高的要求那么需要设置线程属性…

网站h5什么意思游戏平台网站开发

1024程序员节当当网计算机图书每满100减50&#xff01;满200减100&#xff01;满300-150&#xff01;机械工业出版社华章公司联合当当网特意为【DotNET技术圈】用户申请了一批可与满减叠加使用的“满200减30”的图书优惠码&#xff0c;优惠码使用后相当于&#xff1a;400减230 …

哈尔滨智能建站模板什么网站可以找人做设计师

ps切片导出时将切片选项选择为“所有用户切片”&#xff0c;可导出所有切中的区域。转载于:https://www.cnblogs.com/npk19195global/p/4513707.html

网站备案证书放到哪里怎么建设电子商城网站

如果希望自己的代码更优雅、可维护性更高以及更简洁&#xff0c;往往离不开设计模式这一解决方案。 在JS设计模式中&#xff0c;最核心的思想&#xff1a;封装变化&#xff08;将变与不变分离&#xff0c;确保变化的部分灵活&#xff0c;不变的部分稳定&#xff09;。 那么来…

其他与其它的区别

“其他”与“其它”在现代汉语中基本可互换,但有细微区别,主要体现在使用习惯和规范上:✅ 规范区别(《现代汉语词典》第7版):词语规范用法举例其他 ✅ 泛指人或事物,更通用 其他人、其他事、其他问题其它 ✅ 仅…

网站后台 登录界面模板 远吗北京手机网站设计报价

指针基础知识&#xff1a;C语言学习笔记之指针&#xff08;一&#xff09;-CSDN博客 目录 字符指针 代码分析 指针数组 数组指针 函数指针 代码分析&#xff08;出自《C陷阱和缺陷》&#xff09; 函数指针数组 指向函数指针数组的指针 回调函数 qsort() 字符指针 一…

样板网站建设中英文网站

博主打算从0-1讲解下java基础教学&#xff0c;今天教学第十五篇&#xff1a;Java中Spring详解说明。 Spring 框架是一个广泛应用于 Java 开发的轻量级、全栈式的企业应用开发框架&#xff0c;它提供了众多功能强大的模块&#xff0c;用于简化企业级应用程序的开发。下面详细说…

珠海斗门建设局官方网站实时热点新闻事件

最近你们是否遇到注册亚马逊账号时一直遇到"内部错误"的情况&#xff1f;&#xff0c;这可能是由多种原因引起的。以下是一些可能有助于解决这个问题的步骤&#xff1a; 1、清除缓存和Cookie&#xff1a;有时浏览器缓存和Cookie中的问题可能导致网站错误。可以试试清…

外卖网站那家做的好做网站项目

远程控制软件非常之多&#xff0c;但小编自己用过的就那么3个&#xff1a;teamviewer&#xff1a;在家远程办公时基本上都靠它连回公司的电脑&#xff0c;速度快、稳定、不需要公网IP。vnc&#xff1a;要开启vpn才能连回公司的网络&#xff0c;速度够快。系统自带远程桌面&…

衡水提供网站制作公司哪家专业罗湖网站建设联系电话

作者&#xff1a;Wwww_来源&#xff1a;牛客网问简历上项目&#xff0c;看我用了GreenDao开源库&#xff0c;问为什么使用这个数据库Java&#xff1a;1. 抽象类和接口&#xff0c;问的很细而且比较灵活。还记得的有&#xff1a;接口中能不能有protected修饰的方法&#xff1b;能…