[Armadeus-commitlog] armadeus branch, master, updated. armadeus-5.3-515-gb1982bf
Brought to you by:
sszy
|
From: Sébastien S. <ss...@us...> - 2014-12-15 11:07:50
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via b1982bfa150181c6a2a5e5a7f81f9ee39fd3ec21 (commit)
via 6e63462f46da06828bc0ef65fc2b852aea65dace (commit)
from 97e712c7db270df83b3bfbed7380f4539d4c8ad4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b1982bfa150181c6a2a5e5a7f81f9ee39fd3ec21
Author: Sébastien Szymanski <seb...@ar...>
Date: Mon Dec 15 12:11:13 2014 +0100
[LINUX] 3.18: move to 3.18
commit 6e63462f46da06828bc0ef65fc2b852aea65dace
Author: Sébastien Szymanski <seb...@ar...>
Date: Mon Dec 15 11:37:55 2014 +0100
[SOFTWARE] apf6: add uboot recovery script
-----------------------------------------------------------------------
Summary of changes:
buildroot/configs/apf6_defconfig | 2 +-
.../armadeus/apf27/apf27-linux-3.18-rc7.config | 1 -
.../armadeus/apf28/apf28-linux-3.18-rc7.config | 1 -
.../armadeus/apf51/apf51-linux-3.18-rc7.config | 1 -
.../armadeus/apf6/apf6-linux-3.18-rc7.config | 1 -
.../device/armadeus/apf6/apf6-u-boot-2014.07.h | 1 +
.../221-v2-3-3-imx-usb-loader-new-package.patch | 173 ++++++++++++++++++--
patches/buildroot/2013.11/cleanup_buildroot.sh | 1 +
.../221-v2-3-3-imx-usb-loader-new-package.patch | 149 +++++++++++++++++
patches/buildroot/2014.11/cleanup_buildroot.sh | 1 +
patches/linux/3.18-rc7 | 1 -
..._bootstrap_get_uboot_image_on_serial_port.patch | 16 ++
software/uboot_recover/apf6-u-boot.img | Bin 0 -> 372844 bytes
software/uboot_recover/apf6-u-boot.spl | Bin 0 -> 39936 bytes
software/uboot_recover/apf6_recovery.py | 160 ++++++++++++++++++
15 files changed, 490 insertions(+), 18 deletions(-)
delete mode 120000 buildroot/target/device/armadeus/apf27/apf27-linux-3.18-rc7.config
delete mode 120000 buildroot/target/device/armadeus/apf28/apf28-linux-3.18-rc7.config
delete mode 120000 buildroot/target/device/armadeus/apf51/apf51-linux-3.18-rc7.config
delete mode 120000 buildroot/target/device/armadeus/apf6/apf6-linux-3.18-rc7.config
delete mode 120000 patches/linux/3.18-rc7
create mode 100644 patches/u-boot/2014.07/505-apf6-in_bootstrap_get_uboot_image_on_serial_port.patch
create mode 100644 software/uboot_recover/apf6-u-boot.img
create mode 100644 software/uboot_recover/apf6-u-boot.spl
create mode 100644 software/uboot_recover/apf6_recovery.py
diff --git a/buildroot/configs/apf6_defconfig b/buildroot/configs/apf6_defconfig
index a3ba048..4ec3d30 100644
--- a/buildroot/configs/apf6_defconfig
+++ b/buildroot/configs/apf6_defconfig
@@ -23,7 +23,7 @@ BR2_TARGET_ARMADEUS_NR_SDRAM="2"
BR2_TARGET_ARMADEUS_SDRAM_SIZE="512"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.18-rc7"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.18"
BR2_LINUX_KERNEL_PATCH="../patches/linux/$(BR2_LINUX_KERNEL_VERSION)"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_BOARD_PATH)/$(BR2_BOARD_NAME)-linux-$(BR2_LINUX_KERNEL_VERSION).config"
diff --git a/buildroot/target/device/armadeus/apf27/apf27-linux-3.18-rc7.config b/buildroot/target/device/armadeus/apf27/apf27-linux-3.18-rc7.config
deleted file mode 120000
index 305faef..0000000
--- a/buildroot/target/device/armadeus/apf27/apf27-linux-3.18-rc7.config
+++ /dev/null
@@ -1 +0,0 @@
-apf27-linux-3.18.config
\ No newline at end of file
diff --git a/buildroot/target/device/armadeus/apf28/apf28-linux-3.18-rc7.config b/buildroot/target/device/armadeus/apf28/apf28-linux-3.18-rc7.config
deleted file mode 120000
index f82b65f..0000000
--- a/buildroot/target/device/armadeus/apf28/apf28-linux-3.18-rc7.config
+++ /dev/null
@@ -1 +0,0 @@
-apf28-linux-3.18.config
\ No newline at end of file
diff --git a/buildroot/target/device/armadeus/apf51/apf51-linux-3.18-rc7.config b/buildroot/target/device/armadeus/apf51/apf51-linux-3.18-rc7.config
deleted file mode 120000
index 4a20752..0000000
--- a/buildroot/target/device/armadeus/apf51/apf51-linux-3.18-rc7.config
+++ /dev/null
@@ -1 +0,0 @@
-apf51-linux-3.18.config
\ No newline at end of file
diff --git a/buildroot/target/device/armadeus/apf6/apf6-linux-3.18-rc7.config b/buildroot/target/device/armadeus/apf6/apf6-linux-3.18-rc7.config
deleted file mode 120000
index f26aa9b..0000000
--- a/buildroot/target/device/armadeus/apf6/apf6-linux-3.18-rc7.config
+++ /dev/null
@@ -1 +0,0 @@
-apf6-linux-3.18.config
\ No newline at end of file
diff --git a/buildroot/target/device/armadeus/apf6/apf6-u-boot-2014.07.h b/buildroot/target/device/armadeus/apf6/apf6-u-boot-2014.07.h
index d568fcb..1008b64 100644
--- a/buildroot/target/device/armadeus/apf6/apf6-u-boot-2014.07.h
+++ b/buildroot/target/device/armadeus/apf6/apf6-u-boot-2014.07.h
@@ -21,6 +21,7 @@
/* SPL */
#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_YMODEM_SUPPORT
#include "imx6_spl.h"
#include "mx6_common.h"
diff --git a/patches/buildroot/2013.11/221-v2-3-3-imx-usb-loader-new-package.patch b/patches/buildroot/2013.11/221-v2-3-3-imx-usb-loader-new-package.patch
index 1cf5780..ae63fef 100644
--- a/patches/buildroot/2013.11/221-v2-3-3-imx-usb-loader-new-package.patch
+++ b/patches/buildroot/2013.11/221-v2-3-3-imx-usb-loader-new-package.patch
@@ -109,18 +109,6 @@ Index: buildroot/package/imx-usb-loader/Config.in
+ The utility support USB and UART as serial link.
+
+ https://github.com/boundarydevices/imx_usb_loader
-Index: buildroot/package/Config.in
-===================================================================
---- buildroot.orig/package/Config.in
-+++ buildroot/package/Config.in
-@@ -316,6 +316,7 @@ endif
- source "package/hwdata/Config.in"
- source "package/i2c-tools/Config.in"
- source "package/imx-test/Config.in"
-+source "package/imx-usb-loader/Config.in"
- source "package/input-event-daemon/Config.in"
- source "package/input-tools/Config.in"
- source "package/iostat/Config.in"
Index: buildroot/package/imx-usb-loader/imx-usb-loader-0001-fix-ram-size.patch
===================================================================
--- /dev/null
@@ -140,3 +128,164 @@ Index: buildroot/package/imx-usb-loader/imx-usb-loader-0001-fix-ram-size.patch
+ #file:dcd,plug,load nnn,jump [nnn/header/header2]
+ #jump nnn - header is after last downloaded word
+ # entire file is loaded before jump, needs load nnn as well
+Index: buildroot/package/imx-usb-loader/imx-usb-loader-0002-fix-return-codes.patch
+===================================================================
+--- /dev/null
++++ buildroot/package/imx-usb-loader/imx-usb-loader-0002-fix-return-codes.patch
+@@ -0,0 +1,144 @@
++diff --git a/imx_usb.c b/imx_usb.c
++index 41f3369..78d575b 100644
++--- a/imx_usb.c
+++++ b/imx_usb.c
++@@ -404,8 +404,7 @@ int main(int argc, char * const argv[])
++ struct mach_id *mach;
++ libusb_device **devs;
++ libusb_device *dev;
++- int r;
++- int err;
+++ int ret;
++ ssize_t cnt;
++ libusb_device_handle *h = NULL;
++ int config = 0;
++@@ -416,9 +415,9 @@ int main(int argc, char * const argv[])
++ char const *base_path = get_base_path(argv[0]);
++ char const *conf_path = "/etc/imx-loader.d/";
++
++- err = parse_opts(argc, argv, &conf_path, &verify, &cmd_head);
++- if (err < 0)
++- return -1;
+++ ret = parse_opts(argc, argv, &conf_path, &verify, &cmd_head);
+++ if (ret < 0)
+++ return ret;
++
++ // Get list of machines...
++ conf = conf_file_name("imx_usb.conf", base_path, conf_path);
++@@ -429,20 +428,20 @@ int main(int argc, char * const argv[])
++ if (!list)
++ return -1;
++
++- r = libusb_init(NULL);
++- if (r < 0)
+++ ret = libusb_init(NULL);
+++ if (ret != 0)
++ goto out;
++
++- cnt = libusb_get_device_list(NULL, &devs);
++- if (cnt < 0)
+++ ret = libusb_get_device_list(NULL, &devs);
+++ if (ret < 0)
++ goto out;
++
++ // print_devs(devs);
++ dev = find_imx_dev(devs, &mach, list);
++ if (dev) {
++- err = libusb_open(dev, &h);
++- if (err)
++- printf("%s:Could not open device vid=0x%x pid=0x%x err=%d\n", __func__, mach->vid, mach->pid, err);
+++ ret = libusb_open(dev, &h);
+++ if (ret)
+++ printf("%s:Could not open device vid=0x%x pid=0x%x err=%d\n", __func__, mach->vid, mach->pid, ret);
++ }
++ libusb_free_device_list(devs, 1);
++
++@@ -451,12 +450,16 @@ int main(int argc, char * const argv[])
++
++ // Get machine specific configuration file..
++ conf = conf_file_name(mach->file_name, base_path, conf_path);
++- if (conf == NULL)
+++ if (conf == NULL) {
+++ ret = -1;
++ goto out;
+++ }
++
++ p_id = parse_conf(conf);
++- if (!p_id)
+++ if (!p_id) {
+++ ret = -1;
++ goto out;
+++ }
++
++ if (p_id->mode == MODE_HID)
++ p_id->transfer = &transfer_hid;
++@@ -473,14 +476,14 @@ int main(int argc, char * const argv[])
++ if (libusb_kernel_driver_active(h, 0))
++ libusb_detach_kernel_driver(h, 0);
++
++- err = libusb_claim_interface(h, 0);
++- if (err) {
+++ ret = libusb_claim_interface(h, 0);
+++ if (ret) {
++ printf("Claim failed\n");
++ goto out;
++ }
++ printf("Interface 0 claimed\n");
++- err = do_status(p_id);
++- if (err) {
+++ ret = do_status(p_id);
+++ if (ret) {
++ printf("status failed\n");
++ goto out;
++ }
++@@ -493,6 +496,7 @@ int main(int argc, char * const argv[])
++
++ if (curr == NULL) {
++ printf("no job found\n");
+++ ret = -1;
++ goto out;
++ }
++
++@@ -501,17 +505,17 @@ int main(int argc, char * const argv[])
++ perform_mem_work(p_id, curr->mem);
++ // printf("jump_mode %x\n", curr->jump_mode);
++ if (curr->filename[0]) {
++- err = DoIRomDownload(p_id, curr, verify);
+++ ret = DoIRomDownload(p_id, curr, verify);
++ }
++- if (err) {
++- err = do_status(p_id);
+++ if (ret) {
+++ ret = do_status(p_id);
++ break;
++ }
++ if (!curr->next && (!curr->plug || curr != cmd_head))
++ break;
++- err = do_status(p_id);
++- printf("jump_mode %x plug=%i err=%i\n", curr->jump_mode, curr->plug, err);
++- if (err) {
+++ ret = do_status(p_id);
+++ printf("jump_mode %x plug=%i err=%i\n", curr->jump_mode, curr->plug, ret);
+++ if (ret) {
++ int retry;
++ /* Rediscovers device */
++ libusb_release_interface(h, 0);
++@@ -525,8 +529,10 @@ int main(int argc, char * const argv[])
++ if (h)
++ break;
++ }
++- if (!h)
+++ if (!h) {
+++ ret = -1;
++ goto out;
+++ }
++ }
++ if (curr == cmd_head && curr->plug) {
++ curr->plug = 0;
++@@ -541,5 +547,5 @@ out:
++ if (h)
++ libusb_close(h);
++ libusb_exit(NULL);
++- return 0;
+++ return ret;
++ }
+Index: buildroot/package/Config.in
+===================================================================
+--- buildroot.orig/package/Config.in
++++ buildroot/package/Config.in
+@@ -316,6 +316,7 @@ endif
+ source "package/hwdata/Config.in"
+ source "package/i2c-tools/Config.in"
+ source "package/imx-test/Config.in"
++source "package/imx-usb-loader/Config.in"
+ source "package/input-event-daemon/Config.in"
+ source "package/input-tools/Config.in"
+ source "package/iostat/Config.in"
diff --git a/patches/buildroot/2013.11/cleanup_buildroot.sh b/patches/buildroot/2013.11/cleanup_buildroot.sh
index 3a5d008..b5743f7 100755
--- a/patches/buildroot/2013.11/cleanup_buildroot.sh
+++ b/patches/buildroot/2013.11/cleanup_buildroot.sh
@@ -78,6 +78,7 @@ rm -rf buildroot/package/imx-test/imx-test.mk
rm -rf buildroot/package/imx-usb-loader/Config.in
rm -rf buildroot/package/imx-usb-loader/Config.in.host
rm -rf buildroot/package/imx-usb-loader/imx-usb-loader-0001-fix-ram-size.patch
+rm -rf buildroot/package/imx-usb-loader/imx-usb-loader-0002-fix-return-codes.patch
rm -rf buildroot/package/imx-usb-loader/imx-usb-loader.mk
rm -rf buildroot/package/joe/Config.in
rm -rf buildroot/package/joe/joe-3.7-disable-j0-j1-y0-y1-math-functions.patch
diff --git a/patches/buildroot/2014.11/221-v2-3-3-imx-usb-loader-new-package.patch b/patches/buildroot/2014.11/221-v2-3-3-imx-usb-loader-new-package.patch
index 8035d79..3c4f3a7 100644
--- a/patches/buildroot/2014.11/221-v2-3-3-imx-usb-loader-new-package.patch
+++ b/patches/buildroot/2014.11/221-v2-3-3-imx-usb-loader-new-package.patch
@@ -140,3 +140,152 @@ Index: buildroot/package/Config.in
source "package/input-event-daemon/Config.in"
source "package/input-tools/Config.in"
source "package/intel-microcode/Config.in"
+Index: buildroot/package/imx-usb-loader/imx-usb-loader-0002-fix-return-codes.patch
+===================================================================
+--- /dev/null
++++ buildroot/package/imx-usb-loader/imx-usb-loader-0002-fix-return-codes.patch
+@@ -0,0 +1,144 @@
++diff --git a/imx_usb.c b/imx_usb.c
++index 41f3369..78d575b 100644
++--- a/imx_usb.c
+++++ b/imx_usb.c
++@@ -404,8 +404,7 @@ int main(int argc, char * const argv[])
++ struct mach_id *mach;
++ libusb_device **devs;
++ libusb_device *dev;
++- int r;
++- int err;
+++ int ret;
++ ssize_t cnt;
++ libusb_device_handle *h = NULL;
++ int config = 0;
++@@ -416,9 +415,9 @@ int main(int argc, char * const argv[])
++ char const *base_path = get_base_path(argv[0]);
++ char const *conf_path = "/etc/imx-loader.d/";
++
++- err = parse_opts(argc, argv, &conf_path, &verify, &cmd_head);
++- if (err < 0)
++- return -1;
+++ ret = parse_opts(argc, argv, &conf_path, &verify, &cmd_head);
+++ if (ret < 0)
+++ return ret;
++
++ // Get list of machines...
++ conf = conf_file_name("imx_usb.conf", base_path, conf_path);
++@@ -429,20 +428,20 @@ int main(int argc, char * const argv[])
++ if (!list)
++ return -1;
++
++- r = libusb_init(NULL);
++- if (r < 0)
+++ ret = libusb_init(NULL);
+++ if (ret != 0)
++ goto out;
++
++- cnt = libusb_get_device_list(NULL, &devs);
++- if (cnt < 0)
+++ ret = libusb_get_device_list(NULL, &devs);
+++ if (ret < 0)
++ goto out;
++
++ // print_devs(devs);
++ dev = find_imx_dev(devs, &mach, list);
++ if (dev) {
++- err = libusb_open(dev, &h);
++- if (err)
++- printf("%s:Could not open device vid=0x%x pid=0x%x err=%d\n", __func__, mach->vid, mach->pid, err);
+++ ret = libusb_open(dev, &h);
+++ if (ret)
+++ printf("%s:Could not open device vid=0x%x pid=0x%x err=%d\n", __func__, mach->vid, mach->pid, ret);
++ }
++ libusb_free_device_list(devs, 1);
++
++@@ -451,12 +450,16 @@ int main(int argc, char * const argv[])
++
++ // Get machine specific configuration file..
++ conf = conf_file_name(mach->file_name, base_path, conf_path);
++- if (conf == NULL)
+++ if (conf == NULL) {
+++ ret = -1;
++ goto out;
+++ }
++
++ p_id = parse_conf(conf);
++- if (!p_id)
+++ if (!p_id) {
+++ ret = -1;
++ goto out;
+++ }
++
++ if (p_id->mode == MODE_HID)
++ p_id->transfer = &transfer_hid;
++@@ -473,14 +476,14 @@ int main(int argc, char * const argv[])
++ if (libusb_kernel_driver_active(h, 0))
++ libusb_detach_kernel_driver(h, 0);
++
++- err = libusb_claim_interface(h, 0);
++- if (err) {
+++ ret = libusb_claim_interface(h, 0);
+++ if (ret) {
++ printf("Claim failed\n");
++ goto out;
++ }
++ printf("Interface 0 claimed\n");
++- err = do_status(p_id);
++- if (err) {
+++ ret = do_status(p_id);
+++ if (ret) {
++ printf("status failed\n");
++ goto out;
++ }
++@@ -493,6 +496,7 @@ int main(int argc, char * const argv[])
++
++ if (curr == NULL) {
++ printf("no job found\n");
+++ ret = -1;
++ goto out;
++ }
++
++@@ -501,17 +505,17 @@ int main(int argc, char * const argv[])
++ perform_mem_work(p_id, curr->mem);
++ // printf("jump_mode %x\n", curr->jump_mode);
++ if (curr->filename[0]) {
++- err = DoIRomDownload(p_id, curr, verify);
+++ ret = DoIRomDownload(p_id, curr, verify);
++ }
++- if (err) {
++- err = do_status(p_id);
+++ if (ret) {
+++ ret = do_status(p_id);
++ break;
++ }
++ if (!curr->next && (!curr->plug || curr != cmd_head))
++ break;
++- err = do_status(p_id);
++- printf("jump_mode %x plug=%i err=%i\n", curr->jump_mode, curr->plug, err);
++- if (err) {
+++ ret = do_status(p_id);
+++ printf("jump_mode %x plug=%i err=%i\n", curr->jump_mode, curr->plug, ret);
+++ if (ret) {
++ int retry;
++ /* Rediscovers device */
++ libusb_release_interface(h, 0);
++@@ -525,8 +529,10 @@ int main(int argc, char * const argv[])
++ if (h)
++ break;
++ }
++- if (!h)
+++ if (!h) {
+++ ret = -1;
++ goto out;
+++ }
++ }
++ if (curr == cmd_head && curr->plug) {
++ curr->plug = 0;
++@@ -541,5 +547,5 @@ out:
++ if (h)
++ libusb_close(h);
++ libusb_exit(NULL);
++- return 0;
+++ return ret;
++ }
diff --git a/patches/buildroot/2014.11/cleanup_buildroot.sh b/patches/buildroot/2014.11/cleanup_buildroot.sh
index 3d1e485..4867272 100755
--- a/patches/buildroot/2014.11/cleanup_buildroot.sh
+++ b/patches/buildroot/2014.11/cleanup_buildroot.sh
@@ -55,6 +55,7 @@ rm -rf buildroot/package/imx-test/imx-test.mk
rm -rf buildroot/package/imx-usb-loader/Config.in
rm -rf buildroot/package/imx-usb-loader/Config.in.host
rm -rf buildroot/package/imx-usb-loader/imx-usb-loader-0001-fix-ram-size.patch
+rm -rf buildroot/package/imx-usb-loader/imx-usb-loader-0002-fix-return-codes.patch
rm -rf buildroot/package/imx-usb-loader/imx-usb-loader.mk
rm -rf buildroot/package/marble/Config.in
rm -rf buildroot/package/marble/marble.mk
diff --git a/patches/linux/3.18-rc7 b/patches/linux/3.18-rc7
deleted file mode 120000
index 55b698c..0000000
--- a/patches/linux/3.18-rc7
+++ /dev/null
@@ -1 +0,0 @@
-3.18
\ No newline at end of file
diff --git a/patches/u-boot/2014.07/505-apf6-in_bootstrap_get_uboot_image_on_serial_port.patch b/patches/u-boot/2014.07/505-apf6-in_bootstrap_get_uboot_image_on_serial_port.patch
new file mode 100644
index 0000000..ca4e6ce
--- /dev/null
+++ b/patches/u-boot/2014.07/505-apf6-in_bootstrap_get_uboot_image_on_serial_port.patch
@@ -0,0 +1,16 @@
+Index: uboot-2014.07/arch/arm/imx-common/spl.c
+===================================================================
+--- uboot-2014.07.orig/arch/arm/imx-common/spl.c
++++ uboot-2014.07/arch/arm/imx-common/spl.c
+@@ -19,6 +19,11 @@ u32 spl_boot_device(void)
+ {
+ struct src *psrc = (struct src *)SRC_BASE_ADDR;
+ unsigned reg = readl(&psrc->sbmr1);
++ unsigned reg2 = readl(&psrc->sbmr2);
++
++ /* In bootstrap get U-Boot on the serial port */
++ if (((reg2 & 0x3000000) >> 24) == 0x1)
++ return BOOT_DEVICE_UART;
+
+ /* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
+ switch ((reg & 0x000000FF) >> 4) {
diff --git a/software/uboot_recover/apf6-u-boot.img b/software/uboot_recover/apf6-u-boot.img
new file mode 100644
index 0000000..a1fd604
Binary files /dev/null and b/software/uboot_recover/apf6-u-boot.img differ
diff --git a/software/uboot_recover/apf6-u-boot.spl b/software/uboot_recover/apf6-u-boot.spl
new file mode 100644
index 0000000..4a72baf
Binary files /dev/null and b/software/uboot_recover/apf6-u-boot.spl differ
diff --git a/software/uboot_recover/apf6_recovery.py b/software/uboot_recover/apf6_recovery.py
new file mode 100644
index 0000000..606e82f
--- /dev/null
+++ b/software/uboot_recover/apf6_recovery.py
@@ -0,0 +1,160 @@
+#
+# APF6 bootloader recovering tool
+#
+# Copyright (C) 2014 Armadeus Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# authors: seb...@ar...
+#
+#
+
+import os
+import re
+import serial
+import subprocess
+import sys
+import time
+
+class UBoot:
+
+ def __init__(self, serial):
+ self.serial = serial
+
+ def __getOutput(self, pattern=r'BIOS>'):
+ response = ""
+ while not re.search(pattern, response):
+ char = self.serial.read(1)
+ if char == '':
+ raise IOError
+ response = response + char
+ print response
+ return response
+
+ def startYModem(self):
+ self.serial.write("loady\n")
+ return self.__getOutput(r'C')
+
+ def resetEnv(self, save=True):
+ if save == False:
+ self.serial.write("env default -f -a\n")
+ else:
+ self.serial.write("run flash_reset_env\n")
+ return self.__getOutput()
+
+ def waitForPrompt(self):
+ self.serial.write("\n")
+ ret = self.__getOutput()
+ self.serial.flushInput()
+ return ret
+
+ def flash_spl(self):
+ self.serial.flushInput()
+ self.serial.write("run flash_uboot_spl\n")
+ return self.__getOutput()
+
+ def flash_img(self):
+ self.serial.flushInput()
+ self.serial.write("run flash_uboot_img\n")
+ return self.__getOutput()
+
+ def reset(self):
+ self.serial.flushInput()
+ self.serial.write("reset\n")
+
+
+if __name__ == "__main__":
+
+ BR_HOST_PATH = "../../buildroot/output/host"
+ BR_IMAGES_PATH = "../../buildroot/output/images"
+ USB_DOWNLOAD_APP = BR_HOST_PATH + "/usr/bin/imx_usb"
+ SERIAL_DOWNLOAD_APP = "sb"
+ U_BOOT_SPL = "apf6-u-boot.spl"
+ U_BOOT_IMG = "apf6-u-boot.img"
+ SPEED = 115200
+
+ print "\n--- APF6 Bootstrap Tool ---\n"
+ print "Procedure to follow:"
+ print "1] Power off your board, close all serial terminal sessions, remove all USB cables"
+ print "2] Take jumper off BOOT0 pin and put it on BOOT1 pin."
+ print "3] Power on your board"
+ print "4] Connect a USB cable from your PC to the APF6Dev OTG miniUSB connector"
+ print "5] Connect a USB cable from your PC to the APF6Dev console miniUSB connector"
+ print "6] Be sure to have built the APF6 BSP: make apf6_defconfig; make"
+ print "7] Have launched this script as root (sudo)"
+ print "8] Have sb installed (On Ubuntu: sudo apt-get install lrzsz)\n"
+ port = raw_input('--- Enter serial port number or device name to use for console (/dev/ttyUSB0 under Linux (default) or COMx under Window$): ')
+ if port == '':
+ port = '/dev/ttyUSB0'
+
+ if not os.path.exists(USB_DOWNLOAD_APP):
+ print "Error: imx_usb is not present. Please compile Armadeus BSP first: make apf6_defconfig; make"
+ sys.exit(1)
+
+ if not os.path.exists(U_BOOT_SPL) or not os.path.exists(U_BOOT_IMG):
+ print "Error: U-Boot binaries don't exist !"
+ sys.exit(1)
+
+ try:
+ subprocess.call([SERIAL_DOWNLOAD_APP, "--version"])
+ except OSError:
+ print "Error: " + SERIAL_DOWNLOAD_APP + " not found. Did you install lrzsz package on your system ?"
+ sys.exit(1)
+
+ try:
+ subprocess.check_call([USB_DOWNLOAD_APP, "-c", BR_HOST_PATH + "/usr/share/imx_usb_loader/", U_BOOT_SPL])
+ subprocess.check_call(SERIAL_DOWNLOAD_APP + " -k " + U_BOOT_IMG + " > " + port + " < " + port, shell=True)
+ except subprocess.CalledProcessError:
+ print "Error: Loading U-Boot binaries failed !"
+ sys.exit(1)
+
+ try:
+ print "Opening serial port %s..." % port
+ ser = serial.Serial(port, SPEED, timeout=5)
+ ser.flush()
+ uboot = UBoot(ser)
+ time.sleep(1)
+
+ uboot.waitForPrompt()
+
+ uboot.resetEnv(False)
+
+ uboot.startYModem()
+ subprocess.check_call(SERIAL_DOWNLOAD_APP + " -k " + U_BOOT_SPL + " > " + port + " < " + port, shell=True)
+ uboot.waitForPrompt()
+ uboot.flash_spl()
+
+ uboot.startYModem()
+ subprocess.check_call(SERIAL_DOWNLOAD_APP + " -k " + U_BOOT_IMG + " > " + port + " < " + port, shell=True)
+ uboot.waitForPrompt()
+ uboot.flash_img()
+
+ eraseAll = raw_input('\n--- Would you like to erase the environment variables ? y/N: ')
+ if eraseAll == 'y':
+ uboot.resetEnv()
+ except serial.SerialException:
+ print "Error: Opening serial port %s failed !" % port
+ sys.exit(1)
+ except IOError:
+ print "IOError on serial port %s" % port
+ ser.close()
+ sys.exit(1)
+ except subprocess.CalledProcessError:
+ print "Error: Loading U-Boot binaries on serial port failed !"
+ ser.close()
+ sys.exit(1)
+ else:
+ print "\n--- U-Boot successfully recovered !"
+ print "--- Now you can remove miniUSB OTG cable and put the jumper back on BOOT0 pin. Your board is running..."
hooks/post-receive
--
armadeus
|