Fix Compilation for host cmake tools.

and fix compilation of x86_64 target.
This commit is contained in:
jbnadal
2017-03-20 16:02:15 +01:00
parent da13f66e29
commit 5fc3e0c439
13 changed files with 246 additions and 37 deletions

View File

@@ -498,9 +498,12 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
world: target-post-image
rebuild: $(foreach pkg,$(PACKAGES),$(pkg)-clean-for-rebuild) world
.PHONY: all world toolchain dirs clean distclean source outputmakefile \
legal-info legal-info-prepare legal-info-clean printvars help \
list-defconfigs target-finalize target-post-image source-check
list-defconfigs target-finalize target-post-image source-check \
rebuild
################################################################################
#

View File

@@ -110,7 +110,7 @@ define $(2)_CONFIGURE_CMDS
cd $$($$(PKG)_BUILDDIR) && \
rm -f CMakeCache.txt && \
PATH=$$(BR_PATH) \
$$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-DCMAKE_INSTALL_SO_NO_EXE=0 \
-DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \

View File

@@ -23,3 +23,9 @@ endmenu # Third parties
menu "Domo"
endmenu # Domo
menu "Host tools"
source "$BR2_EXTERNAL/package/virtfs-xattr/Config.in"
endmenu # Host tools

View File

@@ -0,0 +1,6 @@
config BR2_PACKAGE_HOST_VIRTFS_XATTR
bool "host virtfs-xattr"
default n
help
Utililty used to alter metadata of file in the target
directory, for sharing with 9p fsdev in qemu.

View File

@@ -0,0 +1,20 @@
################################################################################
#
# VIRTFS_XATTR
#
################################################################################
HOST_VIRTFS_XATTR_VERSION:= 1.0.0
HOST_VIRTFS_XATTR_SITE = $(TOPDIR)/../../src/tools/virtfs-xattr/builders/cmake
HOST_VIRTFS_XATTR_SITE_METHOD = local
HOST_VIRTFS_XATTR_DEPENDENCIES = host-attr
HOST_VIRTFS_XATTR_CONF = SRC_DIR=$(TOPDIR)/../..
HOST_VIRTFS_XATTR_CONF_ENV = $(HOST_VIRTFS_XATTR_CONF)
HOST_VIRTFS_XATTR_MAKE_ENV = $(HOST_VIRTFS_XATTR_CONF)
HOST_VIRTFS_XATTR_CONF_OPTS += -DMODULE_PATH=$(TOPDIR)/../../bsp/cmake-modules -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
$(eval $(host-cmake-package))

View File

