rtems_task Init(
  rtems_task_argument ignored
)
{
  /*
   *  Display a herald with some hints on usage
   */
  printf(
    "\n"
    "\n"
    "*** Shell Configured with Multi IO Commands ***\n"
    "Multi IO Configuration: %s\n"
    "Type \"help multiio\" for more information\n"
    "\n",
    rtems_multiio_get_name()
  );
  rtems_shell_init(
    "SHLL",                          /* task_name */
    RTEMS_MINIMUM_STACK_SIZE * 4,    /* task_stacksize */
    100,                             /* task_priority */
    "/dev/console",                  /* devname */
    false,                           /* forever */
    true,                            /* wait */
    NULL                             /* login */
  );
}
Exemple #2
0
rtems_task Init(rtems_task_argument argument)
{
	rtems_status_code sc;

	sc = rtems_shell_init(
		"SHLL",
		RTEMS_MINIMUM_STACK_SIZE * 8,
		1, /* We want it to work */
		"/dev/console",
		false,
		false,
		NULL
	);
	if(sc != RTEMS_SUCCESSFUL)
		printf("Unable to start shell (error code %d)\n", sc);

	/* FIXME:
	 * alarm() should work anyway in gethostbyname().(for TIMEOUT in libcurl)
	 * in the meantime we have a workaround,
	 * make sure the gethostbyname() finished in 15 seconds
	 */
	_res.retry = 2;

	/* FIXME: can this be moved into the initialization table? */
	memcard_register();

	/*start_memcard();*/
	mkdir("/ssd", 0777);
	mount("/dev/flash5", "/ssd", "yaffs", RTEMS_FILESYSTEM_READ_WRITE, "");
	/*
	 * Older versions of RTEMS-YAFFS created the file system with the
	 * (persistent) root inode set to 0666. RTEMS didn't check permissions
	 * at that time but does now, causing most operations to fail (EACCES)
	 * on file systems created before the transition.
	 *
	 * The "chmod" below transparently updates the permission of /ssd files
	 * systems.
	 */
	chmod("/ssd", YAFFS_ROOT_MODE);
	
	init_version();
	load_usb_firmware();
	init_videoinreconf();

	sysconfig_load();
	rtems_bsdnet_initialize_network();
	rtems_initialize_ftpd();
	rtems_telnetd_initialize();
	curl_global_init(CURL_GLOBAL_ALL);

	sc = rtems_task_create(rtems_build_name('G', 'U', 'I', ' '), 9, 1024*1024,
		RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
		0, &gui_task_id);
	assert(sc == RTEMS_SUCCESSFUL);
	sc = rtems_task_start(gui_task_id, gui_task, 0);
	assert(sc == RTEMS_SUCCESSFUL);

	rtems_task_delete(RTEMS_SELF);
}
Exemple #3
0
/**
 * Start the RTEMS Shell.
 */
