Ben Hutchings
6ed5e20466
bootconfig: Fix unaligned access when building footer
...
Currently we add padding between the bootconfig text and footer to
ensure that the footer is aligned within the initramfs image.
However, because only the bootconfig data is held in memory, not the
full initramfs image, the footer may not be naturally aligned in
memory.
This can result in an alignment fault (SIGBUS) when writing the footer
on some architectures, such as sparc.
Build the footer in a struct on the stack before adding it to the
buffer.
References: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=sparc64&ver=6.16%7Erc7-1%7Eexp1&stamp=1753209801&raw=0
Link: https://lore.kernel.org/all/aIC-NTw-cdm9ZGFw@decadent.org.uk/
Signed-off-by: Ben Hutchings <benh@debian.org >
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-07-24 22:16:48 +09:00
Bhaskar Chowdhury
9afa2e0d42
tools/bootconfig: scripts/ftrace.sh was missing the shebang line, so added it
...
This file was missing the shebang line, so added it.
Link: https://lore.kernel.org/all/20250722225351.8811-1-unixbhaskar@gmail.com/
[Masami: changed title. ]
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com >
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-07-24 00:23:39 +09:00
Masami Hiramatsu (Google)
26dda57695
tools/bootconfig: Cleanup bootconfig footer size calculations
...
There are many same pattern of 8 + BOOTCONFIG_MAGIC_LEN for calculating
the size of bootconfig footer. Use BOOTCONFIG_FOOTER_SIZE macro to
clean up those magic numbers.
Link: https://lore.kernel.org/all/175211425693.2591046.16029516706923643510.stgit@mhiramat.tok.corp.google.com/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-07-14 11:56:11 +09:00
Masami Hiramatsu (Google)
a141656ac8
tools/bootconfig: Replace some echo with printf for more portability
...
Since echo is not portable, use printf instead. This fixes a wrong
test result formatting in some environment. (showing "\t\t[OK]")
Also this uses printf command for generating test data instead of
echo.
Link: https://lore.kernel.org/all/175211424942.2591046.5439447789303314213.stgit@mhiramat.tok.corp.google.com/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-07-14 11:55:58 +09:00
Masami Hiramatsu (Google)
bfed3dd2a1
tools/bootconfig: Improve portability
...
Since 'stat' command and 'truncate' command are GNU extension,
use 'wc' and 'dd' commands instead.
Link: https://lore.kernel.org/all/175211424184.2591046.3523297993175066026.stgit@mhiramat.tok.corp.google.com/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-07-14 11:55:42 +09:00
Bhaskar Chowdhury
63989c7798
tools: bootconfig: Regex enclosed with quotes to make syntax highlight proper
...
As suggested, changed the square brackets escaping to quote the whole Regex
class.
Link: https://lore.kernel.org/all/20250709030141.27483-1-unixbhaskar@gmail.com/
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com >
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-07-14 11:55:17 +09:00
Brian Masney
d81bab116b
tools/bootconfig: specify LDFLAGS as an argument to CC
...
Explicitly specify LDFLAGS as an argument to CC so that this can be
overridden by the user.
Link: https://lore.kernel.org/all/20250328183858.1417835-3-bmasney@redhat.com/
Signed-off-by: Brian Masney <bmasney@redhat.com >
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-05-16 11:22:54 +09:00
Brian Masney
9c8cedef3d
tools/bootconfig: allow overriding CFLAGS assignment
...
Allow overriding the CFLAGS assignment so that the user can pass in
an outside value.
Link: https://lore.kernel.org/all/20250328183858.1417835-2-bmasney@redhat.com/
Signed-off-by: Brian Masney <bmasney@redhat.com >
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-05-16 11:22:40 +09:00
Luo Yifan
f6ab7384d5
tools/bootconfig: Fix the wrong format specifier
...
Use '%u' instead of '%d' for unsigned int.
Link: https://lore.kernel.org/all/20241105011048.201629-1-luoyifan@cmss.chinamobile.com/
Fixes: 9737800111 ("tools/bootconfig: Suppress non-error messages")
Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com >
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2025-01-28 23:27:01 +09:00
Masami Hiramatsu (Google)
b69245126a
bootconfig: Fix testcase to increase max node
...
Since commit 6c40624930 ("bootconfig: Increase max nodes of bootconfig
from 1024 to 8192 for DCC support") increased the max number of bootconfig
node to 8192, the bootconfig testcase of the max number of nodes fails.
To fix this issue, we can not simply increase the number in the test script
because the test bootconfig file becomes too big (>32KB). To fix that, we
can use a combination of three alphabets (26^3 = 17576). But with that,
we can not express the 8193 (just one exceed from the limitation) because
it also exceeds the max size of bootconfig. So, the first 26 nodes will just
use one alphabet.
With this fix, test-bootconfig.sh passes all tests.
Link: https://lore.kernel.org/all/167888844790.791176.670805252426835131.stgit@devnote2/
Reported-by: Heinz Wiesinger <pprkut@slackware.com >
Link: https://lore.kernel.org/all/2463802.XAFRqVoOGU@amaterasu.liwjatan.org
Fixes: 6c40624930 ("bootconfig: Increase max nodes of bootconfig from 1024 to 8192 for DCC support")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2023-03-22 01:00:28 +09:00
Antonio Alvarez Feijoo
cf8c59a375
tools/bootconfig: fix single & used for logical condition
...
A single & will create a background process and return true, so the grep
command will run even if the file checked in the first condition does not
exist.
Link: https://lore.kernel.org/all/20230112114215.17103-1-antonio.feijoo@suse.com/
Fixes: 1eaad3ac3f ("tools/bootconfig: Use per-group/all enable option in ftrace2bconf script")
Signed-off-by: Antonio Alvarez Feijoo <antonio.feijoo@suse.com >
Cc: stable@vger.kernel.org
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org >
2023-02-22 08:27:35 +09:00
Masami Hiramatsu
4ee1b4cac2
bootconfig: Cleanup dummy headers in tools/bootconfig
...
Cleanup dummy headers in tools/bootconfig/include except
for tools/bootconfig/include/linux/bootconfig.h.
For this change, I use __KERNEL__ macro to split kernel
header #include and introduce xbc_alloc_mem() and
xbc_free_mem().
Link: https://lkml.kernel.org/r/163187299574.2366983.18371329724128746091.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-10-10 22:16:02 -04:00
Masami Hiramatsu
4f292c4886
bootconfig: Replace u16 and u32 with uint16_t and uint32_t
...
Replace u16 and u32 with uint16_t and uint32_t so
that the tools/bootconfig only needs <stdint.h>.
Link: https://lkml.kernel.org/r/163187298835.2366983.9838262576854319669.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-10-10 20:44:05 -04:00
Masami Hiramatsu
160321b260
tools/bootconfig: Print all error message in stderr
...
Print all error message in stderr. This also removes
unneeded tools/bootconfig/include/linux/printk.h.
Link: https://lkml.kernel.org/r/163187298106.2366983.15210300267326257397.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-10-10 20:44:05 -04:00
Masami Hiramatsu
115d4d08ae
bootconfig: Rename xbc_destroy_all() to xbc_exit()
...
Avoid using this noisy name and use more calm one.
This is just a name change. No functional change.
Link: https://lkml.kernel.org/r/163187295918.2366983.5231840238429996027.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-10-10 20:44:05 -04:00
Masami Hiramatsu
f30f00cc96
tools/bootconfig: Run test script when build all
...
Run the bootconfig test script when build all target
so that user can notice any issue when build it.
Link: https://lkml.kernel.org/r/163187295173.2366983.18295281097397499118.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-10-10 20:44:05 -04:00
Masami Hiramatsu
e306220cb7
bootconfig: Add xbc_get_info() for the node information
...
Add xbc_get_info() API which allows user to get the
number of used xbc_nodes and the size of bootconfig
data. This is also useful for checking the bootconfig
is initialized or not.
Link: https://lkml.kernel.org/r/163177340877.682366.4360676589783197627.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-10-10 20:43:53 -04:00
Masami Hiramatsu
bdac5c2b24
bootconfig: Allocate xbc_data inside xbc_init()
...
Allocate 'xbc_data' in the xbc_init() so that it does
not need to care about the ownership of the copied
data.
Link: https://lkml.kernel.org/r/163177339986.682366.898762699429769117.stgit@devnote2
Suggested-by: Steven Rostedt <rostedt@goodmis.org >
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-10-10 20:43:42 -04:00
Masami Hiramatsu
80be5998ad
tools/bootconfig: Define memblock_free_ptr() to fix build error
...
The lib/bootconfig.c file is shared with the 'bootconfig' tooling, and
as a result, the changes incommit 77e02cf57b ("memblock: introduce
saner 'memblock_free_ptr()' interface") need to also be reflected in the
tooling header file.
So define the new memblock_free_ptr() wrapper, and remove unused __pa()
and memblock_free().
Fixes: 77e02cf57b ("memblock: introduce saner 'memblock_free_ptr()' interface")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-09-15 09:49:48 -07:00
Masami Hiramatsu
47914d4e59
tools/bootconfig: Show whole test command for each test case
...
Show whole test command instead of only the 3rd argument.
This will clear to show what will be actually tested by
each test case.
Link: https://lkml.kernel.org/r/163077088607.222577.14786016266462495017.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-09-08 15:29:16 -04:00
Julio Faracco
903bd067fa
bootconfig: Fix missing return check of xbc_node_compose_key function
...
The function `xbc_show_list should` handle the keys during the
composition. Even the errors returned by the compose function. Instead
of removing the `ret` variable, it should save the value and show the
exact error. This missing variable is causing a compilation issue also.
Link: https://lkml.kernel.org/r/163077087861.222577.12884543474750968146.stgit@devnote2
Fixes: e5efaeb8a8 ("bootconfig: Support mixing a value and subkeys under a key")
Signed-off-by: Julio Faracco <jcfaracco@gmail.com >
Acked-by: Masami Hiramatsu <mhiramat@kernel.org >
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-09-08 15:28:50 -04:00
Masami Hiramatsu
32ba9f0fb0
tools/bootconfig: Fix tracing_on option checking in ftrace2bconf.sh
...
Since tracing_on indicates only "1" (default) or "0", ftrace2bconf.sh
only need to check the value is "0".
Link: https://lkml.kernel.org/r/163077087144.222577.6888011847727968737.stgit@devnote2
Fixes: 55ed456077 ("tools/bootconfig: Add tracing_on support to helper scripts")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-09-08 15:10:41 -04:00
Masami Hiramatsu
1eaad3ac3f
tools/bootconfig: Use per-group/all enable option in ftrace2bconf script
...
Use per-group/all enable option instead of ftrace.events option.
This will make the bootconfig file more readable.
Link: https://lkml.kernel.org/r/162856129436.203126.12462564671412940618.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-08-16 11:39:50 -04:00
Masami Hiramatsu
f134ebb281
tools/bootconfig: Add histogram syntax support to bconf2ftrace.sh
...
Add histogram syntax support to bconf2ftrace.sh script.
Link: https://lkml.kernel.org/r/162856128672.203126.8240335908303312607.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-08-16 11:39:50 -04:00
Masami Hiramatsu
1d8365a553
tools/bootconfig: Support per-group/all event enabling option
...
Add group or all event enabling syntax support to bconf2ftrace.sh.
User can pass a bootconfig file which includes
ftrace[.instance.INSTANCE].event.enable
and
ftrace[.instance.INSTANCE].event.GROUP.enable
correctly.
Link: https://lkml.kernel.org/r/162856127850.203126.16694505101982548237.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-08-16 11:37:23 -04:00
Masami Hiramatsu
99f4f5d623
bootconfig: Share the checksum function with tools
...
Move the checksum calculation function into the header for sharing it
with tools/bootconfig.
Link: https://lkml.kernel.org/r/162262197470.264090.16325743685807878807.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-06-10 13:41:26 -04:00
Masami Hiramatsu
29e1c1ad3f
tools/bootconfig: Support mixed value and subkey test cases
...
Update test case to support mixed value and subkey on a key.
Link: https://lkml.kernel.org/r/162262195568.264090.12431204030021242896.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-06-10 13:41:26 -04:00
Masami Hiramatsu
e5efaeb8a8
bootconfig: Support mixing a value and subkeys under a key
...
Support mixing a value and subkeys under a key. Since kernel cmdline
options will support "aaa.bbb=value1 aaa.bbb.ccc=value2", it is
better that the bootconfig supports such configuration too.
Note that this does not change syntax itself but just accepts
mixed value and subkeys e.g.
key = value1
key.subkey = value2
But this is not accepted;
key {
value1
subkey = value2
}
That will make value1 as a subkey.
Also, the order of the value node under a key is fixed. If there
are a value and subkeys, the value is always the first child node
of the key. Thus if user specifies subkeys first, e.g.
key.subkey = value1
key = value2
In the program (and /proc/bootconfig), it will be shown as below
key = value2
key.subkey = value1
Link: https://lkml.kernel.org/r/162262194685.264090.7738574774030567419.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-06-10 13:41:26 -04:00
Masami Hiramatsu
ca24306d83
bootconfig: Change array value to use child node
...
It is not possible to put an array value with subkeys under
a key node, because both of subkeys and the array elements
are using "next" field of the xbc_node.
Thus this changes the array values to use "child" field in
the array case. The reason why split this change is to
test it easily.
Link: https://lkml.kernel.org/r/162262193838.264090.16044473274501498656.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-06-10 13:38:25 -04:00
zuoqilin
30d103f2d4
tools/bootconfig: Simplify expression
...
It is not necessary to define the variable ret to receive
the return value of the xbc_node_compose_key() method.
Link: https://lkml.kernel.org/r/20210414134647.1870-1-zuoqilin1@163.com
Acked-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: zuoqilin <zuoqilin@yulong.com >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-06-10 11:16:20 -04:00
Masami Hiramatsu
824afd55e9
tools/bootconfig: Fix a build error accroding to undefined fallthrough
...
Since the "fallthrough" is defined only in the kernel, building
lib/bootconfig.c as a part of user-space tools causes a build
error.
Add a dummy fallthrough to avoid the build error.
Link: https://lkml.kernel.org/r/162087519356.442660.11385099982318160180.stgit@devnote2
Cc: Ingo Molnar <mingo@kernel.org >
Cc: stable@vger.kernel.org
Fixes: 4c1ca831ad ("Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-06-08 16:44:00 -04:00
Zhen Lei
e8ba0b2b64
tools/bootconfig: Fix error return code in apply_xbc()
...
Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.
Link: https://lkml.kernel.org/r/20210508034216.2277-1-thunder.leizhen@huawei.com
Fixes: a995e6bc05 ("tools/bootconfig: Fix to check the write failure correctly")
Reported-by: Hulk Robot <hulkci@huawei.com >
Acked-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-06-08 16:43:59 -04:00
Masami Hiramatsu
55ed456077
tools/bootconfig: Add tracing_on support to helper scripts
...
Add ftrace.instance.INSTANCE.tracing_on support to ftrace2bconf.sh
and bconf2ftrace.sh.
commit 8490db06f9 ("tracing/boot: Add per-instance tracing_on
option support") added the per-instance tracing_on option,
but forgot to update the helper scripts.
Link: https://lkml.kernel.org/r/160749166410.3497930.14204335886811029800.stgit@devnote2
Cc: stable@vger.kernel.org
Fixes: 8490db06f9 ("tracing/boot: Add per-instance tracing_on option support")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2021-01-14 10:32:20 -05:00
Masami Hiramatsu
e86843580d
tools/bootconfig: Store size and checksum in footer as le32
...
Store the size and the checksum fields in the footer as le32
instead of u32. This will allow us to apply bootconfig to the
cross build initrd without caring the endianness.
Link: https://lkml.kernel.org/r/160583935332.547349.5897811300636587426.stgit@devnote2
Reported-by: Steven Rostedt <rostedt@goodmis.org >
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-11-30 23:22:11 -05:00
Masami Hiramatsu
e1cef2d4c3
tools/bootconfig: Align the bootconfig applied initrd image size to 4
...
Align the bootconfig applied initrd image size to 4. To fill the gap,
the bootconfig command uses null characters in between the bootconfig
data and the footer. This will expands the footer size but don't change
the checksum.
Thus the block image of the initrd file with bootconfig is as follows.
[initrd][bootconfig][(pad)][size][csum]["#BOOTCONFIG\n"]
Link: https://lkml.kernel.org/r/160576522046.320071.8550680670010950634.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-11-19 08:55:44 -05:00
Masami Hiramatsu
a995e6bc05
tools/bootconfig: Fix to check the write failure correctly
...
Fix to check the write(2) failure including partial write
correctly and try to rollback the partial write, because
if there is no BOOTCONFIG_MAGIC string, we can not remove it.
Link: https://lkml.kernel.org/r/160576521135.320071.3883101436675969998.stgit@devnote2
Fixes: 85c46b78da ("bootconfig: Add bootconfig magic word for indicating bootconfig explicitly")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-11-19 08:55:44 -05:00
Masami Hiramatsu
a61ea6379a
tools/bootconfig: Fix errno reference after printf()
...
Fix not to refer the errno variable as the result of previous libc
functions after printf() because printf() can change the errno.
Link: https://lkml.kernel.org/r/160576520243.320071.51093664672431249.stgit@devnote2
Fixes: 85c46b78da ("bootconfig: Add bootconfig magic word for indicating bootconfig explicitly")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-11-19 08:55:44 -05:00
Linus Torvalds
fefa636d81
Merge tag 'trace-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
...
Pull tracing updates from Steven Rostedt:
"Updates for tracing and bootconfig:
- Add support for "bool" type in synthetic events
- Add per instance tracing for bootconfig
- Support perf-style return probe ("SYMBOL%return") in kprobes and
uprobes
- Allow for kprobes to be enabled earlier in boot up
- Added tracepoint helper function to allow testing if tracepoints
are enabled in headers
- Synthetic events can now have dynamic strings (variable length)
- Various fixes and cleanups"
* tag 'trace-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (58 commits)
tracing: support "bool" type in synthetic trace events
selftests/ftrace: Add test case for synthetic event syntax errors
tracing: Handle synthetic event array field type checking correctly
selftests/ftrace: Change synthetic event name for inter-event-combined test
tracing: Add synthetic event error logging
tracing: Check that the synthetic event and field names are legal
tracing: Move is_good_name() from trace_probe.h to trace.h
tracing: Don't show dynamic string internals in synthetic event description
tracing: Fix some typos in comments
tracing/boot: Add ftrace.instance.*.alloc_snapshot option
tracing: Fix race in trace_open and buffer resize call
tracing: Check return value of __create_val_fields() before using its result
tracing: Fix synthetic print fmt check for use of __get_str()
tracing: Remove a pointless assignment
ftrace: ftrace_global_list is renamed to ftrace_ops_list
ftrace: Format variable declarations of ftrace_allocate_records
ftrace: Simplify the calculation of page number for ftrace_page->records
ftrace: Simplify the dyn_ftrace->flags macro
ftrace: Simplify the hash calculation
ftrace: Use fls() to get the bits for dup_hash()
...
2020-10-15 15:51:28 -07:00
Masami Hiramatsu
2f5fb55563
tools/bootconfig: Add testcase for tailing space
...
Add testcases for removing/keeping tailing space
in the value.
Link: https://lkml.kernel.org/r/160068151151.1088739.3469541807296024227.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-21 21:57:12 -04:00
Masami Hiramatsu
1d210c166b
tools/bootconfig: Add testcases for repeated key with brace
...
Add a testcase for repeated key with brace parsing issue.
Link: https://lkml.kernel.org/r/160068150176.1088739.409481347784771987.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-21 21:56:55 -04:00
Masami Hiramatsu
5675fd4ef5
tools/bootconfig: Add --init option for bconf2ftrace.sh
...
Since the ftrace current setting may conflict with the new setting
from bootconfig, add the --init option to initialize ftrace before
setting for bconf2ftrace.sh.
E.g.
$ bconf2ftrace.sh --init boottrace.bconf
This initialization method copied from selftests/ftrace.
Link: https://lkml.kernel.org/r/159704853203.175360.17029578033994278231.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-18 22:17:13 -04:00
Masami Hiramatsu
2b86062a34
tools/bootconfig: Add a script to generates bootconfig from ftrace
...
Add a ftrace2bconf.sh under tools/bootconfig/scripts which generates
a bootconfig file from the current ftrace settings.
To read the ftrace settings, ftrace2bconf.sh requires the root
privilege (or sudo). The ftrace2bconf.sh will output the bootconfig
to stdout and error messages to stderr, so usually you'll run it as
# ftrace2bconf.sh > ftrace.bconf
Note that some ftrace configurations are not supported. For example,
function-call/callgraph trace/notrace settings are not supported because
the wildcard has been expanded and lost in the ftrace anymore.
Link: https://lkml.kernel.org/r/159704852163.175360.16738029520293360558.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-18 22:17:13 -04:00
Masami Hiramatsu
7e66ef0046
tools/bootconfig: Add a script to generate ftrace shell-command from bootconfig
...
Add a bconf2ftrace.sh under tools/bootconfig/scripts which generates
a shell script to setup boot-time trace from bootconfig file for testing
the bootconfig.
bconf2ftrace.sh will take a bootconfig file (includes boot-time tracing)
and convert it into a shell-script which is almost same as the boot-time
tracer does.
If --apply option is given, it also tries to apply those command to the
running kernel, which requires the root privilege (or sudo).
For example, if you just want to confirm the shell commands, save
the output as below.
# bconf2ftrace.sh ftrace.bconf > ftrace.sh
Or, you can apply it directly.
# bconf2ftrace.sh --apply ftrace.bconf
Note that some boot-time tracing parameters under kernel.* are not able
to set via tracefs nor procfs (e.g. tp_printk, traceoff_on_warning.),
so those are ignored.
Link: https://lkml.kernel.org/r/159704851101.175360.15119132351139842345.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-18 22:17:13 -04:00
Masami Hiramatsu
483ce6708d
tools/bootconfig: Make all functions static
...
Make all functions static except for main(). This is just a cleanup.
Link: https://lkml.kernel.org/r/159704850135.175360.12465608936326167517.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-18 22:17:13 -04:00
Masami Hiramatsu
e4f70b7bad
tools/bootconfig: Add list option
...
Add list option (-l) to show the bootconfig in the list style.
This is same output of /proc/bootconfig. So users can check
how their bootconfig will be shown in procfs. This will help
them to write a user-space script to parse the /proc/bootconfig.
Link: https://lkml.kernel.org/r/159704849087.175360.8761890802048625207.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-18 22:17:13 -04:00
Masami Hiramatsu
d052e1c690
tools/bootconfig: Show bootconfig compact tree from bootconfig file
...
Show the bootconfig compact tree from the bootconfig file
instead of an initrd if the given file has no magic number
and is smaller than 32KB.
User can use this for checking the syntax error or output
checking before applying the bootconfig to initrd.
Link: https://lkml.kernel.org/r/159704848156.175360.6621139371000789360.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-09-18 22:17:13 -04:00
Masami Hiramatsu
8146419283
tools/bootconfig: Add testcases for value override operator
...
Add some testcases and examples for value override operator.
Link: https://lkml.kernel.org/r/159482883824.126704.2166030493721357163.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-08-03 16:22:29 -04:00
Masami Hiramatsu
5414251aa2
tools/bootconfig: Add testcase for show-command and quotes test
...
Add testcases for the return value of the command to show
bootconfig in initrd, and double/single quotes selecting.
Link: http://lkml.kernel.org/r/159230247428.65555.2109472942519215104.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-06-16 21:21:03 -04:00
Masami Hiramatsu
f91cb5b747
tools/bootconfig: Fix to return 0 if succeeded to show the bootconfig
...
Fix bootconfig to return 0 if succeeded to show the bootconfig
in initrd. Without this fix, "bootconfig INITRD" command
returns !0 even if the command succeeded to show the bootconfig.
Link: http://lkml.kernel.org/r/159230246566.65555.11891772258543514487.stgit@devnote2
Cc: stable@vger.kernel.org
Fixes: 950313ebf7 ("tools: bootconfig: Add bootconfig command")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-06-16 21:21:03 -04:00
Masami Hiramatsu
272da3279d
tools/bootconfig: Fix to use correct quotes for value
...
Fix bootconfig tool to select double or single quotes
correctly according to the value.
If a bootconfig value includes a double quote character,
we must use single-quotes to quote that value.
Link: http://lkml.kernel.org/r/159230245697.65555.12444299015852932304.stgit@devnote2
Cc: stable@vger.kernel.org
Fixes: 950313ebf7 ("tools: bootconfig: Add bootconfig command")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2020-06-16 21:21:03 -04:00