/* 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
/* 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 */
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 |
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);
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;
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;
}
}
-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
# 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
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
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)
p)
NETBOOT_PREFIX=$OPTARG
;;
+ c)
+ CONSOLE=$OPTARG
+ ;;
+ v)
+ VERBOSE=$OPTARG
+ ;;
+ h)
+ # system hz
+ HZ=$OPTARG
+ ;;
esac
done
echo "# Set the command to be executed"
echo "uenvcmd=run $BOOT"
+echo "bootargs=console=$CONSOLE rootdevname=c0d0p1 verbose=$VERBOSE hz=$HZ"
+echo
+echo 'bootminix=setenv bootargs \$bootargs board_name=\$board_name ; echo \$bootargs; go 0x80200000 \\\"$bootargs\\\"'
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 "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