You need to define HELLO
at compile time, (either with -DHELLO
as a compiler flag or #define HELLO
somewhere), otherwise the compiler never even sees the printk
call and no code for it gets emitted.
You can't make the C compiler get re-run at early stage boot time based on the boot parameters, which is what you'd need to do to change HELLO
there.
The kernel is no different than any other C program in this respect - preprocessor directives are handled really early on in compilation.
You can setup parameters with this helper macro that are a regular variable that can be set a boot and tested at runtime (not compile time) with a plain old if
statement.