📄 cadenux-cmdline.h
字号:
/* linux/include/asm-mips/cadenux-cmdline.h
*
* Selects reasonable default command kernel line based upon
* configuration settings.
*
* Copyright (C) 2004 Cadenux, LLC (http://www.cadenux.com)
* Author: Gregory Nutt <greg.nutt@cadenux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __ASM_CADENUX_CMDLINE_H
#define __ASM_CADENUX_CMDLINE_H
/* Include all configuration settings */
#include <linux/config.h> /* Kernel configuration */
#include <asm/mach-au1x00/memconfig.h> /* BSP configuration */
/* There are four ways that boot configuration information can be
* passed to the kernel:
*
* (1) As a command-line string provided from the bootloader,
* (2) As "tags" provided from the bootloader,
* (3) As a command specified in the kernel configuration via
* 'make xconfig'
* (4) Or by simply using the default commandline.
*
* Obviously, life is simplest if the default command were just
* always right. This header file attempts to select the most
* likely default command line selection by looking at the kernel
* and Cadenux BSP configuration configuration information.
*
* At present, this logic supports the following root file system
* configurations:
*
* 1. SDRAM-based ROMFS on MTD (/dev/mtdblock0)
* 2. SDRAM-based EXT2 on MTD (/dev/mtdblock0)
* 3. FLASH-based ROMFS on MTD (/dev/mtdblock3)
* 4. SDRAM-based ROMFS with other FLASH partitions (/dev/mtdblock4 or 5)
* 5. JFFS/JFFS2 on MTD (/dev/mtdblock3)
*
* The decisions made in the following are not guaranteed to be
* correct, you may under many circumstance have to resort to
* other mechanism such as specifying the command line in the
* kernel configuration. Any command specified in the kernel
* configuration will take precedence over the default command
* line determined here.
*/
#undef DEFAULT_CONFIG_CMDLINE
#undef DEFAULT_ROOT_CMDLINE
#undef DEFAULT_MTD_ROOT_PARTITION
/* First, let's assume the special case where INITRD is selected
* with the RAMFS block driver. In this case, we'll assume that
* the system will be decompressing the INITRD image into a RAM
* disk.
*/
#if defined(CONFIG_BLK_DEV_RAM) && defined(CONFIG_BLK_DEV_INITRD)
#if 0
# define DEFAULT_ROOT_CMDLINE \
"root=/dev/ram0 initrd=" #CADENUX_FILESYS_START "," #CADENUX_FILESYS_SIZE " rw"
#endif
# define DEFAULT_ROOT_CMDLINE "root=/dev/ram0 rw"
/* No, then which block driver is selected? MTD, or something else? */
#elif defined(CONFIG_MTD_BLOCK) || defined(CONFIG_MTD_BLOCK_RO)
/* We are using the MTD block driver. We cannot know for certain the
* the intended rootfs is (could be on ext2, or -- who knows what).
* But, we'll take a guess. If the ROMFS or EXT2 file system is enabled,
* then we'll assume that ROMFS or EXT2 is our root.
*/
# if defined(CONFIG_ROMFS_FS) || defined(CONFIG_EXT2_FS)
/* ROMFS is readonly; EXT2 is read/write. Otherwise, the following
* logic is the same. NOTE: This logic will fail if both romfs and
* ext2 are selected.
*/
# if !defined(CONFIG_ROMFS_FS)
# define DEFAULT_MTD_RW " rw"
# else
# define DEFAULT_MTD_RW
# endif
/* The ROMFS/EXT2 file system on the MTD block driver is selected.
* Does the file system lie in flash or in SDRAM?
*/
# if defined(CADENUX_FLASH_FS) && (CADENUX_FLASH_FS != 0)
/* We have ROMFS/EXT2 on MTD executing out of FLASH. That should be
* enough information to make a reasonable judgement. We will
* just assume that the user has appropropriately configure MTD
* for FLASH operation.
*/
# define DEFAULT_ROOT_CMDLINE "root=/dev/mtdblock3" DEFAULT_MTD_RW
# define DEFAULT_MTD_ROOT_PARTITION 3
# else /* CADENUX_FLASH_FS */
/* The ROMFS/EXT2 is on MTD, but is executing from SDRAM. We can assume
* that the user has enabled CONFIG_MTD_RAM and CONFIG_MTD_TMD320_SDRAM.
* Now, selecting which MTD device is the SDRAM partition will get
* tricky. What we need to know: Has a standard BSP FLASH partitioin
* been selected in addition to the SDRAM partition? For now,
* let's assume that if any CFI-based flast support has been abled,
* that there must be a corresponding FLASH map also selected. If this
* not the case, the user should disable the CONFIG_MTD_CFI.
*/
# if defined(CONFIG_MTD_CFI)
/* CFI FLASH support is also enabled. One more case -- does the
* FLASH support 4 partitions (bootloader, parameters, kernel, and
* primary file system) or 5 partitions (plus a secondary file system)?
*/
# if defined(CADENUX_FS2_FLASH_SIZE) && (CADENUX_FS2_FLASH_SIZE > 0)
/* There are 5 flash partitions. The SDRAM partition must be mtd5 */
# define DEFAULT_ROOT_CMDLINE "root=/dev/mtdblock5" DEFAULT_MTD_RW
# define DEFAULT_MTD_ROOT_PARTITION 5
# else /* CADENUX_FS2_FLASH_SIZE */
/* There are 4 flash partitions. The SDRAM partition must be mtd4 */
# define DEFAULT_ROOT_CMDLINE "root=/dev/mtdblock4" DEFAULT_MTD_RW
# define DEFAULT_MTD_ROOT_PARTITION 4
# endif /* CADENUX_FS2_FLASH_SIZE */
# else /* CONFIG_MTD_CFI */
/* ROMFS/EXT2 in SDRAM via MTD with no associated flash support. In this
* case, we will assume that there is only one MTD partition, mtd0,
* and that this partition supports SDRAM.
*/
# define DEFAULT_ROOT_CMDLINE "root=/dev/mtdblock0" DEFAULT_MTD_RW
# define DEFAULT_MTD_ROOT_PARTITION 0
# endif /* CONFIIG_MTD_CFI */
# endif /* CADENUX_FLASH_FS */
# elif defined(CONFIG_JFFS_FS) || defined(CONFIG_JFFS2_FS)
/* JFFS or JFFS2 file system is selected (and ROMFS/EXT2 are not).
* Assume that the ROOT FS is JFFS/JFFS2 on mtd3 -- the default
* location for the primary FLASH filesystem in the BSP.
*/
# define DEFAULT_ROOT_CMDLINE "root=/dev/mtdblock3 rw"
# define DEFAULT_MTD_ROOT_PARTITION 3
# else
/* MTD is selected, but neither ROMFS, JJFFS, nor JFFS2 is selected.
* In this case, we won't even hazard a guess.
*/
# warning "No default kernel command line. Specify in kernel config."
# endif /* CONFIG_ROMFS_FS / CONFIG_JFFS_FS / CONFIG_JFFS2_FS */
#else
/* The MTD block driver is not selected. In this case, we won't even
* hazard a guess.
*/
# warning "No default kernel command line. Specify in kernel config."
#endif /* CONFIG_MTD_BLOCK/_RO */
/* This inline function/macro provides a simple way to extract the default
* command. Basically, if the CONFIG_CMDLINE from autoconf.h is
* defined and non-NULL, then it will be used. Otherwise,
* DEFAULT_ROOT_CMDLINE as deterimined above (or a null string) will be used.
*/
#ifdef CONFIG_CMDLINE
# ifdef DEFAULT_ROOT_CMDLINE
/* Both CONFIG_CMDLINE and DEFAULT_ROOT_CMDLINE are defined but
* CONFIG_CMDLINE could be a null string. We will use the
* CONFIG_CMDLINE unless it is a null string (meaning that the
* user has NOT specified anything in particular).
*/
static inline const char *_default_config_cmdline(void)
{
if (sizeof(CONFIG_CMDLINE) < 2) /* Size 1 for NULL terminator */
{
return DEFAULT_ROOT_CMDLINE;
}
else
{
return CONFIG_CMDLINE;
}
}
# define DEFAULT_CONFIG_CMDLINE _default_config_cmdline()
# else /* DEFAULT_ROOT_CMDLINE */
/* Only CONFIG_CMDLINE is defined (and still could be a null string) */
# define DEFAULT_CONFIG_CMDLINE CONFIG_CMDLINE
# endif /* DEFAULT_ROOT_CMDLINE */
#else /* CONFIG_CMDLINE */
# ifdef DEFAULT_ROOT_CMDLINE
/* Only DEFAULT_ROOT_CMDLINE is defined (and is not a null string) */
# define DEFAULT_CONFIG_CMDLINE DEFAULT_ROOT_CMDLINE
# else /* DEFAULT_ROOT_CMDLINE */
/* Neither CONFIG_CMDLINE nor DEFAULT_ROOT_CMDLINE are defined */
# define DEFAULT_CONFIG_CMDLINE ""
# endif /* DEFAULT_ROOT_CMDLINE */
#endif /* CONFIG_CMDLINE */
#endif /* __ASM_CADENUX_CMDLINE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -