From patchwork Sat May 27 13:38:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 767712 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wZkk86qJRz9s7h for ; Sat, 27 May 2017 23:44:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="tLFW5WMK"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id A0680C21C36; Sat, 27 May 2017 13:43:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9003BC21CA6; Sat, 27 May 2017 13:39:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 046B0C21C5B; Sat, 27 May 2017 13:39:00 +0000 (UTC) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by lists.denx.de (Postfix) with ESMTPS id 8C13AC21C68 for ; Sat, 27 May 2017 13:38:54 +0000 (UTC) Received: by mail-oi0-f41.google.com with SMTP id l18so40502877oig.2 for ; Sat, 27 May 2017 06:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NuloqGpgvkqNmCNTtPcGuw2W6BCeE8/Zdkx8LAEoulg=; b=tLFW5WMK7AGI9wmYuXqjfnRF7a/dmFDeE1oeb/8Zsy/NxicrqhBMUeHkwwQB8Oe8ok kju0HeUxCn0k5apI3AcAlcFqJME/tZU10ogimxsc7PtklNw+kj3Gb842vrey6VrIJG6x c90FWxpeR4E3I+g6RHVAiSd1MelNCNgYukym35spxfD4g3UrQALESX5UcAvRPx0dVoeO OK+yxT7v5u7SU91QxyEi5b+al2K4CoB5WSjz18Z3bEipQOHoc4Me+bm18h5LxvY3mnQF Bxkxqcij/KwdxwrzdJjycsETlLzYN1j7K7fJZ3bAbnDNFjcN1tCg/5g2DCJtq3T4e89a j3yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=NuloqGpgvkqNmCNTtPcGuw2W6BCeE8/Zdkx8LAEoulg=; b=pukEOv61rYp8TCrnGmGahsdcMgtVIRsYVwYAaUNTwv24dmKLp9TDVocSuHM+ShOUHG dsuxKf/Vk2lPkzXpsjc02JOjdP9jQa5M6LkFStfHDjxHfGn00xHIgaL4CNQG0Qil3WgU 07Naxm8brWog/bcS5QtqCgQVPyURviVVAII2TMnyv7k0KUMIA8ulwGjf1wX/UOLdtvZn LVRv9y3YOWaqwpPqsy/SgkZPjhaN5njXsDrDlKxE7OsnYmh9UgBYQf2T083T/HBE3DpM PII2CeGNm3/lxlCxKZF9DRR43z4ofy1er+NYKi8PzZN1De27D4zOrkeGaQDlodD/KyT/ dpCQ== X-Gm-Message-State: AODbwcBbtoetcLi4kLpVgEJMQrZzdAB8vEyX/grz0G7K+BkH9NPS0tEY mUb2OnsM9PLI/J6z45kTNg== X-Received: by 10.157.48.138 with SMTP id s10mr3409786otc.109.1495892333306; Sat, 27 May 2017 06:38:53 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.197.131]) by smtp.gmail.com with ESMTPSA id h34sm1744358otb.39.2017.05.27.06.38.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 May 2017 06:38:52 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 26D1140350; Sat, 27 May 2017 07:38:52 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 27 May 2017 07:38:24 -0600 Message-Id: <20170527133831.25882-15-sjg@chromium.org> X-Mailer: git-send-email 2.13.0.219.gdb65acc882-goog In-Reply-To: <20170527133831.25882-1-sjg@chromium.org> References: <20170527133831.25882-1-sjg@chromium.org> Cc: Tom Rini , Jerry Van Baren Subject: [U-Boot] [PATCH v3 14/20] fdt: Stop building the old python libfdt module X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This is no-longer needed, so stop building it. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None lib/libfdt/libfdt_legacy.swig | 112 ------------------------------------------ lib/libfdt/setup.py | 38 -------------- tools/Makefile | 18 ------- 3 files changed, 168 deletions(-) delete mode 100644 lib/libfdt/libfdt_legacy.swig delete mode 100644 lib/libfdt/setup.py diff --git a/lib/libfdt/libfdt_legacy.swig b/lib/libfdt/libfdt_legacy.swig deleted file mode 100644 index 9880dd998e..0000000000 --- a/lib/libfdt/libfdt_legacy.swig +++ /dev/null @@ -1,112 +0,0 @@ -%module libfdt_legacy - -%{ -#define SWIG_FILE_WITH_INIT -#include "libfdt.h" -%} - -%pythoncode %{ -def Raise(errnum): - raise ValueError('Error %s' % fdt_strerror(errnum)) - -def Name(fdt, offset): - name, len = fdt_get_name(fdt, offset) - return name - -def String(fdt, offset): - offset = fdt32_to_cpu(offset) - name = fdt_string(fdt, offset) - return name - -def swap32(x): - return (((x << 24) & 0xFF000000) | - ((x << 8) & 0x00FF0000) | - ((x >> 8) & 0x0000FF00) | - ((x >> 24) & 0x000000FF)) - -def fdt32_to_cpu(x): - return swap32(x) - -def Data(prop): - set_prop(prop) - return get_prop_data() -%} - -%include "typemaps.i" -%include "cstring.i" - -%typemap(in) void* = char*; - -typedef int fdt32_t; - -struct fdt_property { - fdt32_t tag; - fdt32_t len; - fdt32_t nameoff; - char data[0]; -}; - -/* - * This is a work-around since I'm not sure of a better way to copy out the - * contents of a string. This is used in dtoc/GetProps(). The intent is to - * pass in a pointer to a property and access the data field at the end of - * it. Ideally the Data() function above would be able to do this directly, - * but I'm not sure how to do that. - */ -#pragma SWIG nowarn=454 -%inline %{ - static struct fdt_property *cur_prop; - - void set_prop(struct fdt_property *prop) { - cur_prop = prop; - } -%} - -%cstring_output_allocate_size(char **s, int *sz, free(*$1)); -%inline %{ - void get_prop_data(char **s, int *sz) { - *sz = fdt32_to_cpu(cur_prop->len); - *s = (char *)malloc(*sz); - if (!*s) - *sz = 0; - else - memcpy(*s, cur_prop + 1, *sz); - } -%} - -%typemap(in) (const void *) { - if (!PyByteArray_Check($input)) { - SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument " - "$argnum"" of type '" "$type""'"); - } - $1 = (void *) PyByteArray_AsString($input); -} - -const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen); -int fdt_path_offset(const void *fdt, const char *path); -int fdt_first_property_offset(const void *fdt, int nodeoffset); -int fdt_next_property_offset(const void *fdt, int offset); -const char *fdt_strerror(int errval); -const struct fdt_property *fdt_get_property_by_offset(const void *fdt, - int offset, - int *OUTPUT); -const char *fdt_get_name(const void *fdt, int nodeoffset, int *OUTPUT); -const char *fdt_string(const void *fdt, int stroffset); -int fdt_first_subnode(const void *fdt, int offset); -int fdt_next_subnode(const void *fdt, int offset); - -%typemap(in) (void *) { - if (!PyByteArray_Check($input)) { - SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument " - "$argnum"" of type '" "$type""'"); - } - $1 = PyByteArray_AsString($input); -} - -int fdt_delprop(void *fdt, int nodeoffset, const char *name); - -const char *fdt_strerror(int errval); -int fdt_pack(void *fdt); - -int fdt_totalsize(const void *fdt); -int fdt_off_dt_struct(const void *fdt); diff --git a/lib/libfdt/setup.py b/lib/libfdt/setup.py deleted file mode 100644 index fc881351c6..0000000000 --- a/lib/libfdt/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -""" -setup.py file for SWIG libfdt -""" - -from distutils.core import setup, Extension -import os -import sys - -# Don't cross-compile - always use the host compiler. -del os.environ['CROSS_COMPILE'] -del os.environ['CC'] - -progname = sys.argv[0] -cflags = sys.argv[1] -files = sys.argv[2:] - -if cflags: - cflags = [flag for flag in cflags.split(' ') if flag] -else: - cflags = None - -libfdt_module = Extension( - '_libfdt_legacy', - sources = files, - extra_compile_args = cflags -) - -sys.argv = [progname, '--quiet', 'build_ext', '--inplace', '--force'] - -setup (name = 'libfdt_legaacy', - version = '0.1', - author = "SWIG Docs", - description = """Simple swig libfdt from docs""", - ext_modules = [libfdt_module], - py_modules = ["libfdt_legacy"], - ) diff --git a/tools/Makefile b/tools/Makefile index bc411e4ae4..cb1683e153 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -141,24 +141,6 @@ tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG) $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \ --build-lib tools -# Build a libfdt Python module if swig is available -# Use 'sudo apt-get install swig libpython-dev' to enable this -hostprogs-y += \ - $(if $(shell which swig 2> /dev/null),_libfdt_legacy.so) -_libfdt_legacy.so-sharedobjs += $(LIBFDT_OBJS) -libfdt: - -tools/_libfdt_legacy.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) \ - tools/libfdt_legacy_wrap.c - LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= ${PYTHON} $(srctree)/lib/libfdt/setup.py \ - "$(_hostc_flags)" $^ - mv _libfdt_legacy.so $@ - -tools/libfdt_legacy_wrap.c: $(srctree)/lib/libfdt/libfdt_legacy.swig - swig -python -o $@ $< - -# TODO(sjg@chromium.org): Is this correct on Mac OS? - ifneq ($(CONFIG_MX23)$(CONFIG_MX28),) # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register # the mxsimage support within tools/mxsimage.c .