arm:refactor replace cmdline.txt by bootargs passed to the kernel.
Put the boot arguments in uEnv.txt and not in cmdline.txt to allow a more dynamic configuration of the system. We now also pass the u-boot board_name parameter to the kernel.
This commit is contained in:
parent
91a2fe4aba
commit
8c02dd7b2a
4 changed files with 51 additions and 56 deletions
|
@ -30,7 +30,7 @@ struct kmessages kmessages;
|
|||
/* pg_utils.c uses this; in this phase, there is a 1:1 mapping. */
|
||||
phys_bytes vir2phys(void *addr) { return (phys_bytes) addr; }
|
||||
|
||||
static void setup_mbi(multiboot_info_t *mbi);
|
||||
static void setup_mbi(multiboot_info_t *mbi, char *bootargs);
|
||||
|
||||
/* String length used for mb_itoa */
|
||||
#define ITOA_BUFFER_SIZE 20
|
||||
|
@ -103,7 +103,6 @@ int overlaps(multiboot_module_t *mod, int n, int cmp_mod)
|
|||
/* XXX: hard-coded stuff for modules */
|
||||
#define MB_MODS_NR 12
|
||||
#define MB_MODS_BASE 0x82000000
|
||||
#define MB_PARAM_MOD 0x88000000
|
||||
#define MB_MODS_ALIGN 0x00800000 /* 8 MB */
|
||||
#define MB_MMAP_START 0x80000000
|
||||
#define MB_MMAP_SIZE 0x10000000 /* 256 MB */
|
||||
|
@ -111,7 +110,7 @@ int overlaps(multiboot_module_t *mod, int n, int cmp_mod)
|
|||
multiboot_module_t mb_modlist[MB_MODS_NR];
|
||||
multiboot_memory_map_t mb_memmap;
|
||||
|
||||
void setup_mbi(multiboot_info_t *mbi)
|
||||
void setup_mbi(multiboot_info_t *mbi, char *bootargs)
|
||||
{
|
||||
memset(mbi, 0, sizeof(*mbi));
|
||||
mbi->flags = MULTIBOOT_INFO_MODS | MULTIBOOT_INFO_MEM_MAP |
|
||||
|
@ -127,8 +126,8 @@ void setup_mbi(multiboot_info_t *mbi)
|
|||
mb_modlist[i].cmdline = 0;
|
||||
}
|
||||
|
||||
/* Final 'module' is actually a string holding the boot cmdline */
|
||||
mbi->cmdline = MB_PARAM_MOD;
|
||||
/* morph the bootargs into multiboot */
|
||||
mbi->cmdline = (u32_t) bootargs;
|
||||
|
||||
mbi->mmap_addr =(u32_t)&mb_memmap;
|
||||
mbi->mmap_length = sizeof(mb_memmap);
|
||||
|
@ -139,7 +138,7 @@ void setup_mbi(multiboot_info_t *mbi)
|
|||
mb_memmap.type = MULTIBOOT_MEMORY_AVAILABLE;
|
||||
}
|
||||
|
||||
void get_parameters(u32_t ebx, kinfo_t *cbi)
|
||||
void get_parameters(kinfo_t *cbi, char *bootargs)
|
||||
{
|
||||
multiboot_memory_map_t *mmap;
|
||||
multiboot_info_t *mbi = &cbi->mbi;
|
||||
|
@ -153,8 +152,7 @@ void get_parameters(u32_t ebx, kinfo_t *cbi)
|
|||
static char cmdline[BUF];
|
||||
|
||||
/* get our own copy of the multiboot info struct and module list */
|
||||
//memcpy((void *) mbi, (void *) ebx, sizeof(*mbi));
|
||||
setup_mbi(mbi);
|
||||
setup_mbi(mbi, bootargs);
|
||||
|
||||
/* Set various bits of info for the higher-level kernel. */
|
||||
cbi->mem_high_phys = 0;
|
||||
|
@ -277,16 +275,33 @@ void get_parameters(u32_t ebx, kinfo_t *cbi)
|
|||
}
|
||||
}
|
||||
|
||||
kinfo_t *pre_init(u32_t magic, u32_t ebx)
|
||||
/*
|
||||
* During low level init many things are not supposed to work
|
||||
* serial being one of them. We therefore can't rely on the
|
||||
* serial to debug. POORMANS_FAILURE_NOTIFICATION can be used
|
||||
* before we setup our own vector table and will result in calling
|
||||
* the bootloader's debugging methods that will hopefully show some
|
||||
* information like the currnet PC at on the serial.
|
||||
*/
|
||||
#define POORMANS_FAILURE_NOTIFICATION asm volatile("svc #00\n")
|
||||
|
||||
kinfo_t *pre_init(u32_t argc, char **argv)
|
||||
{
|
||||
/* Clear BSS */
|
||||
memset(&_edata, 0, (u32_t)&_end - (u32_t)&_edata);
|
||||
|
||||
/* we get called in a c like fashion where the first arg
|
||||
* is the program name (load address) and the rest are
|
||||
* arguments. by convention the second argument is the
|
||||
* command line */
|
||||
if (argc != 2){
|
||||
POORMANS_FAILURE_NOTIFICATION;
|
||||
}
|
||||
omap3_ser_init();
|
||||
/* Get our own copy boot params pointed to by ebx.
|
||||
* Here we find out whether we should do serial output.
|
||||
*/
|
||||
get_parameters(ebx, &kinfo);
|
||||
get_parameters(&kinfo, argv[1]);
|
||||
|
||||
/* Make and load a pagetable that will map the kernel
|
||||
* to where it should be; but first a 1:1 mapping so
|
||||
|
|
|
@ -153,27 +153,20 @@ mkfs.vfat ${IMG_DIR}/fat.img
|
|||
# Create a uEnv.txt file
|
||||
# -n default to network boot
|
||||
# -p add a prefix to the network booted files (e.g. xm/"
|
||||
./releasetools/gen_uEnv.txt.sh > ${IMG_DIR}/uEnv.txt
|
||||
|
||||
#
|
||||
# Generate the MINIX command line
|
||||
#
|
||||
# options:
|
||||
# -c set console e.g. tty02 or tty00
|
||||
# -v set verbosity e.g. 0 to 3
|
||||
./releasetools/gen_cmdline.txt.sh -c ${CONSOLE} > ${IMG_DIR}/cmdline.txt
|
||||
#./releasetools/gen_uEnv.txt.sh -c ${CONSOLE} -n -p bb/ > ${IMG_DIR}/uEnv.txt
|
||||
./releasetools/gen_uEnv.txt.sh -c ${CONSOLE} > ${IMG_DIR}/uEnv.txt
|
||||
|
||||
echo "Copying configuration kernel and boot modules"
|
||||
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$MLO ::MLO
|
||||
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$UBOOT ::u-boot.img
|
||||
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/uEnv.txt ::uEnv.txt
|
||||
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/cmdline.txt ::cmdline.txt
|
||||
|
||||
#
|
||||
# For tftp booting
|
||||
#
|
||||
cp ${IMG_DIR}/uEnv.txt ${OBJ}/
|
||||
cp ${IMG_DIR}/cmdline.txt ${OBJ}/
|
||||
|
||||
#
|
||||
# Do some last processing of the kernel and servers before also putting
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/sh
|
||||
#default for the beagleboard-xM
|
||||
CONSOLE=tty02
|
||||
#verbosity
|
||||
VERBOSE=3
|
||||
HZ=1000
|
||||
while getopts "c:v:?" c
|
||||
do
|
||||
case "$c" in
|
||||
\?)
|
||||
echo "Usage: $0 [-c consoletty] [-v level]" >&2
|
||||
exit 1
|
||||
;;
|
||||
c)
|
||||
# genrate netbooting uEnv.txt
|
||||
CONSOLE=$OPTARG
|
||||
;;
|
||||
v)
|
||||
# genrate netbooting uEnv.txt
|
||||
VERBOSE=$OPTARG
|
||||
;;
|
||||
h)
|
||||
# system hz
|
||||
HZ=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
echo console=$CONSOLE rootdevname=c0d0p1 verbose=$VERBOSE hz=$HZ
|
|
@ -13,8 +13,7 @@ list="0x80200000 kernel.bin
|
|||
0x86000000 mfs.elf
|
||||
0x86800000 vm.elf
|
||||
0x87000000 pfs.elf
|
||||
0x87800000 init.elf
|
||||
0x88000000 cmdline.txt"
|
||||
0x87800000 init.elf"
|
||||
|
||||
#
|
||||
# PREFIX for loading file over tftp to allow hosting multiple
|
||||
|
@ -23,11 +22,17 @@ NETBOOT_PREFIX=""
|
|||
NETBOOT="no"
|
||||
BOOT="mmcbootcmd"
|
||||
|
||||
while getopts "p:n?" c
|
||||
#default for the beagleboard-xM
|
||||
CONSOLE=tty02
|
||||
#verbosity
|
||||
VERBOSE=3
|
||||
HZ=1000
|
||||
|
||||
while getopts "c:v:h:p:n?" c
|
||||
do
|
||||
case "$c" in
|
||||
\?)
|
||||
echo "Usage: $0 [-p netboot_prefix] -n" >&2
|
||||
echo "Usage: $0 [-p netboot_prefix] -n [-c consoletty] [-v level] " >&2
|
||||
exit 1
|
||||
;;
|
||||
n)
|
||||
|
@ -38,6 +43,16 @@ do
|
|||
p)
|
||||
NETBOOT_PREFIX=$OPTARG
|
||||
;;
|
||||
c)
|
||||
CONSOLE=$OPTARG
|
||||
;;
|
||||
v)
|
||||
VERBOSE=$OPTARG
|
||||
;;
|
||||
h)
|
||||
# system hz
|
||||
HZ=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -61,14 +76,16 @@ fill_cmd() {
|
|||
|
||||
echo "# Set the command to be executed"
|
||||
echo "uenvcmd=run $BOOT"
|
||||
echo "bootargs=console=$CONSOLE rootdevname=c0d0p1 verbose=$VERBOSE hz=$HZ"
|
||||
echo
|
||||
echo "# With cmdline/bootargs in cmdline.txt"
|
||||
echo "mmcbootcmd=echo starting from MMC ; mmc part 0; mw.b 0x88000000 0 16384 $(fill_cmd "fatload mmc 0:1" "") ; dcache off ; icache off ; go 0x80200000"
|
||||
echo 'bootminix=setenv bootargs \$bootargs board_name=\$board_name ; echo \$bootargs; go 0x80200000 \\\"$bootargs\\\"'
|
||||
echo
|
||||
echo "mmcbootcmd=echo starting from MMC ; mmc part 0; $(fill_cmd "fatload mmc 0:1" "") ; dcache off ; icache off ; run bootminix"
|
||||
echo
|
||||
echo "# Netbooting."
|
||||
echo "serverip=192.168.12.10"
|
||||
echo "ipaddr=192.168.12.62"
|
||||
echo "usbnet_devaddr=e8:03:9a:24:f9:10"
|
||||
echo "usbethaddr=e8:03:9a:24:f9:11"
|
||||
echo "netbootcmd=echo starting from TFTP; mw.b 0x88000000 0 16384 $(fill_cmd "tftp" "$NETBOOT_PREFIX") ; dcache off ; icache off ; go 0x80200000"
|
||||
echo "netbootcmd=echo starting from TFTP; $(fill_cmd "tftp" "$NETBOOT_PREFIX") ; dcache off ; icache off ; run bootminix"
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue