From owner-svn-src-all@FreeBSD.ORG Sun Nov 28 01:08:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE3521065672; Sun, 28 Nov 2010 01:08:42 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B19448FC19; Sun, 28 Nov 2010 01:08:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAS18gsD028437; Sun, 28 Nov 2010 01:08:42 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAS18geT028435; Sun, 28 Nov 2010 01:08:42 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011280108.oAS18geT028435@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 28 Nov 2010 01:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215965 - stable/8/sys/mips/atheros X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Nov 2010 01:08:43 -0000 Author: gonzo Date: Sun Nov 28 01:08:42 2010 New Revision: 215965 URL: http://svn.freebsd.org/changeset/base/215965 Log: init_static_kenv is available only in 9-CURRENT, replace its functionality with custom solution Modified: stable/8/sys/mips/atheros/ar71xx_machdep.c Modified: stable/8/sys/mips/atheros/ar71xx_machdep.c ============================================================================== --- stable/8/sys/mips/atheros/ar71xx_machdep.c Sun Nov 28 01:03:06 2010 (r215964) +++ stable/8/sys/mips/atheros/ar71xx_machdep.c Sun Nov 28 01:08:42 2010 (r215965) @@ -66,6 +66,26 @@ uint32_t ar711_base_mac[ETHER_ADDR_LEN]; /* 4KB static data aread to keep a copy of the bootload env until the dynamic kenv is setup */ char boot1_env[4096]; +int boot1_env_pos = 0; + +static void +static_setenv(char *n, char *v) +{ + int nlen, vlen; + + nlen = strlen(n); + vlen = strlen(v); + if (boot1_env_pos + nlen + vlen + 2 > sizeof(boot1_env)) { + printf("*** Environment could not be copied in full\n"); + return; + } + memcpy (&boot1_env[boot1_env_pos], n, nlen); + boot1_env_pos += nlen + 1; + boot1_env[boot1_env_pos-1] = '\0'; + memcpy (&boot1_env[boot1_env_pos], v, vlen); + boot1_env_pos += vlen + 1; + boot1_env[boot1_env_pos-1] = '\0'; +} /* * We get a string in from Redboot with the all the arguments together, @@ -93,9 +113,8 @@ parse_argv(char *str) } else { n = strsep(&v, "="); if (v == NULL) - setenv(n, "1"); - else - setenv(n, v); + v = "1"; + static_setenv(n, v); } } } @@ -200,7 +219,6 @@ platform_start(__register_t a0 __unused, platform_counter_freq = ar71xx_cpu_freq(); mips_timer_init_params(platform_counter_freq, 1); cninit(); - init_static_kenv(boot1_env, sizeof(boot1_env)); printf("CPU platform: %s\n", ar71xx_get_system_type()); printf("CPU Frequency=%d MHz\n", u_ar71xx_cpu_freq / 1000000); @@ -229,11 +247,12 @@ platform_start(__register_t a0 __unused, if (MIPS_IS_VALID_PTR(envp)) { for (i = 0; envp[i]; i+=2) { printf(" %s = %s\n", envp[i], envp[i+1]); - setenv(envp[i], envp[i+1]); + static_setenv(envp[i], envp[i+1]); } } else printf ("envp is invalid\n"); + kern_envp = boot1_env; /* * "ethaddr" is passed via envp on RedBoot platforms