Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For security reasons I have to boot Linux from u-boot with all output hidden (silently) until a password is entered. I've configured uBoot to do this correctly using the CONFIG_AUTOBOOT_KEYED macro and can successfully boot silently.

The issue I am having is that when uBoot boots the Linux kernel and silent mode is enabled, it passes console= as part of the bootargs to Linux kernel. This is fine for silent booting, but I can't seem to find a way to re-enable the console again after bootup.

I've also tried to boot normally and append loglevel=0 to the kernal bootargs which works for silent bootup, but again I cannot re-enable the console. I've tried:

dmesg -n 4

and

klogd -c 4

to try to set the Kernel loglevel back to KERN_WARNING (4) without luck. These commands work properly when I boot the Kernel normally.

The best guide I've found on the matter is Silencing the boot process on blackfin.uclinux.org.

Ideally I'd like to use uBoot's silent mode where it passes console= as part of the bootargs but still take input on the console and re-enable output when the password is entered, but I am open to other ideas if anyone can help guide me I would greatly appreciate it.

share|improve this question

migrated from stackoverflow.com Jul 21 '11 at 19:43

This question came from our site for professional and enthusiast programmers.

    
An alternative to change the loglevel is to write to /proc/sys/kernel/printk. See proc(5) for details. –  camh Jul 21 '11 at 22:10
    
Thanks I'll see if I can get any further using printk. –  sbtkd85 Jul 22 '11 at 13:16

1 Answer 1

up vote 1 down vote accepted

If anyone else runs into this issue I never found a good fix. I ended up hacking both u-boot and the linux kernel serial driver and basically checking if the password had been entered. If it had, I allowed the code to run normally. If it hadn't I just returned from the functions so that nothing was actually printed out on the console.

For Kernel I edited the receive_chars() function to look for the password (input) and transmit_chars() to mask output. I had u-boot pass the password in as part of the bootargs. If it was null, then the password was already entered and we ignored the special code. If it was a value, then we grabbed input chars via receive_chars() and compare them to the stored string from bootargs.

In u-boot I just used the CONFIG_AUTOBOOT_KEYED and associated default macros for the password entry. I then changed common/cmd_bootm.c to not call fixup_silent_linux() to mask the console= value and let the kernel deal with it as stated above.

Hopefully this helps someone else.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.