红联Linux门户
Linux帮助

屏蔽linux启动信息

发布时间:2008-03-15 10:06:00来源:红联作者:Htgiot
屏蔽linux启动信息,其实从细节上来讲,包括3部分

1 grub信息
2 kernel信息
3 application 信息

后面两个信息可以通过在grub中传递 CONSOLE=/dev/null 和 console=/dev/null实现屏蔽,但是从grub启动后仍然会出现如

引用:
"Booting Gentoo Linux 2.6.23 r3"
root (hd0,0)
kernel /boot/kernle-2.6.23-gentoo-r3 root=/dev/sda3
Linux setup size


等字样
因为这是grub打印出来的信息,所以只能从grub自身着手,修改grub 代码,不输出这部分信息

首先去除 Booting字样,这是在grub/stage2/stage2.c boot_entry: 段落中输出

引用:
{
if (config_entries)
printf (" Booting Lynn Linux,pls waiting ^_^ \n");
// printf (" Booting1 \'%s\'\n\n",
// get_entry (menu_entries, first_entry + entryno, 0));
else
printf (" Booting Lynn Linux ,pls waiting ^_^\n");
// printf (" Booting1 command-list\n\n");


把grub_printf注释掉,就可以了

在stage2/cmdline.c中

引用:
builtin = find_command (heap);
if (! builtin)
{
// grub_printf ("%s\n", old_entry);
continue;
}
if (! (builtin->flags & BUILTIN_NO_ECHO))
// grub_printf ("%s\n", old_entry);
/* If BUILTIN cannot be run in the command-line, skip it. */
if (! (builtin->flags & BUILTIN_CMDLINE))
{
errnum = ERR_UNRECOGNIZED;
continue;
}
/* Invalidate the cache, because the user may exchange removable
disks. */
buf_drive = -1;


这样,就屏蔽了第二部分信息

第三部分信息是在 stage2/boot.c中

引用:
if (! big_linux
&& text_len > linux_data_real_addr - (char *) LINUX_ZIMAGE_ADDR)
{
grub_printf (" linux 'zImage' kernel too big, try 'make bzImage'\n");
errnum = ERR_WONT_FIT;
}
else if (linux_data_real_addr + LINUX_SETUP_MOVE_SIZE
> RAW_ADDR ((char *) (mbi.mem_lower 10)))
errnum = ERR_WONT_FIT;
else
{
// grub_printf(" lynn linux image \n");
// grub_printf (" [Linux-%s, setup=0x%x, size=0x%x]\n",
// (big_linux ? "bzImage" : "zImage"), data_len, text_len);
/* Video mode selection support. What a mess! */
/* NOTE: Even the word "mess" is not still enough to
represent how wrong and bad the Linux video support is,
but I don't want to hear complaints from Linux fanatics
any more. -okuji */


这样,通过修改grub代码和穿参数给kernel,就可以屏蔽linux 启动信息了,当然如果你甚至不想要grub菜单出现,那么也是可以实现的,因为菜单是通过grub打印的,所以也只有修改grub 代码可以做到,这里就不再介绍了。
文章评论

共有 0 条评论