void shell_start ()
{
  rtems_status_code sc;
  printf ("Starting shell....\n\n");
  sc = rtems_shell_init ("fstst", 60 * 1024, 150, "/dev/console", 0, 1, NULL);
  if (sc != RTEMS_SUCCESSFUL)
    printf ("error: starting shell: %s (%d)\n", rtems_status_text (sc), sc);
}
Exemple #4
0
static void
test_main(void)
{
	int rv;
	rtems_status_code sc;

	rv = rtems_initialize_ftpd();
	assert(rv == 0);

	sc = rtems_shell_init("SHLL", 16 * 1024, 1, CONSOLE_DEVICE_NAME,
	    false, true, NULL);
	assert(sc == RTEMS_SUCCESSFUL);

	exit(0);
}
Exemple #5
0
static void fileio_start_shell(void)
{
  int sc;

  sc = mkdir("/scripts", 0777);
  if ( sc ) {
    printf( "mkdir /scripts: %s:\n", strerror(errno) );
  }

  sc = mkdir("/etc", 0777);
  if ( sc ) {
    printf( "mkdir /etc: %s:\n", strerror(errno) );
  }

  fprintf(
    stderr, 
    "Creating /etc/passwd and group with three useable accounts\n"
    "root/pwd , test/pwd, rtems/NO PASSWORD"
  );

  writeFile(
    "/etc/passwd",
    0644,
    "root:7QR4o148UPtb.:0:0:root::/:/bin/sh\n"
    "rtems:*:1:1:RTEMS Application::/:/bin/sh\n"
    "test:8Yy.AaxynxbLI:2:2:test account::/:/bin/sh\n"
    "tty:!:3:3:tty owner::/:/bin/false\n"
  );
  writeFile(
    "/etc/group",
    0644,
    "root:x:0:root\n"
    "rtems:x:1:rtems\n"
    "test:x:2:test\n"
    "tty:x:3:tty\n"
  );

  rtems_shell_init(
    "SHLL",                          /* task_name */
    RTEMS_MINIMUM_STACK_SIZE * 4,    /* task_stacksize */
    100,                             /* task_priority */
    "/dev/console",                  /* devname */
    false,                           /* forever */
    true,                            /* wait */
    rtems_shell_login_check          /* login */
  );
}
Exemple #6
0
static int init_ide()
{
  int rc = 0;

  char buf[512];

#ifndef COMBO_RTEMS
  rtems_status_code sc = RTEMS_SUCCESSFUL;
  size_t abort_index = 0;

#ifndef FAT_BENCH
  rtems_rfs_format_config rfs_config =
  {
     .block_size = 0,        /* The size of a block. */
     .group_blocks = 0,      /* The number of blocks in a group. */
     .group_inodes = 0,      /* The number of inodes in a group. */
     .inode_overhead = 0,    /* The percentage overhead allocated to inodes. */
     .max_name_length = 0,   /* The maximum length of a name. */
     .initialise_inodes = 0, /* Initialise the inode tables to all ones. */
     .verbose = 1            /* Is the format verbose.  */
  };
#endif
#endif

#ifdef COMBO_RTEMS
  printk(".. COMBO RTEMS ..\n");
#else
  printk(".. VANILLA RTEMS ..\n");
#endif

#ifdef FAT_BENCH
  printk(".. FAT benchmarking. Preparing/formatting partition\n");
#ifdef FORMAT_ENABLE
  rc = msdos_format("/dev/hda", NULL);
  if (rc != 0)
     printk(".. msdos_format(/dev/hda) failed: %s\n", strerror(errno));
  else
     printk(".. msdos_format is OK\n");
#endif
#else
  printk(".. RFS benchmarking. Preparing/formatting disk\n");
#if 0
  {
      int i;

#define PARTITION_COUNT 1

      rtems_bdpart_partition created_partitions[PARTITION_COUNT];

      static const rtems_bdpart_format format = {
         .mbr = {
            .type = RTEMS_BDPART_FORMAT_MBR,
            .disk_id = 0xdeadbeef,
            .dos_compatibility = false
         }
      };

      static const unsigned distribution[PARTITION_COUNT] = {
            1
      };

      memset(&created_partitions[0], 0, sizeof(created_partitions));

      for (i = 0; i < PARTITION_COUNT; ++i) {
          rtems_bdpart_to_partition_type(RTEMS_BDPART_MBR_EMPTY,
                                         created_partitions[i].type);
      }

      sc = rtems_bdpart_create("/dev/hda", &format,
                               &created_partitions[0],
                               &distribution[0],
                               PARTITION_COUNT);
      if (sc != 0)
          printk(".. rtems_bdpart_create(/dev/hda) failed: %s\n", strerror(errno));
      else
          printk(".. rtems_bdpart_create() is OK\n");

      sc = rtems_bdpart_write("/dev/hda", &format,
                              &created_partitions[0],
                              PARTITION_COUNT);
      if (sc != 0)
          printk(".. rtems_bdpart_write(/dev/hda) failed: %s\n", strerror(errno));
      else
          printk(".. rtems_bdpart_write() is OK\n");
  }
#endif

#ifdef FORMAT_ENABLE
  rc = rtems_rfs_format("/dev/hda", &rfs_config);
  if (rc != 0)
     printk(".. rfs_format(/dev/hda) failed: %s\n", strerror(errno));
  else
     printk(".. rfs_format is OK\n");
#endif

#endif /* FAT_BENCH */

  /* Create a mount point folder */
  rc = mkdir("/mnt", 0777);
  if(rc == -1)
  {
    printk("mkdir failed: %s\n", strerror(errno));
    exit(3);
  }

#ifdef COMBO_RTEMS
  /* Some checking needed for combo version only */
  rc = open(DEVNAME, O_RDWR);
  if(rc == -1)
  {
    printk("dev open failed: %s\n", strerror(errno));
    exit(1);
  }
  if(read(rc, buf, 512) != 512)
  {
    printk("dev read failed: %s\n", strerror(errno));
    exit(2);
  }
  close(rc);
  /* end of checking */

#if 0
  rc = rtems_ide_part_table_initialize(DEVNAME);
  if(rc != RTEMS_SUCCESSFUL)
  {
    printk("ide_part_table failed: %i\n", rc);
    exit(4);
  }
#endif

  rc = rtems_fsmount(&fs_table, 1, NULL);
  if(rc != 1)
  {
    printk("rtems_fsmount failed: %i\n", rc);
    exit(5);
  }
#else

#if 0
  sc = rtems_bdpart_register_from_disk("/dev/hda");
  if (sc != RTEMS_SUCCESSFUL) {
    printk("read partition table failed: %s\n", rtems_status_text(sc));
    exit(4);
  }
  else
  {
    printk(".. partition table of \"/dev/hda\" is OK\n");
  }
#endif

  rc = rtems_fsmount(fstab, sizeof(fstab) / sizeof(fstab [0]), &abort_index);
  if (rc != 0) {
    printk("mount failed: %s\n", strerror(errno));
    exit(5);
  }
  else
  {
    printk(".. %s() returns OK\n", __FUNCTION__);
  }

  if (abort_index)
      printf("mount aborted at %zu\n", abort_index);
#endif

  printf(".. CompactFlash logical disk has been mounted\n");
  return 0;
}

static int iozone_func(int argc, char** argv)
{
  return main_iozone(argc, argv);
}

static rtems_shell_cmd_t iozone_cmd = {
  "iozone",         /* name */
  "execute iozone", /* help text */
  "misc",           /* topic */
  iozone_func,      /* function */
  NULL,             /* alias */
  NULL              /* next */
};

/* initialize shell, network and telnet */
static void init_telnetd()
{
  rtems_status_code rc;
  rtems_termios_initialize();
  rtems_initialize_network();
  rtems_telnetd_initialize();
#ifdef COMBO_RTEMS
  rc = rtems_shell_init("SHll", 32000, 100, "/dev/tty1", 1, 0);
#else
  rc = rtems_shell_init("SHll", 32000, 100, "/dev/tty1", 1, 0, NULL);
#endif
  if(rc != RTEMS_SUCCESSFUL)
    printk("init shell on console failed\n");
}