@@ -12,9 +12,10 @@ buildroot.menuconfig: buildroot.config
fi
buildroot: buildroot.config
$(MAKE) LD_LIBRARY_PATH=$(BR_STAGING)/cross/opt/ext-toolchain/lib/ $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/
$(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ $(BR_TARGET)
buildroot.shell: buildroot.config
$(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ dirs outputmakefile
$(eval export $(BR_ENV))
cd $(BR_STAGING)/buildroot/; $(BR_ENV) bash

3
bsp/include/dev.mk Normal file
View File

@@ -0,0 +1,3 @@
dev.gdbscript:
BR_STAGING=$(BR_STAGING) BR_PROJECT=$(BR_PROJECT) $(BR_BOARD)/../../../scripts/gen_gdb_script.sh

13
bsp/scripts/gen_gdb_script.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
echo "===> Generate GDB script"
echo " AW_STAGING=${AW_STAGING}"
echo " AW_PROJECT=${AW_PROJECT}"
echo "add-auto-load-safe-path ${AW_STAGING}" > ${AW_STAGING}/gdb.script
echo "set solib-absolute-prefix ${AW_STAGING}/buildroot/staging" >> ${AW_STAGING}/gdb.script
echo "dir ${AW_PROJECT}/../../../.." >> ${AW_STAGING}/gdb.script
echo "The gdb script : ${AW_STAGING}/gdb.script"

View File

@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Buildroot 2016.08.1-gb9e31fc-dirty Configuration
# Buildroot 2016.08.1-gda13f66-dirty Configuration
#
BR2_HAVE_DOT_CONFIG=y
BR2_HOST_GCC_AT_LEAST_4_6=y
@@ -811,12 +811,6 @@ BR2_PACKAGE_GAUCHE_ARCH_SUPPORTS=y
# BR2_PACKAGE_JAMVM is not set
# BR2_PACKAGE_JIMTCL is not set
# BR2_PACKAGE_LUA is not set
# BR2_PACKAGE_LUA_5_1 is not set
# BR2_PACKAGE_LUA_5_2 is not set
# BR2_PACKAGE_LUA_5_3 is not set
# BR2_PACKAGE_LUA_EDITING_NONE is not set
# BR2_PACKAGE_LUA_READLINE is not set
# BR2_PACKAGE_LUA_LINENOISE is not set
BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS=y
# BR2_PACKAGE_LUAJIT is not set
# BR2_PACKAGE_MICROPYTHON is not set
@@ -2258,3 +2252,8 @@ BR2_PACKAGE_UCI=y
#
# Domo
#
#
# Host tools
#
BR2_PACKAGE_HOST_VIRTFS_XATTR=y

View File

@@ -12,33 +12,10 @@ trap error ERR
echo "==> POSTBUILD:"
echo "AW_STAGING: ${AW_STAGING}"
echo "AW_PROJECT: ${AW_PROJECT}"
echo "BR_STAGING: ${BR_STAGING}"
echo "BR_PROJECT: ${BR_PROJECT}"
ROOT_DIR=${AW_STAGING}/buildroot/target
# USERNAME=$(id -n -u)
# GROUPNAME=$(id -n -g)
# USERID=$(id -u)
# GROUPID=$(id -g)
#
# if [ ! -f "${ROOT_DIR}/usr/share/acl.d/all_yes.json" ]; then
# mkdir -p "${ROOT_DIR}/usr/share/acl.d"
# cat > "${ROOT_DIR}/usr/share/acl.d/all_yes.json" << EOF
# {
# "user": "${USERNAME}",
# "access": { "*" : { "methods": [" "] } },
# "publish": ["*"],
# "subscribe": ["*"]
# }
# EOF
# fi
#
# if [ -z "$(grep ${USERNAME} ${ROOT_DIR}/etc/passwd)" ]; then
# echo "Adding user '${USERNAME}' to target"
# echo "${USERNAME}:x:${USERID}:${GROUPID}::/:/bin/sh" >> ${ROOT_DIR}/etc/passwd
# echo "${GROUPNAME}:x:${GROUPID}:${USERNAME}" >> ${ROOT_DIR}/etc/group
# fi
ROOT_DIR=${BR_STAGING}/buildroot/target
echo " => Setting-up the target rootfs to be used by qemu"
PATH="${PATH}:${AW_STAGING}/cross/usr/bin" "${AW_PROJECT}/map-all-xattr.sh" "${ROOT_DIR}"
PATH="${PATH}:${BR_STAGING}/cross/usr/bin" "${BR_PROJECT}/map-all-xattr.sh" "${ROOT_DIR}"

View File

@@ -0,0 +1,24 @@
cmake_minimum_required (VERSION 3.0)
project (virtfs-xattr)
set (CMAKE_MODULE_PATH "${MODULE_PATH}")
include (br)
include_directories (../../)
file (
GLOB_RECURSE
source_files
$ENV{SRC_DIR}/src/tools/virtfs-xattr/virtfs-xattr.c
)
add_executable (virtfs-xattr ${source_files})
target_link_libraries (virtfs-xattr
LINK_PUBLIC
attr)
install (TARGETS virtfs-xattr DESTINATION bin)

View File

@@ -0,0 +1,157 @@
/*!
* (C) Copyright 2017 Awox SA. All rights reserved.
* This work contains confidential trade secrets of Awox.
* Use, examination, copying, transfer and disclosure to others
* are prohibited, except with the express written agreement of Awox.
*
* virtfs-xattr.c
* \author Awox
* \date Jan 25, 2017
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <attr/xattr.h>
#include <errno.h>
#include <endian.h>
#include <fcntl.h>
static void usage(const char* progName)
{
fprintf(stderr, "%s <file>\tdisplay attributes\n", progName);
fprintf(stderr,
"%s { -u <uid> | -g <gid> | -l } <file>\tset/change attribute value (uid, gid, is-symlink)\n",
progName);
fprintf(stderr, "%s -l <file>\ttag file as a symlink\n", progName);
fprintf(stderr, "%s -c <file>\tclear all attributes\n", progName);
}
int main(int argc, char** argv)
{
int rc;
uid_t uid;
int set_uid;
gid_t gid;
int set_gid;
mode_t mode;
int tag_symlink;
int clear;
int display;
const char* filePath;
set_uid = 0;
set_gid = 0;
tag_symlink = 0;
clear = 0;
display = 0;
while ((rc = getopt(argc, argv, "u:g:lch")) != -1)
{
switch (rc)
{
case 'u':
uid = (uid_t) htole32(atoi(optarg));
set_uid = 1;
break;
case 'g':
gid = (gid_t) htole32(atoi(optarg));
set_gid = 1;
break;
case 'l':
tag_symlink = 1;
break;
case 'c':
clear = 1;
break;
case '?':
usage(argv[0]);
return EXIT_FAILURE;
break;
case 'h':
usage(argv[0]);
return EXIT_SUCCESS;
}
}
if (optind >= argc)
{
usage(argv[0]);
return EXIT_FAILURE;
}
filePath = argv[optind];
if (clear && (set_uid || set_gid || tag_symlink))
{
usage(argv[0]);
return EXIT_FAILURE;
}
if (!clear && !set_uid && !set_gid && !tag_symlink)
{
display = 1;
}
if (set_uid && lsetxattr(filePath, "user.virtfs.uid", &uid, sizeof(uid), 0))
{
perror("setxattr(user.virtfs.uid)");
return EXIT_FAILURE;
}
if (set_gid && lsetxattr(filePath, "user.virtfs.gid", &gid, sizeof(gid), 0))
{
perror("setxattr(user.virtfs.gid)");
return EXIT_FAILURE;
}
if (tag_symlink)
{
mode = S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO;
mode = htole32(mode);
if (lsetxattr(filePath, "user.virtfs.mode", &mode, sizeof(mode), 0))
{
perror("setxattr(user.virtfs.mode)");
return EXIT_FAILURE;
}
}
if (display)
{
if (lgetxattr(filePath, "user.virtfs.uid", &uid, sizeof(uid)) == sizeof(uid))
{
printf("uid: %d\n", (int) le32toh(uid));
}
if (lgetxattr(filePath, "user.virtfs.gid", &gid, sizeof(gid)) == sizeof(gid))
{
printf("gid: %d\n", (int) le32toh(gid));
}
if (lgetxattr(filePath, "user.virtfs.mode", &mode, sizeof(mode)) == sizeof(mode))
{
mode = le32toh(mode);
if (mode & S_IFLNK)
printf("symlink\n");
}
}
if (clear)
{
if (lremovexattr(filePath, "user.virtfs.uid") && errno != ENOATTR)
{
perror("removexattr(user.virtfs.uid)");
return EXIT_FAILURE;
}
if (lremovexattr(filePath, "user.virtfs.gid") && errno != ENOATTR)
{
perror("removexattr(user.virtfs.gid)");
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}