Skip to contentSkip to conversation

kernel doesn't start booting after chaning to minimum config (on qemu arm64 machine)

DISCUSSION Chan Kim 2 participants 3 messages Oct 12, 2021 – Oct 13, 2021

lore
Share & tools
lore

Chan Kim

author
#0 lore raw

Hello all,

To make a minimal kernel size (with almost no driver), I copied a .config that was used for building kernel for sparc machine using linux 3.3 several years ago to current linux 5.4.21 version build tree.

(That .config was for kernel with interrupt controller, timer and uart so a very basic scheduling and shell is possible.)

Then I ran

Yes "" | make ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- oldconfig

This copies the configs and sets all the new config settings with default values.

(see
https://serverfault.com/questions/116299/automatically-answer-defaults-when-
doing-make-oldconfig-on-a-kernel-tree)

Now I can see the start_kernel function runs to the end and it's running inside the cpu_idle function. but I don't see the first scrolling message below that I normally should see.

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]

I tried adding several CONFIG variables using menuconfig but it's still the same.

(CONFIG_SERIAL_AMBA_PL010, CONFIG_SERIAL_AMBA_PL010_CONSOLE, CONFIG_SERIAL_CORE, CONFIG_SERIAL_CORE_CONSOLE were already automatically set.

And later I tried adding CONFIG_CPU_IDLE, CONFIG_CPU_IDLE_GOV_LADDR, CONFIG_ACPI and other ACPI related things, CONFIG_PCI_ECAM, CONFIG_PNP, CONFIG_PNP_DEBUG_MESSAGES, .. )

And the qemu command is like this.

${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel ${LINUX_DIR}/arch/arm64/boot/Image -initrd ${BUSYBOX_DIR}/initramfs.cpio.gz --append "root=/dev/ram init=/init nokaslr earlycon ip=dhcp" -m 2048M -nographic -netdev user,id=n1 -device e1000,netdev=n1

Has anyone any idea what I can add in the config or try? (with original .config, the kernel boots ok to the bash in initramfs)

Any suggestion will be appreciated.

Thank you,

Kind regards,

Chan Kim

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

#1 lore raw
Quoted 46 lines · Chan Kim

Hello all,

To make a minimal kernel size (with almost no driver), I copied a .config that was used for building kernel for sparc machine using linux 3.3 several years ago to current linux 5.4.21 version build tree.

(That .config was for kernel with interrupt controller, timer and uart so a very basic scheduling and shell is possible.)

Then I ran

Yes "" | make ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- oldconfig

This copies the configs and sets all the new config settings with default values.

(see
https://serverfault.com/questions/116299/automatically-answer-defaults-when-
doing-make-oldconfig-on-a-kernel-tree)

Now I can see the start_kernel function runs to the end and it's running inside the cpu_idle function. but I don't see the first scrolling message below that I normally should see.

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]

I tried adding several CONFIG variables using menuconfig but it's still the same.

(CONFIG_SERIAL_AMBA_PL010, CONFIG_SERIAL_AMBA_PL010_CONSOLE, CONFIG_SERIAL_CORE, CONFIG_SERIAL_CORE_CONSOLE were already automatically set.

And later I tried adding CONFIG_CPU_IDLE, CONFIG_CPU_IDLE_GOV_LADDR, CONFIG_ACPI and other ACPI related things, CONFIG_PCI_ECAM, CONFIG_PNP, CONFIG_PNP_DEBUG_MESSAGES, .. )

And the qemu command is like this.

${QEMU_DIR}/qemu-system-aarch64 -M ${QMACHINE} -cpu cortex-a72 -kernel ${LINUX_DIR}/arch/arm64/boot/Image -initrd ${BUSYBOX_DIR}/initramfs.cpio.gz --append "root=/dev/ram init=/init nokaslr earlycon ip=dhcp" -m 2048M -nographic -netdev user,id=n1 -device e1000,netdev=n1

Quoted 4 lines

Has anyone any idea what I can add in the config or try? (with original .config, the kernel boots ok to the bash in initramfs)

Any suggestion will be appreciated.

There are two different ways of getting a "minimal" kernel configuration:
- start with a working one and remove items until something breaks
- start with a minimal config and keep adding things until it works.

Usually the first option is the easier one, as it should go faster and you can figure out exactly what is needed. The second way is just blindly guessing, like it seems you are doing here.

Best of luck!

greg k-h

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

author
#2 lore raw

Hi Greg K-H,

Quoted 7 lines

There are two different ways of getting a "minimal" kernel configuration:
- start with a working one and remove items until something breaks
- start with a minimal config and keep adding things until it works.

Quoted 7 lines

Usually the first option is the easier one, as it should go faster and you can figure out exactly what is needed. The second way is just blindly guessing, like it seems you are doing here.

Best of luck!

greg k-h

After reading your email I thought I'd try just a couple of more additions (because gradually removing will take so long..) and tried adding the most suspicious ones. Then I found CONFIG_SERIAL_AMBA_PL011, CONFIG_SERIAL_AMBA_PL011_CONSOLE and CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST were not set! (qemu virt machine uses PL011 not PL010 which was set). After this addition, it boots ok to the shell! I was very luck.. 😊 Thank you,
Best regards,

Chan Kim

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies