make oldconfig overwriting value in .config - linux

I'm attempting to compile the linux kernel and use a custom .config file.
So I copy the .config to my folder where the kernel source is, and run "make oldconfig" on the file to see if I'm missing anything. However, it appears that doing so modifies a few of my values back to what they were before I edited them:
< CONFIG_TRACEPOINTS=y
---
> CONFIG_TRACEPOINTS=n
< # CONFIG_DEBUG_RODATA is not set
< # CONFIG_DEBUG_SET_MODULE_RONX is not set
---
> CONFIG_DEBUG_RODATA=n
> CONFIG_DEBUG_SET_MODULE_RONX=n
How can I get oldconfig to keep the values as they were modified?
Thanks

Usually kernel config options are dependent on other config options. So even if you disable one config option, as its enabled by some other config option it will fall back to its original value after you do make oldconfig
In case of CONFIG_TRACEPOINTS it depends on or set by several other flags TRACING [=y] || BLK_DEV_IO_TRACE [=y] && TRACING_SUPPORT [=y] && FTRACE [=y] && SYSFS [=y] && BLOCK [=y]
Try setting one by one of them to =n along with CONFIG_TRACEPOINTS=n and see if its persistent after doing make oldconfig. For me setting CONFIG_FTRACE=n worked
How to find dependency. Run make menuconfig. Press / to search the config option and see the Selected by. Those are the config flags who are also setting your config option. See their current value next to them. For e.g. above you can see that TRACING_SUPPORT is set to y

Related

Amend boot cmdline in custom image build

I'm building a custom image that uses the meta-intel layer (I'm targeting Intel boards, such as the Minnowboard Turbot, for instance), and I want to tweak the options for booting.
First problem
As far as I understand, meta-intel uses systemd-boot (via rmc-boot) as EFI_PROVIDER.
So I should be able to override the specific BOOT_TIMEOUT parameter by setting :
SYSTEMD_BOOT_TIMEOUT := "0"
in my custom image, as far as I can see in this file
Unfortunately, that doesn't work (the boot timeout is still 4 seconds). How come ?
Second problem
As well, I would like to append options to the boot.conf file (in /boot/loader/entries, loaded by /boot/loader/loader.conf), such as quiet, or vt.global_cursor_default=0 for instance.
I see in the Intel machine conf that there is an APPEND configuration, but overriding it or appending to it in my custom image doesn't work (it's still not written in the boot.conf file) :
APPEND += "quiet vt.global_cursor_default=0"
I've checked that the configuration is correctly read and it's the case :
$ bitbake my-custom-image -e | grep ^APPEND= -A1 -B1
# " quiet rootwait console=ttyS0,115200 console=tty0${#bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}"
APPEND=" quiet vt.global_cursor_default=0 rootwait console=ttyS0,115200 console=tty0"
#
But no matter what I do, the command line doesn't change on the built image.
What do I miss ? There should be a relatively easy way to achieve what I'm after I guess, but so far I have not managed to do it.
Thanks a lot !
I have been looking at the kernel command line parameters for intel platform in Yocto with the meta-intel.
I have noticed differences between the wic and hddimg yocto images.
The hddimg seems to use the rmc boot entry definition whereas the wic image uses the boot entry defined in the wks kickstart.
My machine conf has the following :
WKS_FILE ?= "${#bb.utils.contains_any("EFI_PROVIDER", "systemd-boot rmc-boot", "systemd-bootdisk.wks", "mkefidisk.wks", d)}"
In turns systemd-bootdisk.wks has the following boot entry "boot" :
bootloader --ptable gpt --timeout=5 --append="rootwait rootfstype=ext4 console=ttyS0,115200 console=tty0"
The RMC definition for my Minnowboard Max has 2 entry a boot and an install.
Minnow Max B3 boot
Minnow Max B3 install
I am using the pyro release for Yocto. Perhaps integration of RMC boot definition has been integrated into the wic images.
I am looking for a common place to add the kernel command line parameter. Any idea ?

Enable/Disable Kernel Configuration options in Yocto

I have a configuration option called CONFIG_X86_SMAP that I would like to disable in my kernel image. The problem is that I can't identify where this option is being set. I can confirm that it isn't set in my defconfig file and also it's not set by any configuration fragment ".cfg".
Even when I try to disable it using a .cfg as follows:
# CONFIG_FOO is not set
I still find it enabled in my final generated .config file. I cant get to understand how this option is being enabled.
Note: There is no dependency on this configuration option from any other driver/feature.
You can modify your defconfig by following these steps.
Identify in which tasks .config is generated.(In most cases there would be do_configure or do_defconfig task that will create your .config)
Add following lines in your recipe(linux-kernel.bb file).This will append configurations to your defconfig file.
do_confiure_prepend() {
cat >> <path_to_your_defconfig> << END
CONFIG_X=y
CONFIG_Y is not set
END
}

