按文档获取Android12 内核源码 repo init -u https://aosp.tuna.tsinghua.edu.cn/kernel/manifest -b common-android12-5.4
然后按下面配置命令编译 BUILD_CONFIG=common/build.config.gki.x86_64 build/build.sh
结果生成的bzImage不能启动 Android12的模拟器。模拟器启动打印如下:
[ 1.260833] vgaarb: loaded
[ 1.261050] SCSI subsystem initialized
[ 1.265035] ACPI: bus type USB registered
[ 1.265035] usbcore: registered new interface driver usbfs
[ 1.265141] usbcore: registered new interface driver hub
[ 1.271307] usbcore: registered new device driver usb
[ 1.273133] mc: Linux media interface: v0.10
[ 1.277035] videodev: Linux video capture interface: v2.00
[ 1.278797] EDAC MC: Ver: 3.0.0
[ 1.282183] Advanced Linux Sound Architecture Driver Initialized.
[ 1.282183] Bluetooth: Core ver 2.22
[ 1.285035] NET: Registered protocol family 31
[ 1.289056] Bluetooth: HCI device and connection manager initialized
[ 1.293035] Bluetooth: HCI socket layer initialized
[ 1.293052] Bluetooth: L2CAP socket layer initialized
[ 1.297219] Bluetooth: SCO socket layer initialized
[ 1.301035] nfc: nfc_init: NFC Core ver 0.1
[ 1.301092] NET: Registered protocol family 39
[ 1.305035] PCI: Using ACPI for IRQ routing
[ 1.307242] hpet: 3 channels of 0 reserved for per-cpu timers
[ 1.309145] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[ 1.313044] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[ 1.317265] clocksource: Switched to clocksource hpet
[ 1.759649] VFS: Disk quotas dquot_6.6.0
[ 1.764658] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 1.774970] pnp: PnP ACPI init
[ 1.783414] pnp: PnP ACPI: found 5 devices
[ 1.813194] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[ 1.824108] NET: Registered protocol family 2
[ 1.839052] IP idents hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 1.868073] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes, linear)
[ 1.897460] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 1.919472] TCP bind hash table entries: 16384 (order: 6, 262144 bytes, linear)
[ 1.930605] TCP: Hash tables configured (established 16384 bind 16384)
[ 1.953953] UDP hash table entries: 1024 (order: 3, 32768 bytes, linear)
[ 1.966801] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes, linear)
[ 1.977713] NET: Registered protocol family 1
[ 1.984854] NET: Registered protocol family 44
[ 1.992122] pci_bus 0000:00: resource 4 [io 0x0000-0x0cf7 window]
[ 2.002903] pci_bus 0000:00: resource 5 [io 0x0d00-0xffff window]
[ 2.015135] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[ 2.023628] pci_bus 0000:00: resource 7 [mem 0x80000000-0xfebfffff window]
[ 2.036584] pci_bus 0000:00: resource 8 [mem 0x400000000-0x80005bfff window]
[ 2.050105] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[ 2.057873] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[ 2.069477] pci 0000:00:00.0: __UNIQUE_ID_quirk_natoma363+0x0/0x8 took 11265 usecs
[ 2.084047] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[ 2.096012] pci 0000:00:01.0: __UNIQUE_ID_quirk_isa_dma_hangs340+0x0/0x8 took 11681 usecs
[ 2.106451] PCI: CLS 0 bytes, default 64
[ 2.122574] Trying to unpack rootfs image as initramfs...
[ 2.137657] NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #80!!!
[ 2.484647] Freeing initrd memory: 3580K
[ 2.489956] kvm: no hardware support
[ 2.495956] has_svm: not amd or hygon
[ 2.500422] kvm: no hardware support
[ 2.522156] Initialise system trusted keyrings
[ 2.531982] workingset: timestamp_bits=46 max_order=19 bucket_order=0
[ 2.560467] fuse: init (API version 7.32)
[ 2.578036] Key type asymmetric registered
[ 2.583974] Asymmetric key parser 'x509' registered
[ 2.593325] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 240)
[ 2.605819] io scheduler mq-deadline registered
[ 2.614528] io scheduler kyber registered
[ 2.621104] io scheduler bfq registered
[ 2.644015] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[ 2.658035] ACPI: Power Button [PWRF]
[ 2.668128] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[ 2.677693] 00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 2.700111] brd: module loaded
[ 2.730599] loop: module loaded
[ 2.735409] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information.
[ 2.749046] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
[ 2.766192] tun: Universal TUN/TAP device driver, 1.6
[ 2.772791] CAN device driver interface
[ 2.782313] PPP generic driver version 2.4.2
[ 2.788258] PPP BSD Compression module registered
[ 2.799098] PPP Deflate Compression module registered
[ 2.806118] PPP MPPE Compression module registered
[ 2.817106] NET: Registered protocol family 24
[ 2.823030] PPTP driver version 0.8.5
[ 2.833670] usbcore: registered new interface driver rtl8150
[ 2.845920] usbcore: registered new interface driver r8152
[ 2.858393] usbcore: registered new interface driver cdc_ether
[ 2.874053] usbcore: registered new interface driver cdc_eem
[ 2.886950] usbcore: registered new interface driver cdc_ncm
[ 2.902909] usbcore: registered new interface driver aqc111
[ 2.917846] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 2.935389] ehci-pci: EHCI PCI platform driver
[ 2.945376] ehci-platform: EHCI generic platform driver
[ 2.954110] usbcore: registered new interface driver cdc_acm
[ 2.964073] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 2.977569] usbcore: registered new interface driver uas
[ 2.987700] usbcore: registered new interface driver usb-storage
[ 2.999143] dummy_hcd dummy_hcd.0: USB Host+Gadget Emulator, driver 02 May 2005
[ 3.009829] dummy_hcd dummy_hcd.0: Dummy host controller
[ 3.019660] dummy_hcd dummy_hcd.0: new USB bus registered, assigned bus number 1
[ 3.033736] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[ 3.046048] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 3.056103] usb usb1: Product: Dummy host controller
[ 3.067147] usb usb1: Manufacturer: Linux 5.10.198-android12-9-00006-g75c057fe65b2 dummy_hcd
[ 3.081554] usb usb1: SerialNumber: dummy_hcd.0
[ 3.088043] hub 1-0:1.0: USB hub found
[ 3.096767] hub 1-0:1.0: 1 port detected
[ 3.103037] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[ 3.119154] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 3.130743] serio: i8042 AUX port at 0x60,0x64 irq 12
[ 3.137441] usbcore: registered new interface driver xpad
[ 3.149726] rtc_cmos 00:00: RTC can wake from S4
[ 3.159680] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[ 3.166404] rtc_cmos 00:00: registered as rtc0
[ 3.186225] rtc_cmos 00:00: setting system clock to 2024-02-20T02:39:52 UTC (1708396792)
[ 3.200782] rtc_cmos 00:00: alarms up to one day, y3k, 114 bytes nvram, hpet irqs
[ 3.214795] usbcore: registered new interface driver uvcvideo
[ 3.223893] USB Video Class driver (1.1.1)
[ 3.233796] gspca_main: v2.14.0 registered
[ 3.243525] device-mapper: uevent: version 1.0.3
[ 3.254131] device-mapper: ioctl: 4.44.0-ioctl (2021-02-01) initialised: dm-devel@redhat.com
[ 3.270518] Bluetooth: HCI UART driver ver 2.3
[ 3.278369] Bluetooth: HCI UART protocol H4 registered
[ 3.286221] Bluetooth: HCI UART protocol LL registered
[ 3.295124] Bluetooth: HCI UART protocol Broadcom registered
[ 3.304140] Bluetooth: HCI UART protocol QCA registered
[ 3.313250] intel_pstate: CPU model not supported
[ 3.321368] sdhci: Secure Digital Host Controller Interface driver
[ 3.333277] sdhci: Copyright(c) Pierre Ossman
[ 3.339045] sdhci-pltfm: SDHCI platform and OF driver helper
[ 3.349434] hid: raw HID events driver (C) Jiri Kosina
[ 3.356787] usbcore: registered new interface driver usbhid
[ 3.367841] usbhid: USB HID core driver
[ 3.373378] ashmem: initialized
[ 3.381400] gnss: GNSS driver registered with major 511
[ 3.388186] usbcore: registered new interface driver snd-usb-audio
[ 3.400769] GACT probability NOT on
[ 3.405464] Mirror/redirect action on
[ 3.415532] netem: version 1.3
[ 3.420102] u32 classifier
[ 3.429888] input device check on
[ 3.434137] Actions configured
[ 3.452561] xt_time: kernel timezone is -0000
[ 3.464633] ipip: IPv4 and MPLS over IPv4 tunneling driver
[ 3.473470] gre: GRE over IPv4 demultiplexor driver
[ 3.484637] ip_gre: GRE over IPv4 tunneling driver
[ 3.496660] IPv4 over IPsec tunneling driver
[ 3.504609] Initializing XFRM netlink socket
[ 3.512797] IPsec XFRM device driver
[ 3.517359] NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #80!!!
[ 3.520790] NET: Registered protocol family 10
[ 3.560203] Segment Routing with IPv6
[ 3.569413] mip6: Mobile IPv6
[ 3.583057] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 3.592395] ip6_gre: GRE over IPv6 tunneling driver
[ 3.607473] NET: Registered protocol family 17
[ 3.616443] NET: Registered protocol family 15
[ 3.622544] can: controller area network core
[ 3.645802] NET: Registered protocol family 29
[ 3.652003] can: raw protocol
[ 3.656506] can: broadcast manager protocol
[ 3.665228] can: netlink gateway - max_hops=1
[ 3.672065] Bluetooth: RFCOMM TTY layer initialized
[ 3.681741] Bluetooth: RFCOMM socket layer initialized
[ 3.690872] Bluetooth: RFCOMM ver 1.11
[ 3.701341] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 3.713806] Bluetooth: HIDP socket layer initialized
[ 3.719952] l2tp_core: L2TP core driver, V2.0
[ 3.730166] l2tp_ppp: PPPoL2TP kernel driver, V2.0
[ 3.736582] tipc: Activated (version 2.0.0)
[ 3.751115] NET: Registered protocol family 30
[ 3.761926] tipc: Started in single node mode
[ 3.767795] NET: Registered protocol family 36
[ 3.780808] NET: Registered protocol family 40
[ 3.786607] IPI shorthand broadcast: enabled
[ 3.799716] SSE version of gcm_enc/dec engaged.
[ 3.834705] registered taskstats version 1
[ 3.839965] Loading compiled-in X.509 certificates
[ 3.847855] page_owner is disabled
[ 3.854306] Key type .fscrypt registered
[ 3.868365] Key type fscrypt-provisioning registered
[ 3.887850] pstore: Using crash dump compression: deflate
[ 3.899431]
[ 3.903360] ********************************************************************
[ 3.914966] ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
[ 3.929843] ** **
[ 3.942492] ** WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **
[ 3.956263] ** **
[ 3.978204] ** This means that this kernel is built to expose clk operations **
[ 3.989464] ** such as parent or rate setting, enabling, disabling, etc. **
[ 4.003381] ** to userspace, which may compromise security on your system. **
[ 4.016691] ** **
[ 4.021736] NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #80!!!
[ 4.028303] ** If you see this message and you are not debugging the **
[ 4.055748] ** kernel, report this immediately to your vendor! **
[ 4.069548] ** **
[ 4.082720] ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
[ 4.095809] ********************************************************************
[ 4.106942] Unstable clock detected, switching default tracing clock to "global"
[ 4.106942] If you want to keep using the local clock, then add:
[ 4.106942] "trace_clock=local"
[ 4.106942] on the kernel command line
[ 4.147825] ALSA device list:
[ 4.152256] No soundcards found.
[ 4.169969] Freeing unused kernel image (initmem) memory: 1524K
[ 4.182656] Write protecting the kernel read-only data: 43008k
[ 4.198760] Freeing unused kernel image (text/rodata gap) memory: 2024K
[ 4.214477] Freeing unused kernel image (rodata/data gap) memory: 1524K
[ 4.225456] Run /init as init process
[ 4.266850] init: init first stage started!
[ 4.299636] init: Loading module /lib/modules/ac97_bus.ko with args ''
[ 4.309952] ac97_bus: disagrees about version of symbol module_layout
[ 4.320434] init: Failed to insmod '/lib/modules/ac97_bus.ko' with args '': Exec format error
[ 4.335368] init: LoadWithAliases was unable to load ac97_bus
[ 4.350173] init: Copied ramdisk prop to /second_stage_resources/system/etc/ramdisk/build.prop
[ 4.368114] init: [libfs_mgr]ReadFstabFromDt(): failed to read fstab from dt
[ 4.387545] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 4.616594] init: bool android::init::BlockDevInitializer::InitDevices(std::set<std::string>): partition(s) not found in /sys, waiting for their uevent(s): metadata, super, vbmeta
[ 9.240112] NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #80!!!
[ 9.255911] NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #282!!!
[ 9.327140] NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #80!!!
[ 19.267815] init: Wait for partitions returned after 10012ms
[ 19.277111] init: bool android::init::BlockDevInitializer::InitDevices(std::set<std::string>): partition(s) not found after polling timeout: metadata, super, vbmeta
[ 19.305413] init: Failed to mount required partitions early ...
[ 19.319631] init: InitFatalReboot: signal 6
[ 19.348366] init: #00 pc 00000000003d6e38 /init (UnwindStackCurrent::UnwindFromContext(unsigned long, void*)+88)
[ 19.362810] init: #01 pc 0000000000310a4e /init (android::init::InitFatalReboot(int)+94)
[ 19.373381] init: #02 pc 0000000000310ef3 /init (android::init::InstallRebootSignalHandlers()::$_24::__invoke(int)+19)
[ 19.394188] init: #03 pc 00000000004ee040 /init (__restore_rt)
[ 19.403918] init: #04 pc 00000000004e2eae /init (abort+190)
[ 19.415704] init: #05 pc 0000000000316a3b /init (android::init::InitAborter(char const*)+27)
[ 19.430595] init: #06 pc 000000000037ca2c /init (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+60)
[ 19.450158] init: #07 pc 000000000037c2b0 /init (android::base::LogMessage::~LogMessage()+352)
[ 19.466116] init: #08 pc 0000000000305cf2 /init (android::init::FirstStageMain(int, char**)+9106)
[ 19.482076] init: #09 pc 00000000004da3fe /init (__real_libc_init(void*, void (*)(), int (*)(int, char**, char**), structors_array_t const*, bionic_tcb*)+686)
[ 19.504185] init: Reboot ending, jumping to kernel
[ 19.520968] reboot: Restarting system with command 'bootloader'
[ 19.534618] reboot: machine restart