Bug 15271

Summary: no start-qemu.sh
Product: buildroot Reporter: Andrei Cherniaev <glscene2010>
Component: OtherAssignee: unassigned
Status: RESOLVED WONTFIX    
Severity: normal CC: buildroot
Priority: P5 Keywords: FIXME
Version: 2022.11   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Qemu Target:
Build: Ubuntu 22 X86_64
Attachments: usage: make BR2_EXTERNAL=/mnt/ramdisk/my_external_tree -C buildroot my_qemu_x86_defconfig

Description Andrei Cherniaev 2023-01-22 13:54:33 UTC
Created attachment 9481 [details]
usage: make BR2_EXTERNAL=/mnt/ramdisk/my_external_tree -C buildroot my_qemu_x86_defconfig

Buildroot can't produce start-qemu.sh with my my_qemu_x86_defconfig. Why?

git clone https://github.com/buildroot/buildroot
make qemu_x86_defconfig -C buildroot
make -C buildroot

There is buildroot/output/images/start-qemu.sh (and also rootfs.ext2 bzImage). Ok. Next:

make clean -C buildroot
#copy linux.config with new name
cp /mnt/ramdisk/buildroot/board/qemu/x86/linux.config /mnt/ramdisk/my_external_tree/board/my_company/my_board/my_linux.config

#copy qemu_x86_defconfig with new name
cp /mnt/ramdisk/buildroot/configs/qemu_x86_defconfig /mnt/ramdisk/my_external_tree/configs/my_qemu_x86_defconfig

nano /mnt/ramdisk/my_external_tree/configs/my_qemu_x86_defconfig
# and change BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE like this BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="/mnt/ramdisk/my_external_tree/board/my_company/my_board/my_linux.config", save

make BR2_EXTERNAL=/mnt/ramdisk/my_external_tree -C buildroot my_qemu_x86_defconfig
make -C buildroot

There is no buildroot/output/images/start-qemu.sh ("No Qemu cmd line found, can't test"). There are buildroot/output/images/bzImage and buildroot/output/images/rootfs.ext2 only. Why?

And also I see another thing like a bug:
--make clean doesn't remove .br2-external files--

After my success building
make clean -C buildroot
make BR2_EXTERNAL=/mnt/ramdisk/my_external_tree -C buildroot my_qemu_x86_defconfig
make -C buildroot

I try
make clean -C buildroot

But in /mnt/ramdisk/buildroot/output/ there are 9 .br2-external... files. Why 
make clean -C buildroot
doesn't remove this files?
Comment 1 Andrei Cherniaev 2023-01-24 08:25:17 UTC
There is interesting code in file buildroot/board/qemu/post-image.sh 

# Search for "# qemu_*_defconfig" tag in all readme.txt files.
# Qemu command line on multilines using back slash are accepted.
QEMU_CMD_LINE=$(sed -r ':a; /\\$/N; s/\\\n//; s/\t/ /; ta; /# '${DEFCONFIG_NAME}'$/!d; s/#.*//' ${README_FILES})

This script search "qemu_..._defconfig" in readme.txt files. Looks very bad idea... May be buildroot project should use runqemu python script from yocto
https://docs.yoctoproject.org/dev-manual/qemu.html#qemu-command-line-syntax
?
runqemu script use .conf files, for example qemux86.conf file https://github.com/yoctoproject/poky/blob/master/meta/conf/machine/qemux86.conf
Comment 2 Thomas Petazzoni 2023-01-28 20:34:54 UTC
Thanks for your report, but I'm afraid there is no bug in what you're reporting:

- We definitely need some sort of hint that tells us whether a start-qemu.sh script should be produced or not, and we have chosen this hint to be "the defconfig starts with qemu_". This is certainly an arbitrary choice, but we anyway had to make an arbitrary choice. In addition, this generation of start-qemu.sh script is really an "internal" Buildroot feature to help users use our stock qemu_*_defconfig. For your own defconfigs, you can provide your own start-qemu.sh script.

- The fact that .br2-external files are preserved on make clean is normal, just like we preserve your .config file. This way, you can restart a build with the same configuration/BR2_EXTERNAL after a "make clean". This is the intended behavior.