[FE training-materials-updates] buildroot-appdev: add data

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Wed Apr 29 15:46:25 CEST 2015


Repository : git://git.free-electrons.com/training-materials.git

On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=f9a6860e989aa7c6e4603f10864cc73b3d0ebfc9

>---------------------------------------------------------------

commit f9a6860e989aa7c6e4603f10864cc73b3d0ebfc9
Author: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date:   Wed Apr 29 15:46:00 2015 +0200

    buildroot-appdev: add data
    
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>


>---------------------------------------------------------------

f9a6860e989aa7c6e4603f10864cc73b3d0ebfc9
 ...xternal-fix-rebuild-reinstall-for-Linaro-.patch | 56 ++++++++++++++++++++++
 lab-data/buildroot/buildroot-appdev/myapp.c        | 23 +++++++++
 2 files changed, 79 insertions(+)

diff --git a/lab-data/buildroot/buildroot-appdev/0001-toolchain-external-fix-rebuild-reinstall-for-Linaro-.patch b/lab-data/buildroot/buildroot-appdev/0001-toolchain-external-fix-rebuild-reinstall-for-Linaro-.patch
new file mode 100644
index 0000000..69cd0af
--- /dev/null
+++ b/lab-data/buildroot/buildroot-appdev/0001-toolchain-external-fix-rebuild-reinstall-for-Linaro-.patch
@@ -0,0 +1,56 @@
+From befa196be38f0c87ba7cbba9ab70fdde803edad4 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+Date: Wed, 29 Apr 2015 12:25:05 +0200
+Subject: [PATCH] toolchain-external: fix rebuild/reinstall for Linaro
+ toolchains
+
+For Linaro toolchains, a special post install staging hook is used to
+create two symlinks needed for the dynamic loader to find the
+libraries. However, the way the link is created prevents a 'make
+toolchain-external-reinstall' from succeeding, because the symlink
+already exists and points to a directory:
+
+ln -sf . /home/thomas/projets/outputs/training/target/lib/arm-linux-gnueabihf
+ln: '/home/thomas/projets/outputs/training/target/lib/arm-linux-gnueabihf/.': cannot overwrite directory
+
+This commit adjust the hook to pass the '-n' option so that the link
+name is treated as a normal file if it is a symbolic link to a
+directory.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+---
+ toolchain/toolchain-external/toolchain-external.mk | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
+index fd796a0..35bba31 100644
+--- a/toolchain/toolchain-external/toolchain-external.mk
++++ b/toolchain/toolchain-external/toolchain-external.mk
+@@ -239,18 +239,18 @@ endif
+ # {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to
+ # {/usr,}/lib, so we need to create a symbolic link.
+ define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
+-	ln -sf . $(TARGET_DIR)/lib/arm-linux-gnueabihf
+-	ln -sf . $(TARGET_DIR)/usr/lib/arm-linux-gnueabihf
++	ln -snf . $(TARGET_DIR)/lib/arm-linux-gnueabihf
++	ln -snf . $(TARGET_DIR)/usr/lib/arm-linux-gnueabihf
+ endef
+ 
+ define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
+-	ln -sf . $(TARGET_DIR)/lib/armeb-linux-gnueabihf
+-	ln -sf . $(TARGET_DIR)/usr/lib/armeb-linux-gnueabihf
++	ln -snf . $(TARGET_DIR)/lib/armeb-linux-gnueabihf
++	ln -snf . $(TARGET_DIR)/usr/lib/armeb-linux-gnueabihf
+ endef
+ 
+ define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
+-	ln -sf . $(TARGET_DIR)/lib/aarch64-linux-gnu
+-	ln -sf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu
++	ln -snf . $(TARGET_DIR)/lib/aarch64-linux-gnu
++	ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu
+ endef
+ 
+ ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201305),y)
+-- 
+2.1.0
+
diff --git a/lab-data/buildroot/buildroot-appdev/myapp.c b/lab-data/buildroot/buildroot-appdev/myapp.c
new file mode 100644
index 0000000..4a3ef3b
--- /dev/null
+++ b/lab-data/buildroot/buildroot-appdev/myapp.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <libconfig.h>
+
+int main(void)
+{
+        config_t cfg;
+        config_setting_t *setting;
+        const char *str;
+
+        config_init(&cfg);
+
+	if (config_read_file(&cfg, "myapp.cfg") == CONFIG_FALSE)
+        {
+		fprintf(stderr, "Cannot open config file\n");
+                config_destroy(&cfg);
+		exit(1);
+        }
+
+	printf("Config file successfully opened\n");
+
+	return 0;
+}



More information about the training-materials-updates mailing list