How to setup syslog in yocto?

I like to configure syslog. It seems that are more than one way to set up syslog. I am asking for the common way/steps to do that.
I have several use cases. To simplify I like to ask how to configure syslog to write an infinity long log file in /var/log/.
Following steps:
1.) configure what messages
1.1) create own "syslog.conf" (define /var/log/myLog)
1.2) append it to "recipes-core/busybox"
2.) configure how to log
??
I found two possible places to do that:
#meta-poky
-> "meta-poky/recipes-core/busybox/busybox/poky-tiny/defconfig"
#
# System Logging Utilities
#
CONFIG_SYSLOGD=y
CONFIG_FEATURE_ROTATE_LOGFILE=y
CONFIG_FEATURE_REMOTE_LOG=y
CONFIG_FEATURE_SYSLOGD_DUP=y
CONFIG_FEATURE_SYSLOGD_CFG=y
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
CONFIG_FEATURE_IPC_SYSLOG=y
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
CONFIG_LOGREAD=y
CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
CONFIG_KLOGD=y
CONFIG_FEATURE_KLOGD_KLOGCTL=y
CONFIG_LOGGER=y
add/change:
"CONFIG_FEATURE_ROTATE_LOGFILE=n" by adding that line to meta-mylayer/conf/layer.conf"
etc.
???
# "/etc/syslog-startup.conf"
# This configuration file is used by the busybox syslog init script,
# /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
DESTINATION=file # log destinations (buffer file remote)
LOGFILE=/var/log/messages # where to log (file)
REMOTE=loghost:514 # where to log (syslog remote)
REDUCE=no # reduce-size logging
DROPDUPLICATES=no # whether to drop duplicate log entries
#ROTATESIZE=0 # rotate log if grown beyond X [kByte]
#ROTATEGENS=3 # keep X generations of rotated logs
BUFFERSIZE=64 # size of circular buffer [kByte]
FOREGROUND=no # run in foreground (don't use!)
#LOGLEVEL=5 # local log level (between 1 and 8)
In the systemV init script "/etc/init.d/syslog.bussybox" the file "/etc/syslog-startup.con" is read and used for configuration.
System behaviour:
When running my system, the log wraps when the logfile reaches 200kBytes. One logfile + one log-rotate file is generated.
Any ideas how to archive that syslog writes an infinite long log-file?
I am working on the Yocto krogoth branch + meta-atmel / meta_openembedded (# krogoth too).
By checking the sources of syslog and busybox I found a possible solution. This solution shows how to configure syslog to log in two logs with max 10MByte:
1.) get valid syslog build config
1.1) download busybox -> git/busybox
1.2) build busybox via bitbake -> bitbake busybox
1.3) copy defconfig file to downloaded busybox -> cp /defconfig git/busybox/
1.4) make menueconfig
1.5) goto "System Logging Utilities"
1.6) deselect klogd because it can colide with printk
1.7) save to "defconfig"
#
# System Logging Utilities
#
# CONFIG_KLOGD is not set
# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
CONFIG_LOGGER=y
CONFIG_LOGREAD=y
CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
CONFIG_SYSLOGD=y
CONFIG_FEATURE_ROTATE_LOGFILE=y
CONFIG_FEATURE_REMOTE_LOG=y
CONFIG_FEATURE_SYSLOGD_DUP=y
CONFIG_FEATURE_SYSLOGD_CFG=y
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
CONFIG_FEATURE_IPC_SYSLOG=y
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=64
CONFIG_FEATURE_KMSG_SYSLOG=y
2.) setup your log config
Create "syslog.conf" and enter the rules:
This is an example:
#
# /etc/syslog.conf Configuration file for busybox's syslogd utility
#
kern.notice /var/log/messages
#
# my software messages
#
user.err /var/log/mySWError
user.* /var/log/mySWFull
local0.* /var/log/mySWFull
local0.err /var/log/mySWError
#
#this prevents from logging to default log file (-O FILE or /var/log/messages)
#
*.* /dev/null
3.) modify configuration for the busybox syslog deamon
This example logs to files which are limited to 10 MBytes. If "ROTATESIZE" is not set syslog set the log filesize automatic to 200 kBytes. The content of "syslog-startup.conf" looks like:
# This configuration file is used by the busybox syslog init script,
# /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
DESTINATION=file # log destinations (buffer file remote)
#LOGFILE=/var/log/messages # where to log (file)
REMOTE=loghost:514 # where to log (syslog remote)
REDUCE=no # reduce-size logging
DROPDUPLICATES=no # whether to drop duplicate log entries
ROTATESIZE=10000 # rotate log if grown beyond X [kByte]
#ROTATEGENS=3 # keep X generations of rotated logs
BUFFERSIZE=64 # size of circular buffer [kByte]
FOREGROUND=no # run in foreground (don't use!)
#LOGLEVEL=5 # local log level (between 1 and 8)
4.) get the configuration into yocto build
4.1) create following directory structure in your own layer(meta-custom):
meta-custom/recipes-core/
meta-custom/recipes-core/busybox/
meta-custom/recipes-core/busybox/busybox
4.2) copy into "meta-custom/recipes-core/busybox/busybox":
defconfig
syslog.conf
syslog-startup.conf
4.3) create in "meta-custom/recipes-core/busybox/" "busybox_1.24.1.bbappend". If you using an older/newer version of busybox you need to change the "1.24.1" number to yours. You can find your version in "/poky/meta/recipes-core/busybox/"
Add this two lines to this file:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/poky-tiny:"
5.) build your custom defined syslog
bitbake busybox
and transfer it into the rootfs of the image
bitbake core-image-minimal
Now it should work!
Adding to the Stefan Jaritz comment, you can skip the download step by just issuing
bitbake busybox -c devshell
Then running make menuconfig and getting the new config file from it. Note that this will use Yocto's defconfig by default, so you don't need to do worry about "what's this default config".

