diff options
author | John Klug <john.klug@multitech.com> | 2017-04-11 18:01:18 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-04-24 11:43:23 -0500 |
commit | 9d46d64dcdac88c934bb3e64c3732639572e3e8d (patch) | |
tree | 60e7590b19ade318298edb285cc1438392b4ef59 /recipes-bsp/multitech | |
parent | e6299b72eb6ba36cd599da3257ae4619aec4cf38 (diff) | |
download | meta-multitech-9d46d64dcdac88c934bb3e64c3732639572e3e8d.tar.gz meta-multitech-9d46d64dcdac88c934bb3e64c3732639572e3e8d.tar.bz2 meta-multitech-9d46d64dcdac88c934bb3e64c3732639572e3e8d.zip |
Start of deriving the environment from the u-boot package.
Diffstat (limited to 'recipes-bsp/multitech')
3 files changed, 53 insertions, 27 deletions
diff --git a/recipes-bsp/multitech/u-boot-linux-utils/uboot_configure.patch b/recipes-bsp/multitech/u-boot-linux-utils/uboot_configure.patch index e7a7fe0..d8f5223 100644 --- a/recipes-bsp/multitech/u-boot-linux-utils/uboot_configure.patch +++ b/recipes-bsp/multitech/u-boot-linux-utils/uboot_configure.patch @@ -1,11 +1,11 @@ -commit 0de7b48ba5bfca360d7c1840e9415f8a8177eede +commit 591d0dab81465e5e0df5b5ba6b70e2ec74f25bbc Author: John Klug <john.klug@multitech.com> -Date: Fri Apr 7 16:33:13 2017 -0500 +Date: Tue Apr 11 17:35:38 2017 -0500 - Defaults for u-boot-linux-utils + debug turned on + Allow a DEFAULT ENV file, and get the MTD_SIZE from CONFIG_ENV_SIZE in uboot diff --git a/configure.in b/configure.in -index 8fdc9ef..85998a9 100644 +index 8fdc9ef..8f6a1db 100644 --- a/configure.in +++ b/configure.in @@ -15,12 +15,15 @@ required header missing])) @@ -16,13 +16,15 @@ index 8fdc9ef..85998a9 100644 +AC_DEFINE([DEBUG], 1, [set to 1 to enable debug]) AC_DEFINE([MTD_ENV1], "/dev/mtd3", [set to the first u-boot env mtd]) AC_DEFINE([MTD_ENV2], "/dev/mtd4", [set to the second (redundant) u-boot env mtd]) - AC_DEFINE([MTD_SIZE], 0x20000, [size of u-boot env mtd]) +-AC_DEFINE([MTD_SIZE], 0x20000, [size of u-boot env mtd]) -AC_DEFINE([DEFAULT_ENV], ["bootargs=mem=64M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2\0" "bootcmd=nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}\0" "bootdelay=3\0" "baudrate=115200\0" "ethaddr=00:D0:A0:02:0D:E1\0" "ipaddr=192.168.2.1\0" "serverip=192.168.2.2\0" "netmask=255.255.255.0\0" "hostname=AT91SAM9G20\0" "loadaddr=0x21400000\0" "kernel_addr=0x000A0000\0" "\0"] +-, [default env if corrupt]) + -+AC_DEFINE([DEFAULT_ENV], ["baudrate=115200\0" "bootargs=mem=256M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2\0" "bootcmd=nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}\0" "bootdelay=0\0" "ethact=macb0\0" "hostname=AT91SAM9G25\0" "ipaddr=192.168.2.1\0" "kernel_addr=0x200000\0" "loadaddr=0x22000000\0" "serverip=192.168.2.2\0" "netmask=255.255.255.0\0" "stderr=serial\0" "stdin=serial\0" "stdout=serial\0"] - , [default env if corrupt]) - +AC_DEFINE([MAC_PATH],["/sys/devices/platform/mts-io/mac-eth"], [MAC_PATH for defining ethaddr= in boot environment]) + ++AC_DEFINE_UNQUOTED([DEFAULT_ENV], ++ [$(cat ../DEFAULT_ENV.cfg | tr -d '\n')], ++ [default environment values]) + AC_OUTPUT([Makefile src/Makefile]) diff --git a/recipes-bsp/multitech/u-boot-linux-utils/uboot_mac.patch b/recipes-bsp/multitech/u-boot-linux-utils/uboot_mac.patch index 5b92f35..77f28a2 100644 --- a/recipes-bsp/multitech/u-boot-linux-utils/uboot_mac.patch +++ b/recipes-bsp/multitech/u-boot-linux-utils/uboot_mac.patch @@ -1,27 +1,50 @@ -commit de3ea4470a6da4c01bfff9377649324747c1e3c9 +commit afa8fc0d0b3d8ccde464ab207724491c7b732c3d Author: John Klug <john.klug@multitech.com> -Date: Mon Apr 10 12:16:08 2017 -0500 +Date: Tue Apr 11 17:58:15 2017 -0500 - Add MAC address in default environment and add clearenv functionality. + Derive MTD size from CONFIG_ENV_SIZE diff --git a/src/u_boot.c b/src/u_boot.c -index e240475..7eea5e9 100644 +index e240475..8c4fced 100644 --- a/src/u_boot.c +++ b/src/u_boot.c -@@ -36,6 +36,12 @@ +@@ -33,8 +33,25 @@ + #include <fcntl.h> + #include <zlib.h> +- ++#include <u-boot/config.h> #include "u_boot.h" - ++static char *env_strings(void) ++{ ++ char *p; ++ int count; ++ static const char *bd = "bootdelay="; ++ count = strlen(bd); ++ count += snprintf(NULL,0,"%d",CONFIG_BOOTDELAY); ++ p = malloc(count); ++ snprintf(p,count,"%d",CONFIG_BOOTDELAY); ++ return p; ++} ++ + +#define DUMMY_MAC "00:00:00:00:00:00" +#define MACNAME "ethaddr" + +#define EMPTY_CRC 0xf9137807 -+ + static int tokcmp(const char *cmd, const char *pattern) { int len = strlen(cmd); - if (len > strlen(pattern)) { -@@ -64,6 +70,8 @@ static int write_uboot_env(const char *device, struct environment *env) +@@ -46,7 +63,7 @@ static int tokcmp(const char *cmd, const char *pattern) { + } + + #define ENV_HEADER_SIZE (sizeof(uint32_t) + sizeof(uint8_t)) +-#define ENV_DATA_SIZE (MTD_SIZE - ENV_HEADER_SIZE) ++#define ENV_DATA_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE) + + struct environment { + uint32_t crc; +@@ -64,6 +81,8 @@ static int write_uboot_env(const char *device, struct environment *env) error("mtd_erase_all %s failed", device); return -1; } @@ -30,7 +53,7 @@ index e240475..7eea5e9 100644 fd = open(device, O_WRONLY); if (fd < 0) { -@@ -166,7 +174,7 @@ static int cmd_setenv(struct environment *env, int argc, char **argv) +@@ -166,7 +185,7 @@ static int cmd_setenv(struct environment *env, int argc, char **argv) var = env->data; while (*var) { if (!strncmp(var, name, name_len) && var[name_len] == '=') { @@ -39,7 +62,7 @@ index e240475..7eea5e9 100644 cp = next_var(var); while (*cp) { -@@ -213,7 +221,7 @@ static int cmd_setenv(struct environment *env, int argc, char **argv) +@@ -213,7 +232,7 @@ static int cmd_setenv(struct environment *env, int argc, char **argv) } env->crc = crc32(0, (uint8_t *) env->data, sizeof(env->data)); @@ -48,7 +71,7 @@ index e240475..7eea5e9 100644 env->flags = 0; tmp = write_uboot_env(MTD_ENV1, env); -@@ -238,7 +246,7 @@ static void print_version(const char *name) { +@@ -238,7 +257,7 @@ static void print_version(const char *name) { } static void usage(FILE *out) { @@ -57,7 +80,7 @@ index e240475..7eea5e9 100644 fprintf(out, "\n"); } -@@ -252,6 +260,7 @@ int main(int argc, char *argv[]) { +@@ -252,6 +271,7 @@ int main(int argc, char *argv[]) { struct environment *env2; uint32_t crc1_ok; uint32_t crc2_ok; @@ -65,7 +88,7 @@ index e240475..7eea5e9 100644 if (argc <= 1) { usage(stderr); -@@ -301,12 +310,18 @@ int main(int argc, char *argv[]) { +@@ -301,12 +321,18 @@ int main(int argc, char *argv[]) { error("read_uboot_env failed"); return 1; } @@ -87,7 +110,7 @@ index e240475..7eea5e9 100644 crc1_ok = 0; } -@@ -315,20 +330,64 @@ int main(int argc, char *argv[]) { +@@ -315,20 +341,64 @@ int main(int argc, char *argv[]) { error("read_uboot_env failed"); return 1; } @@ -157,7 +180,7 @@ index e240475..7eea5e9 100644 } else if (crc1_ok && !crc2_ok) { env = env1; } else if (!crc1_ok && crc2_ok) { -@@ -353,6 +412,9 @@ int main(int argc, char *argv[]) { +@@ -353,6 +423,9 @@ int main(int argc, char *argv[]) { err = cmd_printenv(env, argc, argv); } else if (!tokcmp(cmd, "setenv")) { err = cmd_setenv(env, argc, argv); diff --git a/recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb b/recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb index 0d5f2dc..3d69336 100644 --- a/recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb +++ b/recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb @@ -6,17 +6,18 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" PR = "r3" -DEPENDS = "mtd-utils" +DEPENDS = "mtd-utils u-boot" # tag 0.0.1 SRCREV = "9c154405c2d01648f41c6a72bcc96f9865c4f07c" SRC_URI = "git://git.multitech.net/u-boot-linux-utils.git;protocol=git \ file://uboot_mac.patch \ - file://uboot_configure.patch" + file://uboot_configure.patch \ + file://DEFAULT_ENV.cfg" S = "${WORKDIR}/git" - +CFLAGS += "-idirafter ${STAGING_DIR_TARGET}/usr/include/u-boot -save-temps -MD" inherit autotools PARALLEL_MAKE = "" |