[syslinux] hide all output

Gene Cumm gene.cumm at gmail.com
Thu Feb 19 19:25:05 PST 2009

On Thu, Feb 19, 2009 at 9:59 PM, Gene Cumm <gene.cumm at gmail.com> wrote:
> On Tue, Feb 17, 2009 at 9:22 PM, Jason <jflatt at cox.net> wrote:
>> I have been looking for a replacement bootloader that will hide all output and
>> just boot the linux kernel.  I was using grub, but that output way too much
>> information.  I just tried extlinux and am liking it a lot more than grub.  I
>> would like to have absolutely no output at all though.  By setting the PROMPT
>> to 0 it removes everything but the title.  Is there a setting that removes the
>> EXTLINUX 3.20 3.20-pre8  Copyright (C) 1994-2005 H. Peter Anvin output?  I've
>> already tried the CONSOLE 0 directive.
> The version/copyright line is written before the configuration is
> read.  This would require that you edit extlinux.asm to prevent it
> from writing the text then recompile EXTLINUX.  The biggest issue with
> such is that you will not know if anything works or fails until
> something else outputs something to the console.
> For this kind of a situation it may be easier to (by default) load a
> COMBOOT/COM32 module that clears the screen (as simple as writing a
> bunch of newlines) then runs another command that you pass to it.
> This should be a simple extension of either my alias.c32 module or
> Michael Brown's cmd.c32 module.

Here's a quick sample.  I still have to go back and clean up some more
stylings of my code but if you have an environment for building COM32
modules, this should help get you moving a little sooner.  Assuming
your computer is using a normal video console and operates faster than
a 1MHz (I think it would work even at that speed), I think this should
effectively display nothing except the output from a kernel.

Simple use example in a config:


LABEL linux
KERNEL aliasclr.c32
APPEND kernel kernel_options

If your goal is visual rather than control, I'd also suggest not
putting "NOESCAPE 1" into your config.  By not placing this in there,
it will allow you to diagnose issues using Shift, Alt, CapsLock or
ScrollLock.  See syslinux.txt for more info on this.


/* ----------------------------------------------------------------------- *
 *   Copyright 2008-2009 Gene Cumm - All Rights Reserved
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
 *   Boston MA 02111-1307, USA; either version 2 of the License, or
 *   (at your option) any later version; incorporated herein by reference.
 * ----------------------------------------------------------------------- */

 * aliasclr.c
 * Alias & ClearScreen COM32 application;  Clears the screen (using newlines)
 * then calls as a KERNEL with a boot line command as the APPEND line.

 * History
 * b004	aliasclr.c; Add NUM_NL newlines to beginning of output
 * 	Cleanup code to standards
 * b003	Work on resolving a potential overflow issue with building the
 *	command string to pass to syslinux_run_command()
 * 	Reformatted {} in more visual style.
 * 	Use MAX_CMDLINE_LEN or COMMAND_LINE_SIZE (in that order) if available
 * b002	Alter the concatenation of the command line arguments to use memcpy
 * b001	Initial version

#include <stdio.h>
#include <stdlib.h>
// #include <stdbool.h>
#include <string.h>
#include <limits.h>

#ifdef __COM32__		/* Allow targetting Linux, etc to test */
#include <syslinux/boot.h>	/* syslinux_run_command() */
#ifdef __linux__		/* For COMMAND_LINE_SIZE */
#include <asm/setup.h>
#endif	/* __linux__ */
#endif	/* __COM32__ */

/* Possible referenced values for command line length:
 *	MAX_CMDLINE_LEN (com32/menu/menu.h)
 *	LINE_MAX or _POSIX2_LINE_MAX	<limits.h> on *nix systems;
 *		Seem more appropriate for a shell command line
 *	COMMAND_LINE_SIZE <asm/setup.h> on a Linux system
#define ALIAS_CMD_SZ	2048
#endif	/* COMMAND_LINE_SIZE */
#endif	/* MAX_CMDLINE_LEN */

#define NUM_NL	40
	/* Number of lines to clear */

// #define DO_DEBUG 1	/* Uncomment this for additional output */

#define APP_LONGNAME	"AliasClr COM32"
#define APP_NAME	"aliasclr"
#define APP_YEAR	"2009"
#define APP_AUTHOR	"Gene Cumm"
#define APP_VER		"beta-b004"

int main(int argc, char *argv[])
	char cmdstr[ALIAS_CMD_SZ];	/* Command string to execute */
	int curpos;	/* Current position in cmdstr; Use memcpy rather than
		strcat */
	int arglen;	/* length of current argument string */
	int i;

	/* Initialization */
	curpos = 0;
	cmdstr[0] = 0;
#ifdef DO_DEBUG
	printf("\n%d\n\n", ALIAS_CMD_SZ);
#endif	/* DO_DEBUG */

	for (i=0; i<NUM_NL; i++)

	for(i=1; i<argc; i++)
		arglen = strlen(argv[i]);
		/* Theoretically, this should never be met in SYSLINUX */
		if ((curpos + arglen) > (ALIAS_CMD_SZ - 1))
			arglen = (ALIAS_CMD_SZ - 1) - curpos;
		memcpy(cmdstr + curpos, argv[i], arglen);
		curpos += arglen;
		if (curpos >= (ALIAS_CMD_SZ - 1))
		{	/* Hopefully, curpos should not be greater than (ALIAS_CMD_SZ - 1)
			 * Still need a '\0' at the last character
			cmdstr[(ALIAS_CMD_SZ - 1)] = 0;
			/* Escape out of the for() loop;  We can no longer process anything more */
			cmdstr[curpos] = ' ';
			curpos += 1;
			cmdstr[curpos] = 0;
	curpos -= 1;
	if(cmdstr[curpos] == ' ')
		/* If there's a ' ' at the end, remove it.  This is normal
		 * unless the maximum length is met/exceeded.
		cmdstr[curpos] = 0;
#ifdef DO_DEBUG
	printf("Parsed arg list\n");
#endif	/* DO_DEBUG */
	printf("--alias: '%s'\n", cmdstr);
#ifdef __COM32__
#endif	/* __COM32__ */

	return 0;

More information about the Syslinux mailing list