QEMU simple backend tracing dosen't print anything

I'm doing get simple trace file from QEMU.
I followed instructions docs/tracing.txt
with this command "qemu-system-x86_64 -m 2G -trace events=/tmp/events ../qemu/test.img"
i'd like to get just simple trace file.
i've got trace-pid file, however, it dosen't have anything in it.
Build with the 'simple' trace backend:
./configure --enable-trace-backends=simple
make
Create a file with the events you want to trace:
echo bdrv_aio_readv > /tmp/events
echo bdrv_aio_writev >> /tmp/events
Run the virtual machine to produce a trace file:
qemu -trace events=/tmp/events ... # your normal QEMU invocation
Pretty-print the binary trace file:
./scripts/simpletrace.py trace-events trace-* # Override * with QEMU
i followd this instructions.
please somebody give me some advise for this situation.
THANKS!
I got same problem by following the same document.
https://fossies.org/linux/qemu/docs/tracing.txt
got nothing because
bdrv_aio_readv and bdrv_aio_writev was not enabled by default, at least the version I complied, was not enabled. you need to open trace-events under source directory, looking for some line without disabled, e.g. I using:
echo "load_file" > /tmp/events
Then start qemu,
after a guest started, I run
./scripts/simpletrace.py trace-events trace-Pid
I got
load_file 1474.156 pid=5249 name=kvmvapic.bin path=qemu-2.8.0-rc0/pc-bios/kvmvapic.bin
load_file 22437.571 pid=5249 name=vgabios-stdvga.bin path=qemu-2.8.0-rc0/pc-bios/vgabios-stdvga.bin
load_file 10034.465 pid=5249 name=efi-e1000.rom
you can also add -monitor stdio to qemu command line, after it started, you can the following command in qemu CLI:
(qemu) info trace-events
load_file : state 1
vm_state_notify : state 1
balloon_event : state 0
cpu_out : state 0
cpu_in : state 0
1 means enabled events.
Modify the trace-events file in the source tree
As of v2.9.0 you also have to remove the disable from the lines you want to enable there, e.g.:
-disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
+exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
and recompile.
Here is a minimal fully automated runnable example that boots Linux and produces traces: https://github.com/cirosantilli/linux-kernel-module-cheat
For example, I used the traces to count how many boot instructions Linux has: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/c7bbc6029af7f4fab0a23a380d1607df0b2a3701/count-boot-instructions.md
I have a lightly patched QEMU as a submodule, the key commit is: https://github.com/cirosantilli/qemu/commit/e583d175e4cdfb12b4812a259e45c679743b32ad

linux "make oldconfig" discards an entry CONFIG_K8_NB

I have a .config in the top directory with CONFIG_k8_NB=y, however, after I type "yes "" | make oldconfig", the "CONFIG_k8_NB=y" is gone.
I am certain the CONFIG_k8_NB can be supported by the kernel.
I have found why, it's caused by the dependency of the configuration:
in arch/i386/Kconfig
config K8_NB
def_bool y
depends on AGP_AMD64
we should add:
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
to enable K8_NB
there is a pointer talking about the issue:
http://www.kerneltrap.org/mailarchive/linux-kernel/2010/3/8/4545694

Resources