X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=arch%2Fmips%2Flib%2Fbootm.c;h=e0722d20d1e876122939117163071e4ecd525b26;hb=f4e7e2d12164c3235c3f5e19a68a503623029d35;hp=27e0b1be849ce1b82b6f6c57feaa241fa1bfbf00;hpb=6c154552b0540f73cc2a3692f53b405f0f2bdf0e;p=oweals%2Fu-boot.git diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 27e0b1be84..e0722d20d1 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -6,10 +6,7 @@ */ #include -#include #include -#include -#include #include DECLARE_GLOBAL_DATA_PTR; @@ -17,6 +14,12 @@ DECLARE_GLOBAL_DATA_PTR; #define LINUX_MAX_ENVS 256 #define LINUX_MAX_ARGS 256 +#if defined(CONFIG_MALTA) +#define mips_boot_malta 1 +#else +#define mips_boot_malta 0 +#endif + static int linux_argc; static char **linux_argv; static char *linux_argp; @@ -46,6 +49,20 @@ void arch_lmb_reserve(struct lmb *lmb) lmb_reserve(lmb, sp, CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp); } +static int boot_setup_linux(bootm_headers_t *images) +{ + int ret; + ulong rd_len; + + rd_len = images->rd_end - images->rd_start; + ret = boot_ramdisk_high(&images->lmb, images->rd_start, + rd_len, &images->initrd_start, &images->initrd_end); + if (ret) + return ret; + + return 0; +} + static void linux_cmdline_init(void) { linux_argc = 1; @@ -133,7 +150,12 @@ static void linux_env_set(const char *env_name, const char *env_val) strcpy(linux_env_p, env_name); linux_env_p += strlen(env_name); - *linux_env_p++ = '='; + if (mips_boot_malta) { + linux_env_p++; + linux_env[++linux_env_idx] = linux_env_p; + } else { + *linux_env_p++ = '='; + } strcpy(linux_env_p, env_val); linux_env_p += strlen(env_val); @@ -184,26 +206,37 @@ static void boot_prep_linux(bootm_headers_t *images) cp = getenv("eth1addr"); if (cp) linux_env_set("eth1addr", cp); + + if (mips_boot_malta) { + sprintf(env_buf, "%un8r", gd->baudrate); + linux_env_set("modetty0", env_buf); + } } static void boot_jump_linux(bootm_headers_t *images) { typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); kernel_entry_t kernel = (kernel_entry_t) images->ep; + ulong linux_extra = 0; debug("## Transferring control to Linux (at address %p) ...\n", kernel); bootstage_mark(BOOTSTAGE_ID_RUN_OS); + if (mips_boot_malta) + linux_extra = gd->ram_size; + /* we assume that the kernel is in place */ printf("\nStarting kernel ...\n\n"); - kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, 0); + kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, linux_extra); } int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) { + int ret; + /* No need for those on MIPS */ if (flag & BOOTM_STATE_OS_BD_T) return -1; @@ -223,6 +256,10 @@ int do_bootm_linux(int flag, int argc, char * const argv[], return 0; } + ret = boot_setup_linux(images); + if (ret) + return ret; + boot_cmdline_linux(images); boot_prep_linux(images); boot_jump_linux(images);