48 #define cmdline_phys __use_data16 ( cmdline_phys ) 55 #define initrd_phys __use_data16 ( initrd_phys ) 62 #define initrd_len __use_data16 ( initrd_len ) 71 DBGC (
image,
"RUNTIME freeing command line\n" );
79 .type = &script_image_type,
83 #define colour &cmdline_image 100 strip_end =
strchr ( strip,
' ' );
103 DBGC (
colour,
"RUNTIME stripping \"%s\"\n", strip );
104 strcpy ( strip, ( strip_end + 1 ) );
106 DBGC (
colour,
"RUNTIME stripping \"%s\"\n", strip );
124 DBGC (
colour,
"RUNTIME found no command line\n" );
133 DBGC (
colour,
"RUNTIME could not allocate %zd bytes for " 134 "command line\n",
len );
136 goto err_alloc_cmdline_copy;
140 DBGC (
colour,
"RUNTIME found command line \"%s\" at %08x\n",
158 DBGC (
colour,
"RUNTIME could not register command " 160 goto err_register_image;
171 err_alloc_cmdline_copy:
189 DBGC (
colour,
"RUNTIME found empty initrd\n" );
192 DBGC (
colour,
"RUNTIME found initrd at [%x,%x)\n",
199 DBGC (
colour,
"RUNTIME could not create initrd image\n" );
#define STARTUP_NORMAL
Normal startup.
struct arbelprm_rc_send_wqe rc
userptr_t data
Raw file image.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
static int cmdline_init(void)
Initialise command line.
struct startup_fn runtime_startup_fn __startup_fn(STARTUP_NORMAL)
Command line and initrd initialisation function.
struct image * image_memory(const char *name, userptr_t data, size_t len)
Create registered image from block of memory.
userptr_t phys_to_user(unsigned long phys_addr)
Convert physical address to user pointer.
static int initrd_init(void)
Initialise initrd.
static void runtime_init(void)
Initialise command line and initrd.
A startup/shutdown function.
char * strstr(const char *haystack, const char *needle)
Find substring.
#define ENOMEM
Not enough space.
uint32_t userptr_t
A pointer to a user buffer.
#define container_of(ptr, type, field)
Get containing structure.
char * strcpy(char *dest, const char *src)
Copy string.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int register_image(struct image *image)
Register executable image.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
size_t len
Length of raw file image.
char * strchr(const char *src, int character)
Find character within a string.
int isspace(int character)
Check to see if character is a space.
size_t strlen(const char *src)
Get length of string.
static void image_put(struct image *image)
Decrement reference count on an image.
void * malloc(size_t size)
Allocate memory.
static struct image cmdline_image
Embedded script representing the command line.
static void cmdline_strip(char *cmdline, const char *cruft)
Strip unwanted cruft from command line.
size_t strlen_user(userptr_t userptr, off_t offset)
Find length of NUL-terminated string in user buffer.
userptr_t virt_to_user(volatile const void *addr)
Convert virtual address to user pointer.
#define REF_INIT(free_fn)
Initialise a static reference counter.
static void cmdline_image_free(struct refcnt *refcnt)
Free command line image.
static char * cmdline_copy
Internal copy of the command line.
uint32_t __bss16(cmdline_phys)
Command line physical address.
#define colour
Colour for debug messages.
struct refcnt refcnt
Reference count.