Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sikmir committed Sep 29, 2010
1 parent 776d2b6 commit d3e8608
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/cmds/runelf/runelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

#define COMMAND_NAME "runelf"
#define COMMAND_DESC_MSG "execute elf file"
#define HELP_MSG \
"Usage: runelf [-h] [-a addr]"
#define HELP_MSG "Usage: runelf [-h] [-a addr]"

#define THREAD_STACK_SIZE 0x10000

Expand All @@ -26,7 +25,7 @@ static const char *man_page =

DECLARE_SHELL_COMMAND(COMMAND_NAME, exec, COMMAND_DESC_MSG, HELP_MSG, man_page);

static void run(void){
static void run(void) {
elf_execute((FILE *)file);
}

Expand All @@ -52,10 +51,9 @@ static int exec(int argsc, char **argsv) {
TRACE("runelf: invalid value \"%s\".\nthe number expected.\n", optarg);
return -1;
case 'h':
show_man_page();
show_help();
return 0;
case -1:
show_help();
return 0;
default:
TRACE("runelf: invalid arguments.\n", optarg);
Expand Down
2 changes: 2 additions & 0 deletions src/cmds/runelf/runelf_help.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
"\t-h - show this help.\n"
"EXAMPLES\n"
"\trunelf -a 0x46000000\n"
"SEE ALSO\n"
"\treadelf\n"
"AUTHORS\n"
"\tAvdyukhin Dmitry\n"
1 change: 1 addition & 0 deletions src/fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $_PACKAGE := embox.fs
$_MODS += ramfs rootfs file

$_SRCS-ramfs += ramfs.c
$_SRCS-ramfs += ramfs_cpio.S
$_SRCS-rootfs += rootfs.c
$_SRCS-file += file.c

Expand Down
5 changes: 5 additions & 0 deletions src/fs/ramfs_cpio.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#ifdef CONFIG_RAMFS_CPIO
.section .ramfs
.incbin CONFIG_RAMFS_CPIO
#endif
63 changes: 63 additions & 0 deletions src/include/lib/cpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* @file
* @brief Extended cpio format from POSIX.1.
*
* @date 27.09.10
* @author Nikolay Korotky
*/
#ifndef _CPIO_H
#define _CPIO_H

/* A cpio archive consists of a sequence of files.
Each file has a 76 byte header,
a variable length, NUL terminated filename,
and variable length file data.
A header for a filename "TRAILER!!!" indicates the end of the archive. */

/* New ASCII Format */
struct cpio_newc_header {
char c_magic[6]; /* must be "070701" */
char c_ino[8];
char c_mode[8];
char c_uid[8];
char c_gid[8];
char c_nlink[8];
char c_mtime[8];
char c_filesize[8]; /* must be 0 for FIFOs and directories */
char c_devmajor[8];
char c_devminor[8];
char c_rdevmajor[8];
char c_rdevminor[8];
char c_namesize[8];
char c_check[8];
};

/* Value for the field `c_magic'. */
#define MAGIC "070701"

/* Values for c_mode, OR'd together: */

#define C_IRUSR 000400
#define C_IWUSR 000200
#define C_IXUSR 000100
#define C_IRGRP 000040
#define C_IWGRP 000020
#define C_IXGRP 000010
#define C_IROTH 000004
#define C_IWOTH 000002
#define C_IXOTH 000001

#define C_ISUID 004000
#define C_ISGID 002000
#define C_ISVTX 001000

#define C_ISBLK 060000
#define C_ISCHR 020000
#define C_ISDIR 040000
#define C_ISFIFO 010000
#define C_ISSOCK 0140000
#define C_ISLNK 0120000
#define C_ISCTG 0110000
#define C_ISREG 0100000

#endif /* _CPIO_H */

0 comments on commit d3e8608

Please sign in to comment.