+++ /dev/null
-#
-# Copyright (C) 2006-2011 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=apex
-PKG_VERSION:=1.6.9
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
-PKG_HASH:=1d2bc04c2c6bb3d2d6c1916b6dc559cda2b1ecb045d7801fd49af6af4234abeb
-PKG_TARGETS:=bin
-
-include $(INCLUDE_DIR)/package.mk
-
-export GCC_HONOUR_COPTS=s
-
-define Package/apex
- SECTION:=boot
- CATEGORY:=Boot Loaders
- DEPENDS:=@TARGET_ixp4xx
- DEFAULT:=y
- TITLE:=Boot loader for NSLU2, FSG3, NAS100D and others
- URL:=http://wiki.buici.com/wiki/Apex_Bootloader
-endef
-
-define build_apex
- $(MAKE) -C $(PKG_BUILD_DIR) \
- ARCH=arm \
- $(1)_config
- $(MAKE) -C $(PKG_BUILD_DIR) \
- $(TARGET_CONFIGURE_OPTS) \
- KBUILD_HAVE_NLS=no \
- ARCH=arm \
- clean all
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/apex.bin $(PKG_BUILD_DIR)/out/apex-$(2).bin
-endef
-
-define Build/Compile
- $(INSTALL_DIR) $(PKG_BUILD_DIR)/out
- $(call build_apex,slugos-nslu2-armeb,nslu2-armeb)
- $(call build_apex,slugos-nslu2-16mb-armeb,nslu2-16mb-armeb)
- $(call build_apex,slugos-fsg3-armeb,fsg3-armeb)
- $(call build_apex,slugos-nas100d-armeb,nas100d-armeb)
-endef
-
-define Package/apex/install
- $(INSTALL_DIR) $(STAGING_DIR)/apex
- $(CP) $(PKG_BUILD_DIR)/out/*.bin $(1)/
-endef
-
-define Build/InstallDev
- $(CP) $(PKG_BUILD_DIR)/out/*.bin $(KERNEL_BUILD_DIR)
-endef
-
-$(eval $(call BuildPackage,apex))
+++ /dev/null
---- a/Makefile
-+++ b/Makefile
-@@ -444,7 +444,7 @@ ifeq ($(config-targets),1)
- include $(srctree)/src/arch-$(SRCARCH)/Makefile
- export KBUILD_DEFCONFIG
-
--config %config: scripts_basic outputmakefile FORCE
-+%config: scripts_basic outputmakefile FORCE
- $(Q)mkdir -p include/linux include/config
- $(Q)$(MAKE) $(build)=scripts/kconfig $@
-
-@@ -1585,7 +1585,7 @@ endif
- $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-
- # Modules
--/ %/: prepare scripts FORCE
-+%/: prepare scripts FORCE
- $(cmd_crmodverdir)
- $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
- $(build)=$(build-dir)
+++ /dev/null
---- a/src/mach-ixp42x/slugos-nslu2-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-armeb_config
-@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS NSLU2 (bigendian)"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt NSLU2 (8MiB Flash)"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- # CONFIG_DRIVER_LONG_LONG_SIZE is not set
-@@ -163,9 +163,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern
- # Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y
--CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set
- CONFIG_USES_NOR_BOOTFLASH=y
+++ /dev/null
---- a/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS NSLU2/BE (16MiB Flash)"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt NSLU2 (16MiB Flash)"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- # CONFIG_DRIVER_LONG_LONG_SIZE is not set
-@@ -163,9 +163,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern
- # Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y
--CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set
- CONFIG_USES_NOR_BOOTFLASH=y
+++ /dev/null
---- a/src/mach-ixp42x/slugos-fsg3-armeb_config
-+++ b/src/mach-ixp42x/slugos-fsg3-armeb_config
-@@ -17,7 +17,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS FSG3/BE"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt FSG3"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-@@ -148,9 +148,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern
- # Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/sda1 rootdelay=10 console=ttyS0,115200"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/sda1 rootdelay=10 console=ttyS0,115200 init=/etc/preinit noinitrd"
- CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y
--CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/sda2 rootdelay=10 console=ttyS0,115200"
-+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock2 rootfstype=squashfs console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set
- CONFIG_USES_NOR_BOOTFLASH=y
+++ /dev/null
---- a/src/mach-ixp42x/slugos-nslu2-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-armeb_config
-@@ -137,7 +137,7 @@ CONFIG_AUTOBOOT_DELAY=10
- CONFIG_ENV_STARTUP_KERNEL_COPY=y
- # CONFIG_ENV_REGION_KERNEL_SWAP is not set
- CONFIG_ENV_STARTUP_PREFIX_P=y
--CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+256m"
-+CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+64m"
-
- #
- # Regions
---- a/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-@@ -137,7 +137,7 @@ CONFIG_AUTOBOOT_DELAY=10
- CONFIG_ENV_STARTUP_KERNEL_COPY=y
- # CONFIG_ENV_REGION_KERNEL_SWAP is not set
- CONFIG_ENV_STARTUP_PREFIX_P=y
--CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+256m"
-+CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+64m"
-
- #
- # Regions
+++ /dev/null
---- a/src/mach-ixp42x/slugos-nas100d-armeb_config
-+++ b/src/mach-ixp42x/slugos-nas100d-armeb_config
-@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS NAS100D/BE"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt NAS100D"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- # CONFIG_DRIVER_LONG_LONG_SIZE is not set
-@@ -158,7 +158,7 @@ CONFIG_ENV_REGION_KERNEL="fis://kernel"
- # Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- CONFIG_USES_NOR_BOOTFLASH=y
- CONFIG_RELOCATE_SIMPLE=y
+++ /dev/null
-#
-# Copyright (C) 2006-2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=fconfig
-PKG_VERSION:=20080329
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://andrzejekiert.ovh.org/software/fconfig/
-PKG_HASH:=4ff0e8f07e35e46b705c0dbe9d9544ede01ea092a69e3f7db03e55a3f2bb8eb7
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/fconfig
- SECTION:=utils
- CATEGORY:=Utilities
- SUBMENU:=Boot Loaders
- TITLE:=RedBoot configuration editor
- URL:=http://andrzejekiert.ovh.org/software.html.en
-endef
-
-define Package/fconfig/description
- displays and (if writable) also edits the RedBoot configuration.
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
- $(call Build/Compile/Default)
-endef
-
-define Package/fconfig/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/fconfig $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,fconfig))
+++ /dev/null
-#
-# Copyright (C) 2013-2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=kobs-ng
-PKG_VERSION:=5.4
-PKG_RELEASE:=1
-
-PKG_SOURCE:=imx-kobs-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.freescale.com/lgfiles/NMG/MAD/YOCTO/
-PKG_HASH:=85171b46068ac47c42fedb8104167bf9afd33dd9527ed127e1ca2eb29d7a86bf
-PKG_BUILD_DIR:=$(BUILD_DIR)/imx-kobs-$(PKG_VERSION)
-
-PKG_LICENSE:=GPLv2
-PKG_LICENSE_FILES:=COPYING
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/kobs-ng
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=Application for writing bootstreams to NAND flash
- DEPENDS:=@TARGET_imx6
-endef
-
-define Package/kobs-ng/description
- The kobs-ng application writes a bootstream to NAND flash with the proper
- FCB/DBBT headers and replicated streams.
-endef
-
-define Build/Prepare
- $(call Build/Prepare/Default)
- echo "const char* git_sha = \"$(PKG_VERSION)\";" > $(PKG_BUILD_DIR)/autoversion.h
-endef
-
-define Package/kobs-ng/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/kobs-ng $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,kobs-ng))
+++ /dev/null
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -28,6 +28,7 @@
- #include <unistd.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <stddef.h>
- #include <fcntl.h>
- #include <ctype.h>
- #include <errno.h>
---- a/src/mtd.h
-+++ b/src/mtd.h
-@@ -25,8 +25,10 @@
- #ifndef MTD_H
- #define MTD_H
-
-+#define _GNU_SOURCE
- #include <mtd/mtd-user.h>
- #include <endian.h>
-+#include <fcntl.h>
-
- #include "BootControlBlocks.h"
- #include "rom_nand_hamming_code_ecc.h"
+++ /dev/null
-Add --chip_0_size param to override the size of the mtd partition which is
-required if the SPL does not occupy the entire partition. For Gateworks
-Ventana boards the 'uboot' partition contains both the SPL and uboot.
---- a/src/main.c
-+++ b/src/main.c
-@@ -94,6 +94,7 @@ void usage(void)
- " [KOBS] boot structures config options\n"
- " --chip_0_device_path=<path> .......... Device of boot (default /dev/mtd0)\n"
- " --chip_1_device_path=<path> .......... The second chip in case of multichip NAND\n"
-+ " --chip_0_size=<size> ................. Override size of chip_0 device\n"
- " --search_exponent=<value> ............ NCB field (default 2)\n"
- " --data_setup_time=<value> ............ NCB field (default 80)\n"
- " --data_hold_time=<value> ............. NCB field (default 60)\n"
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -876,6 +876,11 @@ struct mtd_data *mtd_open(const struct m
- goto out;
- }
-
-+ /* override MTD size */
-+ if (md->cfg.chip_0_size) {
-+ miu->size = md->cfg.chip_0_size;
-+ }
-+
- /* verify it's a nand */
- if (miu->type != MTD_NANDFLASH
- && miu->type != MTD_MLCNANDFLASH) {
-@@ -3385,7 +3390,7 @@ static const struct {
- } mtd_int_args[] = {
- ARG_IGNORE(chip_count),
- ARG_IGNORE(chip_0_offset),
-- ARG_IGNORE(chip_0_size),
-+ ARG(chip_0_size),
- ARG_IGNORE(chip_1_offset),
- ARG_IGNORE(chip_1_size),
- ARG(search_exponent),
-@@ -3578,7 +3583,7 @@ void mtd_cfg_dump(struct mtd_config *cfg
- // Pd(chip_count);
- Ps(chip_0_device_path);
- // Pd(chip_0_offset);
--// Pd(chip_0_size);
-+ Pd(chip_0_size);
- Ps(chip_1_device_path);
- // Pd(chip_1_offset);
- // Pd(chip_1_size);
+++ /dev/null
-The downstream Freescale vendor kernel has a patch that allows determining
-if raw NAND flash mode is provided via a debugfs file. This is not present
-in upstream kernels, but the raw access support was added in the 3.19
-kernel, so we will check the kernel version if we can't find the file.
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -34,6 +34,7 @@
- #include <errno.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
-+#include <sys/utsname.h>
-
- #include "mtd.h"
- #include "rand.h"
-@@ -808,15 +809,27 @@ struct mtd_data *mtd_open(const struct m
- md->cfg = *cfg;
-
- /* check if use new raw access mode */
-+ /* by looking for debugfs from fsl patch */
-+ md->raw_mode_flag = 0;
- fp = fopen("/sys/kernel/debug/gpmi-nand/raw_mode", "r");
- if (!fp) {
-- md->raw_mode_flag = 0;
-- vp(md, "mtd: use legacy raw access mode\n");
-+ /* fallback to kernel version: raw access added in 3.19 */
-+ struct utsname uts;
-+ if (!uname(&uts)) {
-+ int major = 0, minor = 0;
-+ sscanf(uts.release, "%d.%d", &major, &minor);
-+ vp(md, "mtd: Linux %d.%d\n", major, minor);
-+ if ((major << 8 | minor) > (3 << 8 | 18))
-+ md->raw_mode_flag = 1;
-+ }
- } else {
- fclose(fp);
- md->raw_mode_flag = 1;
-- vp(md, "mtd: use new bch layout raw access mode\n");
- }
-+ if (md->raw_mode_flag)
-+ vp(md, "mtd: use new bch layout raw access mode\n");
-+ else
-+ vp(md, "mtd: use legacy raw access mode\n");
-
- if (plat_config_data->m_u32UseMultiBootArea) {
-
+++ /dev/null
-The Freescale downstream vendor kernel has a patch that exports the bch
-flash geometry via a debugfs file. This is not available in mainline linux
-kernels so the fallback method calculates the geometry based on known info
-from the mtd partition. A bug exists in this funcion where it fails to
-assume that block0 ECC is the same as the other blocks by default.
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -610,7 +610,7 @@ static int cal_nfc_geometry(struct mtd_d
- /* The two are fixed, please change them when the driver changes. */
- geo->metadata_size_in_bytes = 10;
- geo->gf_len = 13;
-- geo->ecc_chunkn_size_in_bytes = 512;
-+ geo->ecc_chunkn_size_in_bytes = geo->ecc_chunk0_size_in_bytes = 512;
-
- if (mtd->oobsize > geo->ecc_chunkn_size_in_bytes) {
- geo->gf_len = 14;
-@@ -700,8 +700,9 @@ int parse_nfc_geometry(struct mtd_data *
- unsigned int value;
-
- if (!plat_config_data->m_u32UseNfcGeo) {
-+ /* fsl kernel patch provides bch_geometry via debugfs */
- if (!(node = fopen(dbg_geometry_node_path, "r"))) {
-- fprintf(stderr, "Cannot open BCH geometry node: \"%s\"",
-+ fprintf(stderr, "Cannot open BCH geometry node: \"%s\"\n",
- dbg_geometry_node_path);
- return cal_nfc_geometry(md);
- }
+++ /dev/null
-#
-# Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=rbcfg
-PKG_RELEASE:=1
-
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/rbcfg
- SECTION:=utils
- CATEGORY:=Utilities
- SUBMENU:=Boot Loaders
- TITLE:=RouterBOOT configuration tool
- DEPENDS:=@TARGET_ar71xx
-endef
-
-define Package/rbcfg/description
- This package contains an utility to manipulate RouterBOOT configuration on the
- MikroTIK RB-4XX devices.
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) \
- CC="$(TARGET_CC)" \
- CFLAGS="$(TARGET_CFLAGS) -Wall" \
- LDFLAGS="$(TARGET_LDFLAGS)"
-endef
-
-define Package/rbcfg/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/rbcfg $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,rbcfg))
+++ /dev/null
-CC = gcc
-CFLAGS = -Wall
-OBJS = main.o cyg_crc32.o
-
-all: rbcfg
-
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-rbcfg: $(OBJS)
- $(CC) -o $@ $(OBJS)
-
-clean:
- rm -f rbcfg *.o
+++ /dev/null
-//==========================================================================
-//
-// crc.h
-//
-// Interface for the CRC algorithms.
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 2002 Andrew Lunn
-//
-// eCos 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 or (at your option) any later version.
-//
-// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s): Andrew Lunn
-// Contributors: Andrew Lunn
-// Date: 2002-08-06
-// Purpose:
-// Description:
-//
-// This code is part of eCos (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#ifndef _SERVICES_CRC_CRC_H_
-#define _SERVICES_CRC_CRC_H_
-
-#if 0
-#include <cyg/infra/cyg_type.h>
-#else
-#include <stdint.h>
-typedef uint32_t cyg_uint32;
-typedef uint16_t cyg_uint16;
-#endif
-
-#ifndef __externC
-# ifdef __cplusplus
-# define __externC extern "C"
-# else
-# define __externC extern
-# endif
-#endif
-
-// Compute a CRC, using the POSIX 1003 definition
-
-__externC cyg_uint32
-cyg_posix_crc32(unsigned char *s, int len);
-
-// Gary S. Brown's 32 bit CRC
-
-__externC cyg_uint32
-cyg_crc32(unsigned char *s, int len);
-
-// Gary S. Brown's 32 bit CRC, but accumulate the result from a
-// previous CRC calculation
-
-__externC cyg_uint32
-cyg_crc32_accumulate(cyg_uint32 crc, unsigned char *s, int len);
-
-// Ethernet FCS Algorithm
-
-__externC cyg_uint32
-cyg_ether_crc32(unsigned char *s, int len);
-
-// Ethernet FCS algorithm, but accumulate the result from a previous
-// CRC calculation.
-
-__externC cyg_uint32
-cyg_ether_crc32_accumulate(cyg_uint32 crc, unsigned char *s, int len);
-
-// 16 bit CRC with polynomial x^16+x^12+x^5+1
-
-__externC cyg_uint16
-cyg_crc16(unsigned char *s, int len);
-
-#endif // _SERVICES_CRC_CRC_H_
-
-
-
+++ /dev/null
-//==========================================================================
-//
-// crc32.c
-//
-// Gary S. Brown's 32 bit CRC
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
-//
-// eCos 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 or (at your option) any later version.
-//
-// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s): gthomas
-// Contributors: gthomas,asl
-// Date: 2001-01-31
-// Purpose:
-// Description:
-//
-// This code is part of eCos (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#if 0
-#include <cyg/crc/crc.h>
-#else
-#include "cyg_crc.h"
-#endif
-
- /* ====================================================================== */
- /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */
- /* code or tables extracted from it, as desired without restriction. */
- /* */
- /* First, the polynomial itself and its table of feedback terms. The */
- /* polynomial is */
- /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */
- /* */
- /* ====================================================================== */
-
-static const cyg_uint32 crc32_tab[] = {
- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
- 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
- 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
- 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
- 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
- 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
- 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
- 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
- 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
- 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
- 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
- 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
- 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
- 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
- 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
- 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
- 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
- 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
- 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
- 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
- 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
- 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
- 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
- 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
- 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
- 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
- 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
- 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
- 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
- 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
- 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
- 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
- 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
- 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
- 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
- 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
- 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
- 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
- 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
- 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
- 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
- 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
- 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
- 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
- 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
- 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
- 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
- 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
- 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
- 0x2d02ef8dL
- };
-
-/* This is the standard Gary S. Brown's 32 bit CRC algorithm, but
- accumulate the CRC into the result of a previous CRC. */
-cyg_uint32
-cyg_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, int len)
-{
- int i;
-
- for (i = 0; i < len; i++) {
- crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8);
- }
- return crc32val;
-}
-
-/* This is the standard Gary S. Brown's 32 bit CRC algorithm */
-cyg_uint32
-cyg_crc32(unsigned char *s, int len)
-{
- return (cyg_crc32_accumulate(0,s,len));
-}
-
-/* Return a 32-bit CRC of the contents of the buffer accumulating the
- result from a previous CRC calculation. This uses the Ethernet FCS
- algorithm.*/
-cyg_uint32
-cyg_ether_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, int len)
-{
- int i;
-
- if (s == 0) return 0L;
-
- crc32val = crc32val ^ 0xffffffff;
- for (i = 0; i < len; i++) {
- crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8);
- }
- return crc32val ^ 0xffffffff;
-}
-
-/* Return a 32-bit CRC of the contents of the buffer, using the
- Ethernet FCS algorithm. */
-cyg_uint32
-cyg_ether_crc32(unsigned char *s, int len)
-{
- return cyg_ether_crc32_accumulate(0,s,len);
-}
-
-
+++ /dev/null
-/*
- * RouterBOOT configuration utility
- *
- * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <linux/limits.h>
-
-#include "rbcfg.h"
-#include "cyg_crc.h"
-
-#define RBCFG_TMP_FILE "/tmp/.rbcfg"
-#define RBCFG_MTD_NAME "soft_config"
-
-#define RB_ERR_NOTFOUND 1
-#define RB_ERR_INVALID 2
-#define RB_ERR_NOMEM 3
-#define RB_ERR_IO 4
-
-#define ARRAY_SIZE(_a) (sizeof((_a)) / sizeof((_a)[0]))
-
-struct rbcfg_ctx {
- char *mtd_device;
- char *tmp_file;
- char *buf;
- unsigned buflen;
-};
-
-struct rbcfg_value {
- const char *name;
- const char *desc;
- union {
- uint32_t u32;
- const char *raw;
- } val;
-};
-
-#define RBCFG_ENV_TYPE_U32 0
-
-struct rbcfg_env {
- const char *name;
- int type;
- uint16_t id;
- const struct rbcfg_value *values;
- int num_values;
-};
-
-#define CMD_FLAG_USES_CFG 0x01
-
-struct rbcfg_command {
- const char *command;
- const char *usage;
- int flags;
- int (*exec)(int argc, const char *argv[]);
-};
-
-static void usage(void);
-
-/* Globals */
-
-static struct rbcfg_ctx *rbcfg_ctx;
-static char *rbcfg_name;
-
-#define CFG_U32(_name, _desc, _val) { \
- .name = (_name), \
- .desc = (_desc), \
- .val.u32 = (_val), \
-}
-
-static const struct rbcfg_value rbcfg_boot_delay[] = {
- CFG_U32("1", "1 second", RB_BOOT_DELAY_1SEC),
- CFG_U32("2", "2 seconds", RB_BOOT_DELAY_2SEC),
- CFG_U32("3", "3 seconds", RB_BOOT_DELAY_3SEC),
- CFG_U32("4", "4 seconds", RB_BOOT_DELAY_4SEC),
- CFG_U32("5", "5 seconds", RB_BOOT_DELAY_5SEC),
- CFG_U32("6", "6 seconds", RB_BOOT_DELAY_6SEC),
- CFG_U32("7", "7 seconds", RB_BOOT_DELAY_7SEC),
- CFG_U32("8", "8 seconds", RB_BOOT_DELAY_8SEC),
- CFG_U32("9", "9 seconds", RB_BOOT_DELAY_9SEC),
-};
-
-static const struct rbcfg_value rbcfg_boot_device[] = {
- CFG_U32("eth", "boot over Ethernet",
- RB_BOOT_DEVICE_ETHER),
- CFG_U32("nandeth", "boot from NAND, if fail then Ethernet",
- RB_BOOT_DEVICE_NANDETH),
- CFG_U32("ethnand", "boot Ethernet once, then NAND",
- RB_BOOT_DEVICE_ETHONCE),
- CFG_U32("nand", "boot from NAND only",
- RB_BOOT_DEVICE_NANDONLY),
-};
-
-static const struct rbcfg_value rbcfg_boot_key[] = {
- CFG_U32("any", "any key", RB_BOOT_KEY_ANY),
- CFG_U32("del", "<Delete> key only", RB_BOOT_KEY_DEL),
-};
-
-static const struct rbcfg_value rbcfg_boot_protocol[] = {
- CFG_U32("bootp", "BOOTP protocol", RB_BOOT_PROTOCOL_BOOTP),
- CFG_U32("dhcp", "DHCP protocol", RB_BOOT_PROTOCOL_DHCP),
-};
-
-static const struct rbcfg_value rbcfg_uart_speed[] = {
- CFG_U32("115200", "", RB_UART_SPEED_115200),
- CFG_U32("57600", "", RB_UART_SPEED_57600),
- CFG_U32("38400", "", RB_UART_SPEED_38400),
- CFG_U32("19200", "", RB_UART_SPEED_19200),
- CFG_U32("9600", "", RB_UART_SPEED_9600),
- CFG_U32("4800", "", RB_UART_SPEED_4800),
- CFG_U32("2400", "", RB_UART_SPEED_2400),
- CFG_U32("1200", "", RB_UART_SPEED_1200),
- CFG_U32("off", "disable console output", RB_UART_SPEED_OFF),
-};
-
-static const struct rbcfg_value rbcfg_cpu_mode[] = {
- CFG_U32("powersave", "power save", RB_CPU_MODE_POWERSAVE),
- CFG_U32("regular", "regular (better for -0c environment)",
- RB_CPU_MODE_REGULAR),
-};
-
-static const struct rbcfg_value rbcfg_booter[] = {
- CFG_U32("regular", "load regular booter", RB_BOOTER_REGULAR),
- CFG_U32("backup", "force backup-booter loading", RB_BOOTER_BACKUP),
-};
-
-static const struct rbcfg_env rbcfg_envs[] = {
- {
- .name = "boot_delay",
- .id = RB_ID_BOOT_DELAY,
- .type = RBCFG_ENV_TYPE_U32,
- .values = rbcfg_boot_delay,
- .num_values = ARRAY_SIZE(rbcfg_boot_delay),
- }, {
- .name = "boot_device",
- .id = RB_ID_BOOT_DEVICE,
- .type = RBCFG_ENV_TYPE_U32,
- .values = rbcfg_boot_device,
- .num_values = ARRAY_SIZE(rbcfg_boot_device),
- }, {
- .name = "boot_key",
- .id = RB_ID_BOOT_KEY,
- .type = RBCFG_ENV_TYPE_U32,
- .values = rbcfg_boot_key,
- .num_values = ARRAY_SIZE(rbcfg_boot_key),
- }, {
- .name = "boot_protocol",
- .id = RB_ID_BOOT_PROTOCOL,
- .type = RBCFG_ENV_TYPE_U32,
- .values = rbcfg_boot_protocol,
- .num_values = ARRAY_SIZE(rbcfg_boot_protocol),
- }, {
- .name = "booter",
- .id = RB_ID_BOOTER,
- .type = RBCFG_ENV_TYPE_U32,
- .values = rbcfg_booter,
- .num_values = ARRAY_SIZE(rbcfg_booter),
- }, {
- .name = "cpu_mode",
- .id = RB_ID_CPU_MODE,
- .type = RBCFG_ENV_TYPE_U32,
- .values = rbcfg_cpu_mode,
- .num_values = ARRAY_SIZE(rbcfg_cpu_mode),
- }, {
- .name = "uart_speed",
- .id = RB_ID_UART_SPEED,
- .type = RBCFG_ENV_TYPE_U32,
- .values = rbcfg_uart_speed,
- .num_values = ARRAY_SIZE(rbcfg_uart_speed),
- }
-};
-
-static inline uint16_t
-get_u16(const void *buf)
-{
- const uint8_t *p = buf;
-
- return ((uint16_t) p[1] + ((uint16_t) p[0] << 8));
-}
-
-static inline uint32_t
-get_u32(const void *buf)
-{
- const uint8_t *p = buf;
-
- return ((uint32_t) p[3] + ((uint32_t) p[2] << 8) +
- ((uint32_t) p[1] << 16) + ((uint32_t) p[0] << 24));
-}
-
-static inline void
-put_u32(void *buf, uint32_t val)
-{
- uint8_t *p = buf;
-
- p[3] = val & 0xff;
- p[2] = (val >> 8) & 0xff;
- p[1] = (val >> 16) & 0xff;
- p[0] = (val >> 24) & 0xff;
-}
-
-static int
-rbcfg_find_tag(struct rbcfg_ctx *ctx, uint16_t tag_id, uint16_t *tag_len,
- void **tag_data)
-{
- uint16_t id;
- uint16_t len;
- char *buf = ctx->buf;
- unsigned int buflen = ctx->buflen;
- int ret = RB_ERR_NOTFOUND;
-
- /* skip magic and CRC value */
- buf += 8;
- buflen -= 8;
-
- while (buflen > 2) {
- len = get_u16(buf);
- buf += 2;
- buflen -= 2;
-
- if (buflen < 2)
- break;
-
- id = get_u16(buf);
- buf += 2;
- buflen -= 2;
-
- if (id == RB_ID_TERMINATOR)
- break;
-
- if (buflen < len)
- break;
-
- if (id == tag_id) {
- *tag_len = len;
- *tag_data = buf;
- ret = 0;
- break;
- }
-
- buf += len;
- buflen -= len;
- }
-
- if (ret)
- fprintf(stderr, "no tag found with id=%u\n", tag_id);
-
- return ret;
-}
-
-static int
-rbcfg_get_u32(struct rbcfg_ctx *ctx, uint16_t id, uint32_t *val)
-{
- void *tag_data;
- uint16_t tag_len;
- int err;
-
- err = rbcfg_find_tag(ctx, id, &tag_len, &tag_data);
- if (err)
- return err;
-
- *val = get_u32(tag_data);
- return 0;
-}
-
-static int
-rbcfg_set_u32(struct rbcfg_ctx *ctx, uint16_t id, uint32_t val)
-{
- void *tag_data;
- uint16_t tag_len;
- int err;
-
- err = rbcfg_find_tag(ctx, id, &tag_len, &tag_data);
- if (err)
- return err;
-
- put_u32(tag_data, val);
- return 0;
-}
-
-char *rbcfg_find_mtd(const char *name, int *erase_size)
-{
- FILE *f;
- int mtd_num;
- char dev[PATH_MAX];
- char *ret = NULL;
- struct stat s;
- int err;
-
- f = fopen("/proc/mtd", "r");
- if (!f)
- return NULL;
-
- while (1) {
- char *p;
- p = fgets(dev, sizeof(dev), f);
- if (!p)
- break;
-
- if (!strstr(dev, name))
- continue;
-
- err = sscanf(dev, "mtd%d: %08x", &mtd_num, erase_size);
- if (err != 2)
- break;
-
- sprintf(dev, "/dev/mtdblock%d", mtd_num);
- err = stat(dev, &s);
- if (err < 0)
- break;
-
- if ((s.st_mode & S_IFBLK) == 0)
- break;
-
- ret = malloc(strlen(dev) + 1);
- if (ret == NULL)
- break;
-
- strncpy(ret, dev, strlen(dev) + 1);
- break;
- }
-
- fclose(f);
- return ret;
-}
-
-static int
-rbcfg_check_tmp(struct rbcfg_ctx *ctx)
-{
- struct stat s;
- int err;
-
- err = stat(ctx->tmp_file, &s);
- if (err < 0)
- return 0;
-
- if ((s.st_mode & S_IFREG) == 0)
- return 0;
-
- if (s.st_size != ctx->buflen)
- return 0;
-
- return 1;
-}
-
-static int
-rbcfg_load(struct rbcfg_ctx *ctx)
-{
- uint32_t magic;
- uint32_t crc_orig, crc;
- char *name;
- int tmp;
- int fd;
- int err;
-
- tmp = rbcfg_check_tmp(ctx);
- name = (tmp) ? ctx->tmp_file : ctx->mtd_device;
-
- fd = open(name, O_RDONLY);
- if (fd < 0) {
- fprintf(stderr, "unable to open %s\n", name);
- err = RB_ERR_IO;
- goto err;
- }
-
- err = read(fd, ctx->buf, ctx->buflen);
- if (err != ctx->buflen) {
- fprintf(stderr, "unable to read from %s\n", name);
- err = RB_ERR_IO;
- goto err_close;
- }
-
- magic = get_u32(ctx->buf);
- if (magic != RB_MAGIC_SOFT) {
- fprintf(stderr, "invalid configuration\n");
- err = RB_ERR_INVALID;
- goto err_close;
- }
-
- crc_orig = get_u32(ctx->buf + 4);
- put_u32(ctx->buf + 4, 0);
- crc = cyg_ether_crc32((unsigned char *) ctx->buf, ctx->buflen);
- if (crc != crc_orig) {
- fprintf(stderr, "configuration has CRC error\n");
- err = RB_ERR_INVALID;
- goto err_close;
- }
-
- err = 0;
-
- err_close:
- close(fd);
- err:
- return err;
-}
-
-static int
-rbcfg_open()
-{
- char *mtd_device;
- struct rbcfg_ctx *ctx;
- int buflen;
- int err;
-
- mtd_device = rbcfg_find_mtd(RBCFG_MTD_NAME, &buflen);
- if (!mtd_device) {
- fprintf(stderr, "unable to find configuration\n");
- return RB_ERR_NOTFOUND;
- }
-
- ctx = malloc(sizeof(struct rbcfg_ctx) + buflen);
- if (ctx == NULL) {
- err = RB_ERR_NOMEM;
- goto err_free_mtd;
- }
-
- ctx->mtd_device = mtd_device;
- ctx->tmp_file = RBCFG_TMP_FILE;
- ctx->buflen = buflen;
- ctx->buf = (char *) &ctx[1];
-
- err = rbcfg_load(ctx);
- if (err)
- goto err_free_ctx;
-
- rbcfg_ctx = ctx;
- return 0;
-
- err_free_ctx:
- free(ctx);
- err_free_mtd:
- free(mtd_device);
- return err;
-}
-
-static int
-rbcfg_update(int tmp)
-{
- struct rbcfg_ctx *ctx = rbcfg_ctx;
- char *name;
- uint32_t crc;
- int fd;
- int err;
-
- put_u32(ctx->buf, RB_MAGIC_SOFT);
- put_u32(ctx->buf + 4, 0);
- crc = cyg_ether_crc32((unsigned char *) ctx->buf, ctx->buflen);
- put_u32(ctx->buf + 4, crc);
-
- name = (tmp) ? ctx->tmp_file : ctx->mtd_device;
- fd = open(name, O_WRONLY | O_CREAT);
- if (fd < 0) {
- fprintf(stderr, "unable to open %s for writing\n", name);
- err = RB_ERR_IO;
- goto out;
- }
-
- err = write(fd, ctx->buf, ctx->buflen);
- if (err != ctx->buflen) {
- err = RB_ERR_IO;
- goto out_close;
- }
-
- fsync(fd);
- err = 0;
-
- out_close:
- close(fd);
- out:
- return err;
-}
-
-static void
-rbcfg_close(void)
-{
- struct rbcfg_ctx *ctx;
-
- ctx = rbcfg_ctx;
- free(ctx->mtd_device);
- free(ctx);
-}
-
-static const struct rbcfg_value *
-rbcfg_env_find(const struct rbcfg_env *env, const char *name)
-{
- unsigned i;
-
- for (i = 0; i < env->num_values; i++) {
- const struct rbcfg_value *v = &env->values[i];
-
- if (strcmp(v->name, name) == 0)
- return v;
- }
-
- return NULL;
-}
-
-static const struct rbcfg_value *
-rbcfg_env_find_u32(const struct rbcfg_env *env, uint32_t val)
-{
- unsigned i;
-
- for (i = 0; i < env->num_values; i++) {
- const struct rbcfg_value *v = &env->values[i];
-
- if (v->val.u32 == val)
- return v;
- }
-
- return NULL;
-}
-
-static const char *
-rbcfg_env_get_u32(const struct rbcfg_env *env)
-{
- const struct rbcfg_value *v;
- uint32_t val;
- int err;
-
- err = rbcfg_get_u32(rbcfg_ctx, env->id, &val);
- if (err)
- return NULL;
-
- v = rbcfg_env_find_u32(env, val);
- if (v == NULL) {
- fprintf(stderr, "unknown value %08x found for %s\n",
- val, env->name);
- return NULL;
- }
-
- return v->name;
-}
-
-static int
-rbcfg_env_set_u32(const struct rbcfg_env *env, const char *data)
-{
- const struct rbcfg_value *v;
- int err;
-
- v = rbcfg_env_find(env, data);
- if (v == NULL) {
- fprintf(stderr, "invalid value '%s'\n", data);
- return RB_ERR_INVALID;
- }
-
- err = rbcfg_set_u32(rbcfg_ctx, env->id, v->val.u32);
- return err;
-}
-
-static const char *
-rbcfg_env_get(const struct rbcfg_env *env)
-{
- const char *ret = NULL;
-
- switch (env->type) {
- case RBCFG_ENV_TYPE_U32:
- ret = rbcfg_env_get_u32(env);
- break;
- }
-
- return ret;
-}
-
-static int
-rbcfg_env_set(const struct rbcfg_env *env, const char *data)
-{
- int ret = 0;
-
- switch (env->type) {
- case RBCFG_ENV_TYPE_U32:
- ret = rbcfg_env_set_u32(env, data);
- break;
- }
-
- return ret;
-}
-
-static int
-rbcfg_cmd_apply(int argc, const char *argv[])
-{
- return rbcfg_update(0);
-}
-
-static int
-rbcfg_cmd_help(int argc, const char *argv[])
-{
- usage();
- return 0;
-}
-
-static int
-rbcfg_cmd_get(int argc, const char *argv[])
-{
- int err = RB_ERR_NOTFOUND;
- int i;
-
- if (argc != 1) {
- usage();
- return RB_ERR_INVALID;
- }
-
- for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
- const struct rbcfg_env *env = &rbcfg_envs[i];
- const char *value;
-
- if (strcmp(env->name, argv[0]))
- continue;
-
- value = rbcfg_env_get(env);
- if (value) {
- fprintf(stdout, "%s\n", value);
- err = 0;
- }
- break;
- }
-
- return err;
-}
-
-static int
-rbcfg_cmd_set(int argc, const char *argv[])
-{
- int err = RB_ERR_INVALID;
- int i;
-
- if (argc != 2) {
- /* not enough parameters */
- usage();
- return RB_ERR_INVALID;
- }
-
- for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
- const struct rbcfg_env *env = &rbcfg_envs[i];
-
- if (strcmp(env->name, argv[0]))
- continue;
-
- err = rbcfg_env_set(env, argv[1]);
- if (err == 0)
- err = rbcfg_update(1);
- break;
- }
-
- return err;
-}
-
-static int
-rbcfg_cmd_show(int argc, const char *argv[])
-{
- int i;
-
- if (argc != 0) {
- usage();
- return RB_ERR_INVALID;
- }
-
- for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
- const struct rbcfg_env *env = &rbcfg_envs[i];
- const char *value;
-
- value = rbcfg_env_get(env);
- if (value)
- fprintf(stdout, "%s=%s\n", env->name, value);
- }
-
- return 0;
-}
-
-static const struct rbcfg_command rbcfg_commands[] = {
- {
- .command = "apply",
- .usage = "apply\n"
- "\t- write configuration to the mtd device",
- .flags = CMD_FLAG_USES_CFG,
- .exec = rbcfg_cmd_apply,
- }, {
- .command = "help",
- .usage = "help\n"
- "\t- show this screen",
- .exec = rbcfg_cmd_help,
- }, {
- .command = "get",
- .usage = "get <name>\n"
- "\t- get value of the configuration option <name>",
- .flags = CMD_FLAG_USES_CFG,
- .exec = rbcfg_cmd_get,
- }, {
- .command = "set",
- .usage = "set <name> <value>\n"
- "\t- set value of the configuration option <name> to <value>",
- .flags = CMD_FLAG_USES_CFG,
- .exec = rbcfg_cmd_set,
- }, {
- .command = "show",
- .usage = "show\n"
- "\t- show value of all configuration options",
- .flags = CMD_FLAG_USES_CFG,
- .exec = rbcfg_cmd_show,
- }
-};
-
-static void
-usage(void)
-{
- char buf[255];
- int len;
- int i;
-
- fprintf(stderr, "Usage: %s <command>\n", rbcfg_name);
-
- fprintf(stderr, "\nCommands:\n");
- for (i = 0; i < ARRAY_SIZE(rbcfg_commands); i++) {
- const struct rbcfg_command *cmd;
- cmd = &rbcfg_commands[i];
-
- len = snprintf(buf, sizeof(buf), "%s", cmd->usage);
- buf[len] = '\0';
- fprintf(stderr, "%s\n", buf);
- }
-
- fprintf(stderr, "\nConfiguration options:\n");
- for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
- const struct rbcfg_env *env;
- int j;
-
- env = &rbcfg_envs[i];
- fprintf(stderr, "\n%s:\n", env->name);
- for (j = 0; j < env->num_values; j++) {
- const struct rbcfg_value *v = &env->values[j];
- fprintf(stderr, "\t%-12s %s\n", v->name, v->desc);
- }
- }
- fprintf(stderr, "\n");
-}
-
-int main(int argc, const char *argv[])
-{
- const struct rbcfg_command *cmd = NULL;
- int ret;
- int i;
-
- rbcfg_name = (char *) argv[0];
-
- if (argc < 2) {
- usage();
- return EXIT_FAILURE;
- }
-
- for (i = 0; i < ARRAY_SIZE(rbcfg_commands); i++) {
- if (strcmp(rbcfg_commands[i].command, argv[1]) == 0) {
- cmd = &rbcfg_commands[i];
- break;
- }
- }
-
- if (cmd == NULL) {
- fprintf(stderr, "unknown command '%s'\n", argv[1]);
- usage();
- return EXIT_FAILURE;
- }
-
- argc -= 2;
- argv += 2;
-
- if (cmd->flags & CMD_FLAG_USES_CFG) {
- ret = rbcfg_open();
- if (ret)
- return EXIT_FAILURE;
- }
-
- ret = cmd->exec(argc, argv);
-
- if (cmd->flags & CMD_FLAG_USES_CFG)
- rbcfg_close();
-
- if (ret)
- return EXIT_FAILURE;
-
- return EXIT_SUCCESS;
-}
+++ /dev/null
-/*
- * Mikrotik's RouterBOOT configuration defines
- *
- * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _RBCFG_H
-#define _RBCFG_H
-
-/*
- * Magic numbers
- */
-#define RB_MAGIC_SOFT 0x74666f53 /* 'Soft' */
-
-/*
- * ID values for Software settings
- */
-#define RB_ID_TERMINATOR 0
-#define RB_ID_UART_SPEED 1
-#define RB_ID_BOOT_DELAY 2
-#define RB_ID_BOOT_DEVICE 3
-#define RB_ID_BOOT_KEY 4
-#define RB_ID_CPU_MODE 5
-#define RB_ID_FW_VERSION 6
-#define RB_ID_SOFT_07 7
-#define RB_ID_SOFT_08 8
-#define RB_ID_BOOT_PROTOCOL 9
-#define RB_ID_SOFT_10 10
-#define RB_ID_SOFT_11 11
-#define RB_ID_BOOTER 13
-
-#define RB_UART_SPEED_115200 0
-#define RB_UART_SPEED_57600 1
-#define RB_UART_SPEED_38400 2
-#define RB_UART_SPEED_19200 3
-#define RB_UART_SPEED_9600 4
-#define RB_UART_SPEED_4800 5
-#define RB_UART_SPEED_2400 6
-#define RB_UART_SPEED_1200 7
-#define RB_UART_SPEED_OFF 8
-
-#define RB_BOOT_DELAY_1SEC 1
-#define RB_BOOT_DELAY_2SEC 2
-#define RB_BOOT_DELAY_3SEC 3
-#define RB_BOOT_DELAY_4SEC 4
-#define RB_BOOT_DELAY_5SEC 5
-#define RB_BOOT_DELAY_6SEC 6
-#define RB_BOOT_DELAY_7SEC 7
-#define RB_BOOT_DELAY_8SEC 8
-#define RB_BOOT_DELAY_9SEC 9
-
-#define RB_BOOT_DEVICE_ETHER 0
-#define RB_BOOT_DEVICE_NANDETH 1
-#define RB_BOOT_DEVICE_CFCARD 2
-#define RB_BOOT_DEVICE_ETHONCE 3
-#define RB_BOOT_DEVICE_NANDONLY 5
-
-#define RB_BOOT_KEY_ANY 0
-#define RB_BOOT_KEY_DEL 1
-
-#define RB_CPU_MODE_POWERSAVE 0
-#define RB_CPU_MODE_REGULAR 1
-
-#define RB_BOOT_PROTOCOL_BOOTP 0
-#define RB_BOOT_PROTOCOL_DHCP 1
-
-#define RB_BOOTER_REGULAR 0
-#define RB_BOOTER_BACKUP 1
-
-#endif /* _RBCFG_H */
+++ /dev/null
-#
-# Copyright (C) 2006 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=yamonenv
-PKG_VERSION:=20051022
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)_gruen.4g__$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
-PKG_HASH:=466eca9cdad2c15e957fb9ce7d0b6927ecd17d85c4cc2dff37e97a3e6b209c67
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/yamonenv
- SECTION:=utils
- CATEGORY:=Utilities
- SUBMENU:=Boot Loaders
- DEPENDS:=@TARGET_au1000
- TITLE:=YAMON configuration utility
- URL:=http://meshcube.org/nylon/stable/sources/
- MAINTAINER:=Florian Fainelli <florian@openwrt.org>
-endef
-
-define Build/Configure
-endef
-
-define Package/yamonenv/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,yamonenv))
+++ /dev/null
---- a/src/yamonenv.c
-+++ b/src/yamonenv.c
-@@ -12,7 +12,7 @@
- #include <fcntl.h>
- #include <unistd.h>
-
--#define DEFAULT_YAMON_ENV_FILE "/dev/mtd/3"
-+#define DEFAULT_YAMON_ENV_FILE "/dev/mtd3"
-
-
- // control byte definitions:
+++ /dev/null
-#
-# Copyright (C) 2006-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=binutils
-PKG_VERSION:=2.27
-PKG_RELEASE:=1
-
-PKG_SOURCE_URL:=@GNU/binutils
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_VERSION:=$(PKG_VERSION)
-PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
-
-PKG_FIXUP:=autoreconf
-PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl
-PKG_REMOVE_FILES:=libtool.m4
-PKG_INSTALL:=1
-
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-PKG_LICENSE:=GPL-3.0+
-PKG_BUILD_PARALLEL:=1
-PKG_USE_MIPS16:=0
-
-include $(INCLUDE_DIR)/nls.mk
-include $(INCLUDE_DIR)/package.mk
-
-define Package/libbfd
- SECTION:=libs
- CATEGORY:=Libraries
- TITLE:=libbfd
- DEPENDS:=+zlib $(ICONV_DEPENDS) $(INTL_DEPENDS)
-endef
-
-define Package/libopcodes
- SECTION:=libs
- CATEGORY:=Libraries
- TITLE:=libbfd
- DEPENDS:=+libbfd
-endef
-
-define Package/binutils
- SECTION:=devel
- CATEGORY:=Development
- TITLE:=binutils
- DEPENDS:=+objdump +ar
-endef
-
-define Package/objdump
- SECTION:=devel
- CATEGORY:=Development
- TITLE:=objdump
- DEPENDS:=+libopcodes
-endef
-
-define Package/ar
- SECTION:=devel
- CATEGORY:=Development
- TITLE:=ar
- DEPENDS:=+zlib +libbfd
-endef
-
-define Package/binutils/description
- The Binutils package contains a linker, an assembler, and other tools for handling object files
-endef
-
-TARGET_CFLAGS += $(FPIC) -Wno-unused-value
-
-CONFIGURE_ARGS += \
- --host=$(REAL_GNU_TARGET_NAME) \
- --target=$(REAL_GNU_TARGET_NAME) \
- --enable-shared \
- --enable-install-libiberty \
- --enable-install-libbfd
-
-define Build/Install
- $(call Build/Install/Default)
- $(MAKE) -C $(PKG_BUILD_DIR)/libiberty \
- target_header_dir=libiberty \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- MULTIOSDIR="" \
- install
-endef
-
-define Build/InstallDev
- $(CP) $(PKG_INSTALL_DIR)/* $(1)/
-endef
-
-define Package/libbfd/install
- $(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/
-endef
-
-define Package/libopcodes/install
- $(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/
-endef
-
-define Package/objdump/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/objdump $(1)/usr/bin/
-endef
-
-define Package/ar/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/ar $(1)/usr/bin/
-endef
-
-define Package/binutils/install
- $(INSTALL_DIR) $(1)/usr $(1)/bin
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
- mv $(1)/usr/bin/strings $(1)/bin/strings
- rm -f $(1)/usr/bin/objdump
- rm -f $(1)/usr/bin/ar
-endef
-
-$(eval $(call BuildPackage,libbfd))
-$(eval $(call BuildPackage,libopcodes))
-$(eval $(call BuildPackage,binutils))
-$(eval $(call BuildPackage,objdump))
-$(eval $(call BuildPackage,ar))
+++ /dev/null
-From 183eb37e25d903ccd68cc2d8f8a37e75872c03d2 Mon Sep 17 00:00:00 2001
-From: Nick Clifton <nickc@redhat.com>
-Date: Tue, 6 Sep 2016 17:35:35 +0100
-Subject: [PATCH 1/2] Do not pass host compiler sanitization flags on to linker
- testsuite.
-
- * Makefile.am (CFLAGS_FOR_TARGET): Define as a copy of CFLAGS but
- without any sanitization options.
- (CXXFLAGS_FOR_TARGET): Define as a copy of CXXFLAGS but without
- any sanitization options.
- (check-DEJAGNU): Pass CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET
- as CFLAGS and CXXFLAGS respectively.
----
- ld/Makefile.am | 8 ++++++--
- ld/Makefile.in | 8 ++++++--
- 2 files changed, 12 insertions(+), 4 deletions(-)
-
---- a/ld/Makefile.am
-+++ b/ld/Makefile.am
-@@ -136,6 +136,10 @@ CXX_FOR_TARGET = ` \
- fi; \
- fi`
-
-+# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
-+CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-+CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-+
- transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
- bin_PROGRAMS = ld-new
- info_TEXINFOS = ld.texinfo
-@@ -2075,8 +2079,8 @@ check-DEJAGNU: site.exp
- runtest=$(RUNTEST); \
- if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
- $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
-- CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \
-- CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
-+ CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS_FOR_TARGET)" \
-+ CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
- CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
- OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
- LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
---- a/ld/Makefile.in
-+++ b/ld/Makefile.in
-@@ -507,6 +507,10 @@ CXX_FOR_TARGET = ` \
- fi; \
- fi`
-
-+
-+# Strip out sanitization options as they require special host libraries.
-+CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-+CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
- info_TEXINFOS = ld.texinfo
- ld_TEXINFOS = configdoc.texi
- noinst_TEXINFOS = ldint.texinfo
-@@ -3644,8 +3648,8 @@ check-DEJAGNU: site.exp
- runtest=$(RUNTEST); \
- if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
- $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
-- CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \
-- CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
-+ CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS_FOR_TARGET)" \
-+ CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
- CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
- OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
- LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
+++ /dev/null
-From b8ff24c72174effd5c5527866313982e28507275 Mon Sep 17 00:00:00 2001
-From: Vlad Zakharov <vzakhar@synopsys.com>
-Date: Mon, 26 Sep 2016 16:36:08 +0100
-Subject: [PATCH 2/2] When building target binaries, ensure that the warning
- flags selected for the command line match the target compiler.
-
-bfd * warning.m4 (AC_EGREP_CPP_FOR_BUILD): Introduce macro
- to verify CC_FOR_BUILD compiler.
- (AM_BINUTILS_WARNINGS): Introduce ac_cpp_for_build variable
- and add CC_FOR_BUILD compiler checks.
- * Makefile.in: Regenerate.
- * configure: Likewise.
- * doc/Makefile.in: Likewise.
-
-binutils * Makefile.am: Replace AM_CLFAGS with AM_CFLAGS_FOR_BUILD
- when building with CC_FOR_BUILD compiler.
- * Makefile.in: Regenerate.
- * configure: Likewise.
- * doc/Makefile.in: Likewise.
-
-gas * Makefile.in: Regenerate.
- * configure: Likewise.
- * doc/Makefile.in: Likewise.
-
-gold * Makefile.in: Regenerate.
- * configure: Likewise.
- * testsuite/Makefile.in: Likewise.
-
-gprof * Makefile.in: Regenerate.
- * configure: Likewise.
-
-ld * Makefile.in: Regenerate.
- * configure: Likewise.
-
-opcodes * Makefile.in: Regenerate.
- * configure: Likewise.
----
- bfd/Makefile.in | 1 +
- bfd/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
- bfd/doc/Makefile.in | 1 +
- bfd/warning.m4 | 47 ++++++++++++++++++++++++++++++++++----
- binutils/Makefile.am | 10 +++++----
- binutils/Makefile.in | 10 +++++----
- binutils/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
- binutils/doc/Makefile.in | 1 +
- gas/Makefile.in | 1 +
- gas/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
- gas/doc/Makefile.in | 1 +
- gold/Makefile.in | 5 +++--
- gold/configure | 52 ++++++++++++++++++++++++++++++++++++++----
- gold/testsuite/Makefile.in | 1 +
- gprof/Makefile.in | 1 +
- gprof/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
- ld/Makefile.in | 3 ++-
- ld/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
- opcodes/Makefile.in | 1 +
- opcodes/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
- 20 files changed, 416 insertions(+), 55 deletions(-)
-
---- a/bfd/Makefile.in
-+++ b/bfd/Makefile.in
-@@ -288,6 +288,7 @@ TDEFINES = @TDEFINES@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/bfd/configure
-+++ b/bfd/configure
-@@ -659,6 +659,7 @@ MAINTAINER_MODE_FALSE
- MAINTAINER_MODE_TRUE
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- REPORT_BUGS_TEXI
- REPORT_BUGS_TO
-@@ -11427,7 +11428,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11430 "configure"
-+#line 11431 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11533,7 +11534,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11536 "configure"
-+#line 11537 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -12240,8 +12241,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -12286,6 +12291,36 @@ fi
- rm -f conftest*
-
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
- enableval=$enable_werror; case "${enableval}" in
-@@ -12301,6 +12336,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -12314,25 +12350,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
- enableval=$enable_build_warnings; case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
-
-@@ -12343,6 +12386,7 @@ fi
-
-
-
-+
-
-
-
---- a/bfd/doc/Makefile.in
-+++ b/bfd/doc/Makefile.in
-@@ -248,6 +248,7 @@ TDEFINES = @TDEFINES@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/bfd/warning.m4
-+++ b/bfd/warning.m4
-@@ -17,12 +17,34 @@ dnl along with this program; see the fil
- dnl <http://www.gnu.org/licenses/>.
- dnl
-
-+# AC_EGREP_CPP_FOR_BUILD(PATTERN, PROGRAM,
-+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-+# ------------------------------------------------------
-+AC_DEFUN([AC_EGREP_CPP_FOR_BUILD],
-+[AC_LANG_PREPROC_REQUIRE()dnl
-+AC_REQUIRE([AC_PROG_EGREP])dnl
-+AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
-+AS_IF([dnl eval is necessary to expand ac_cpp.
-+dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
-+(eval "$ac_cpp_for_build conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
-+dnl Quote $1 to prevent m4 from eating character classes
-+ $EGREP "[$1]" >/dev/null 2>&1],
-+ [$3],
-+ [$4])
-+rm -f conftest*
-+])# AC_EGREP_CPP_FOR_BUILD
-+
-+
- AC_DEFUN([AM_BINUTILS_WARNINGS],[
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
-@@ -34,6 +56,14 @@ AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_W
- WARN_WRITE_STRINGS=""
- AC_EGREP_CPP([^[0-3]$],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-strings")
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+AC_EGREP_CPP_FOR_BUILD([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow")
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+AC_EGREP_CPP_FOR_BUILD([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144")
-+
- AC_ARG_ENABLE(werror,
- [ --enable-werror treat compile warnings as errors],
- [case "${enableval}" in
-@@ -47,6 +77,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -60,25 +91,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- AC_ARG_ENABLE(build-warnings,
- [ --enable-build-warnings enable build-time compiler warnings],
- [case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac])
-
- if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
-@@ -86,6 +124,7 @@ if test x"$silent" != x"yes" && test x"$
- fi
-
- AC_SUBST(WARN_CFLAGS)
-+AC_SUBST(WARN_CFLAGS_FOR_BUILD)
- AC_SUBST(NO_WERROR)
- AC_SUBST(WARN_WRITE_STRINGS)
- ])
---- a/binutils/Makefile.am
-+++ b/binutils/Makefile.am
-@@ -47,8 +47,10 @@ ZLIB = @zlibdir@ -lz
- ZLIBINC = @zlibinc@
-
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- NO_WERROR = @NO_WERROR@
- AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
- LIBICONV = @LIBICONV@
-
- # these two are almost the same program
-@@ -305,17 +307,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
- $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
-
- syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
-- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
-+ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
-
- sysinfo.@OBJEXT@: sysinfo.c
- if [ -r sysinfo.c ]; then \
-- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
-+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
- else \
-- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
-+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
- fi
-
- bin2c$(EXEEXT_FOR_BUILD): bin2c.c
-- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
-+ $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
-
- embedspu: embedspu.sh Makefile
- awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
---- a/binutils/Makefile.in
-+++ b/binutils/Makefile.in
-@@ -401,6 +401,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
-@@ -478,6 +479,7 @@ am__skipyacc =
- ZLIB = @zlibdir@ -lz
- ZLIBINC = @zlibinc@
- AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
-
- # these two are almost the same program
- AR_PROG = ar
-@@ -1370,17 +1372,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
- $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
-
- syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
-- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
-+ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
-
- sysinfo.@OBJEXT@: sysinfo.c
- if [ -r sysinfo.c ]; then \
-- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
-+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
- else \
-- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
-+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
- fi
-
- bin2c$(EXEEXT_FOR_BUILD): bin2c.c
-- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
-+ $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
-
- embedspu: embedspu.sh Makefile
- awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
---- a/binutils/configure
-+++ b/binutils/configure
-@@ -652,6 +652,7 @@ YFLAGS
- YACC
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- OTOOL64
- OTOOL
-@@ -11225,7 +11226,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11228 "configure"
-+#line 11229 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11331,7 +11332,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11334 "configure"
-+#line 11335 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11945,8 +11946,12 @@ _ACEOF
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -11991,6 +11996,36 @@ fi
- rm -f conftest*
-
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
- enableval=$enable_werror; case "${enableval}" in
-@@ -12006,6 +12041,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -12019,25 +12055,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
- enableval=$enable_build_warnings; case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
-
-@@ -12048,6 +12091,7 @@ fi
-
-
-
-+
-
-
-
---- a/binutils/doc/Makefile.in
-+++ b/binutils/doc/Makefile.in
-@@ -249,6 +249,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = @YACC@
---- a/gas/Makefile.in
-+++ b/gas/Makefile.in
-@@ -255,6 +255,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@ @WARN_WRITE_STRINGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi`
---- a/gas/configure
-+++ b/gas/configure
-@@ -642,6 +642,7 @@ cgen_cpu_prefix
- GDBINIT
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- OTOOL64
- OTOOL
-@@ -10985,7 +10986,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 10988 "configure"
-+#line 10989 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11091,7 +11092,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11094 "configure"
-+#line 11095 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11721,8 +11722,12 @@ using_cgen=no
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -11767,6 +11772,36 @@ fi
- rm -f conftest*
-
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
- enableval=$enable_werror; case "${enableval}" in
-@@ -11782,6 +11817,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -11795,25 +11831,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
- enableval=$enable_build_warnings; case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
-
-@@ -11824,6 +11867,7 @@ fi
-
-
-
-+
-
-
-
---- a/gas/doc/Makefile.in
-+++ b/gas/doc/Makefile.in
-@@ -230,6 +230,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = @YACC@
---- a/gold/Makefile.in
-+++ b/gold/Makefile.in
-@@ -87,8 +87,8 @@ subdir = .
- DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
- $(srcdir)/Makefile.am $(top_srcdir)/configure \
- $(am__configure_deps) $(srcdir)/config.in \
-- $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in \
-- ftruncate.c pread.c mremap.c ffsll.c yyscript.h yyscript.c \
-+ $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in ffsll.c \
-+ mremap.c ftruncate.c pread.c yyscript.h yyscript.c \
- $(srcdir)/../depcomp $(srcdir)/../ylwrap
- ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
- am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
-@@ -409,6 +409,7 @@ TARGETOBJS = @TARGETOBJS@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_CXXFLAGS = @WARN_CXXFLAGS@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
---- a/gold/configure
-+++ b/gold/configure
-@@ -609,6 +609,7 @@ GOLD_LDFLAGS
- WARN_CXXFLAGS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- IFUNC_STATIC_FALSE
- IFUNC_STATIC_TRUE
-@@ -6723,8 +6724,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -6769,6 +6774,36 @@ fi
- rm -f conftest*
-
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
- enableval=$enable_werror; case "${enableval}" in
-@@ -6784,6 +6819,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -6797,25 +6833,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
- enableval=$enable_build_warnings; case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
-
-@@ -6826,6 +6869,7 @@ fi
-
-
-
-+
-
-
-
---- a/gold/testsuite/Makefile.in
-+++ b/gold/testsuite/Makefile.in
-@@ -2568,6 +2568,7 @@ TARGETOBJS = @TARGETOBJS@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_CXXFLAGS = @WARN_CXXFLAGS@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
---- a/gprof/Makefile.in
-+++ b/gprof/Makefile.in
-@@ -267,6 +267,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/gprof/configure
-+++ b/gprof/configure
-@@ -604,6 +604,7 @@ LTLIBOBJS
- LIBOBJS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- GENINSRC_NEVER_FALSE
- GENINSRC_NEVER_TRUE
-@@ -10901,7 +10902,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 10904 "configure"
-+#line 10905 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11007,7 +11008,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11010 "configure"
-+#line 11011 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -12101,8 +12102,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -12147,6 +12152,36 @@ fi
- rm -f conftest*
-
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
- enableval=$enable_werror; case "${enableval}" in
-@@ -12162,6 +12197,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -12175,25 +12211,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
- enableval=$enable_build_warnings; case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
-
-@@ -12204,6 +12247,7 @@ fi
-
-
-
-+
-
-
-
---- a/ld/Makefile.in
-+++ b/ld/Makefile.in
-@@ -354,6 +354,7 @@ TESTBFDLIB = @TESTBFDLIB@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
-@@ -508,7 +509,7 @@ CXX_FOR_TARGET = ` \
- fi`
-
-
--# Strip out sanitization options as they require special host libraries.
-+# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
- CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
- CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
- info_TEXINFOS = ld.texinfo
---- a/ld/configure
-+++ b/ld/configure
-@@ -646,6 +646,7 @@ LIBINTL
- USE_NLS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- installed_linker
- install_as_default
-@@ -11723,7 +11724,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11726 "configure"
-+#line 11727 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11829,7 +11830,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11832 "configure"
-+#line 11833 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -15558,8 +15559,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -15604,6 +15609,36 @@ fi
- rm -f conftest*
-
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
- enableval=$enable_werror; case "${enableval}" in
-@@ -15619,6 +15654,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -15632,25 +15668,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
- enableval=$enable_build_warnings; case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
-
-@@ -15661,6 +15704,7 @@ fi
-
-
-
-+
-
-
-
---- a/opcodes/Makefile.in
-+++ b/opcodes/Makefile.in
-@@ -267,6 +267,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/opcodes/configure
-+++ b/opcodes/configure
-@@ -643,6 +643,7 @@ MAINTAINER_MODE_TRUE
- NO_WMISSING_FIELD_INITIALIZERS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- OTOOL64
- OTOOL
-@@ -11150,7 +11151,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11153 "configure"
-+#line 11154 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11256,7 +11257,7 @@ else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
--#line 11259 "configure"
-+#line 11260 "configure"
- #include "confdefs.h"
-
- #if HAVE_DLFCN_H
-@@ -11508,8 +11509,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
-
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -11554,6 +11559,36 @@ fi
- rm -f conftest*
-
-
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h. */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
- enableval=$enable_werror; case "${enableval}" in
-@@ -11569,6 +11604,7 @@ case "${host}" in
- *-*-mingw32*)
- if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
- fi
- ;;
- *) ;;
-@@ -11582,25 +11618,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
- NO_WERROR="-Wno-error"
- fi
-
- if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
-
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
- enableval=$enable_build_warnings; case "${enableval}" in
-- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
-+ WARN_CFLAGS_FOR_BUILD="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
-- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
-- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
-
-@@ -11611,6 +11654,7 @@ fi
-
-
-
-+
-
-
- ac_ext=c
+++ /dev/null
-#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=gdb-arc
-PKG_VERSION:=arc-2016.03-gdb
-PKG_RELEASE:=1
-
-PKG_SOURCE:=gdb-arc-2016.03-gdb.tar.gz
-PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_VERSION)
-PKG_HASH:=6a91f86cc487c1548d3f5d4f29f7226d2019c0db8a63633aeabd5914a340f3f9
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/binutils-gdb-arc-2016.03-gdb
-
-PKG_BUILD_PARALLEL:=1
-PKG_INSTALL:=1
-PKG_LICENSE:=GPL-3.0+
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/gdb-arc/Default
- SECTION:=devel
- CATEGORY:=Development
- DEPENDS:=+!USE_MUSL:libthread-db +PACKAGE_zlib:zlib @arc
- URL:=http://www.gnu.org/software/gdb/
-endef
-
-define Package/gdb-arc
-$(call Package/gdb-arc/Default)
- TITLE:=GNU Debugger for ARC
- DEPENDS+=+libreadline +libncurses +zlib
-endef
-
-define Package/gdb-arc/description
-GDB, the GNU Project debugger, allows you to see what is going on `inside'
-another program while it executes -- or what another program was doing at the
-moment it crashed.
-endef
-
-define Package/gdbserver-arc
-$(call Package/gdb-arc/Default)
- TITLE:=Remote server for GNU Debugger
-endef
-
-define Package/gdbserver-arc/description
-GDBSERVER is a program that allows you to run GDB on a different machine than the
-one which is running the program being debugged.
-endef
-
-# XXX: add --disable-werror to prevent build failure with arm
-CONFIGURE_ARGS+= \
- --with-system-readline \
- --without-expat \
- --without-lzma \
- --disable-werror \
- --disable-binutils \
- --disable-ld \
- --disable-gas \
- --disable-sim
-
-CONFIGURE_VARS+= \
- ac_cv_search_tgetent="$(TARGET_LDFLAGS) -lncurses -lreadline"
-
-define Build/Compile
- +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- CPPFLAGS="$(TARGET_CPPFLAGS)" \
- all
-endef
-
-define Build/Install
- $(MAKE) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- CPPFLAGS="$(TARGET_CPPFLAGS)" \
- install-gdb
-endef
-
-define Package/gdb-arc/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdb $(1)/usr/bin/
-endef
-
-define Package/gdbserver-arc/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,gdb-arc))
-$(eval $(call BuildPackage,gdbserver-arc))
+++ /dev/null
---- a/sim/common/sim-arange.c
-+++ b/sim/common/sim-arange.c
-@@ -280,11 +280,7 @@ sim_addr_range_delete (ADDR_RANGE *ar, a
- build_search_tree (ar);
- }
-
--#endif /* DEFINE_NON_INLINE_P */
--
--#if DEFINE_INLINE_P
--
--SIM_ARANGE_INLINE int
-+int
- sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
- {
- ADDR_RANGE_TREE *t = ar->range_tree;
-@@ -301,4 +297,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, ad
- return 0;
- }
-
--#endif /* DEFINE_INLINE_P */
-+#endif /* DEFINE_NON_INLINE_P */
---- a/sim/common/sim-arange.h
-+++ b/sim/common/sim-arange.h
-@@ -73,7 +73,7 @@ extern void sim_addr_range_delete (ADDR_
-
- /* Return non-zero if ADDR is in range AR, traversing the entire tree.
- If no range is specified, that is defined to mean "everything". */
--SIM_ARANGE_INLINE int
-+extern int
- sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
- #define ADDR_RANGE_HIT_P(ar, addr) \
- ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
+++ /dev/null
---- a/gdb/configure
-+++ b/gdb/configure
-@@ -870,8 +870,7 @@ MAKEINFOFLAGS
- YACC
- YFLAGS
- XMKMF'
--ac_subdirs_all='testsuite
--gdbtk
-+ac_subdirs_all='gdbtk
- multi-ice
- gdbserver'
-
-@@ -5610,7 +5610,7 @@ $as_echo "$with_auto_load_safe_path" >&6
-
-
-
--subdirs="$subdirs testsuite"
-+subdirs="$subdirs"
-
-
- # Check whether to support alternative target configurations
+++ /dev/null
---- a/gdb/gdbserver/configure
-+++ b/gdb/gdbserver/configure
-@@ -2468,7 +2468,7 @@ $as_echo "$as_me: error: \`$ac_var' was
- ac_cache_corrupted=: ;;
- ,);;
- *)
-- if test "x$ac_old_val" != "x$ac_new_val"; then
-+ if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
- # differences in whitespace do not lead to failure.
- ac_old_val_w=`echo x $ac_old_val`
- ac_new_val_w=`echo x $ac_new_val`
+++ /dev/null
-#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=gdb
-PKG_VERSION:=7.11.1
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@GNU/gdb
-PKG_HASH:=e9216da4e3755e9f414c1aa0026b626251dfc57ffe572a266e98da4f6988fc70
-
-PKG_BUILD_PARALLEL:=1
-PKG_INSTALL:=1
-PKG_LICENSE:=GPL-3.0+
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/gdb/Default
- SECTION:=devel
- CATEGORY:=Development
- DEPENDS:=+!USE_MUSL:libthread-db +PACKAGE_zlib:zlib @!arc
- URL:=http://www.gnu.org/software/gdb/
-endef
-
-define Package/gdb
-$(call Package/gdb/Default)
- TITLE:=GNU Debugger
- DEPENDS+=+libreadline +libncurses +zlib
-endef
-
-define Package/gdb/description
-GDB, the GNU Project debugger, allows you to see what is going on `inside'
-another program while it executes -- or what another program was doing at the
-moment it crashed.
-endef
-
-define Package/gdbserver
-$(call Package/gdb/Default)
- TITLE:=Remote server for GNU Debugger
-endef
-
-define Package/gdbserver/description
-GDBSERVER is a program that allows you to run GDB on a different machine than the
-one which is running the program being debugged.
-endef
-
-# XXX: add --disable-werror to prevent build failure with arm
-CONFIGURE_ARGS+= \
- --with-system-readline \
- --without-expat \
- --without-lzma \
- --disable-werror
-
-CONFIGURE_VARS+= \
- ac_cv_search_tgetent="$(TARGET_LDFLAGS) -lncurses -lreadline"
-
-define Build/Compile
- +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- CPPFLAGS="$(TARGET_CPPFLAGS)" \
- all
-endef
-
-define Build/Install
- $(MAKE) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- CPPFLAGS="$(TARGET_CPPFLAGS)" \
- install-gdb
-endef
-
-define Package/gdb/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdb $(1)/usr/bin/
-endef
-
-define Package/gdbserver/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,gdb))
-$(eval $(call BuildPackage,gdbserver))
+++ /dev/null
-See http://sourceware.org/bugzilla/show_bug.cgi?id=14523
----
---- a/gdb/common/signals.c
-+++ b/gdb/common/signals.c
-@@ -344,6 +344,11 @@ gdb_signal_from_host (int hostsig)
- else if (64 <= hostsig && hostsig <= 127)
- return (enum gdb_signal)
- (hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64);
-+ else if (hostsig == 128)
-+ /* Some platforms, such as Linux MIPS, have NSIG == 128, in which case
-+ signal 128 is the highest realtime signal. There is no constant for
-+ that though. */
-+ return GDB_SIGNAL_UNKNOWN;
- else
- error (_("GDB bug: target.c (gdb_signal_from_host): "
- "unrecognized real-time signal"));
+++ /dev/null
---- a/gdb/linux-nat.c
-+++ b/gdb/linux-nat.c
-@@ -17,6 +17,7 @@
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-+#include "stopcode.h"
- #include "defs.h"
- #include "inferior.h"
- #include "infrun.h"
-@@ -71,6 +72,10 @@
- #define SPUFS_MAGIC 0x23c9b64e
- #endif
-
-+#ifndef __SIGRTMIN
-+#define __SIGRTMIN SIGRTMIN
-+#endif
-+
- /* This comment documents high-level logic of this file.
-
- Waiting for events in sync mode
---- /dev/null
-+++ b/gdb/stopcode.h
-@@ -0,0 +1,4 @@
-+#ifndef W_STOPCODE
-+#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
-+#endif
-+
---- a/gdb/nat/ppc-linux.h
-+++ b/gdb/nat/ppc-linux.h
-@@ -18,7 +18,10 @@
- #ifndef PPC_LINUX_H
- #define PPC_LINUX_H 1
-
-+#define pt_regs __pt_regs
- #include <asm/ptrace.h>
-+#undef pt_regs
-+
- #include <asm/cputable.h>
-
- /* This sometimes isn't defined. */
---- a/gdb/gdbserver/linux-ppc-low.c
-+++ b/gdb/gdbserver/linux-ppc-low.c
-@@ -21,7 +21,9 @@
- #include "linux-low.h"
-
- #include <elf.h>
-+#define pt_regs __pt_regs
- #include <asm/ptrace.h>
-+#undef pt_regs
-
- #include "nat/ppc-linux.h"
-
+++ /dev/null
-#
-# Copyright (C) 2011-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=perf
-PKG_VERSION:=$(LINUX_VERSION)
-PKG_RELEASE:=2
-
-PKG_USE_MIPS16:=0
-PKG_BUILD_PARALLEL:=1
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-PKG_FLAGS:=nonshared
-
-# Perf's makefile and headers are not relocatable and must be built from the
-# Linux sources directory
-PKG_BUILD_DIR:=$(LINUX_DIR)/tools/perf-$(TARGET_DIR_NAME)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/perf
- SECTION:=devel
- CATEGORY:=Development
- DEPENDS:= +libelf1 +libdw +libpthread +librt +objdump @!LINUX_3_18 @!IN_SDK
- TITLE:=Linux performance monitoring tool
- VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
- URL:=http://www.kernel.org
-endef
-
-define Package/perf/description
- perf is the Linux performance monitoring tool
-endef
-
-define Build/Prepare
- $(CP) $(LINUX_DIR)/tools/perf/* $(PKG_BUILD_DIR)/
-endef
-
-MAKE_FLAGS = \
- ARCH="$(LINUX_KARCH)" \
- NO_LIBPERL=1 \
- NO_LIBPYTHON=1 \
- NO_NEWT=1 \
- NO_LZMA=1 \
- NO_BACKTRACE=1 \
- NO_LIBNUMA=1 \
- NO_GTK2=1 \
- NO_LIBAUDIT=1 \
- NO_LIBCRYPTO=1 \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- CC="$(TARGET_CC)" \
- LD="$(TARGET_CROSS)ld" \
- CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
- $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
- WERROR=0 \
- prefix=/usr
-
-ifdef CONFIG_USE_MUSL
- MAKE_FLAGS += EXTRA_CFLAGS="-I$(CURDIR)/musl-include -include $(CURDIR)/musl-compat.h -D__UCLIBC__"
-endif
-
-define Build/Compile
- +$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \
- -C $(PKG_BUILD_DIR) \
- -f Makefile.perf \
- --no-print-directory
-endef
-
-define Package/perf/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/perf $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,perf))
+++ /dev/null
-#ifndef __PERF_MUSL_COMPAT_H
-#define __PERF_MUSL_COMPAT_H
-
-#ifndef __ASSEMBLER__
-
-#include <sys/ioctl.h>
-#include <asm/unistd.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#undef _IOWR
-#undef _IOR
-#undef _IOW
-#undef _IOC
-#undef _IO
-
-#define _SC_LEVEL1_DCACHE_LINESIZE -1
-
-static inline long sysconf_wrap(int name)
-{
- FILE *f;
- int val;
-
- switch (name) {
- case _SC_LEVEL1_DCACHE_LINESIZE:
- f = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r");
- if (!f)
- return 0;
-
- if (fscanf(f, "%d", &val) != 1)
- return 0;
-
- fclose(f);
- return val;
- default:
- return sysconf(name);
- }
-}
-
-#define sysconf(_n) sysconf_wrap(_n)
-
-#endif
-#endif
+++ /dev/null
-#ifndef __MUSL_COMPAT_ASM_ERRNO_H
-#define __MUSL_COMPAT_ASM_ERRNO_H
-
-/* Avoid including different versions of errno.h, the defines (incorrectly)
- * cause a redefinition error on PowerPC */
-#include <errno.h>
-
-#endif
+++ /dev/null
-#ifndef __MUSL_COMPAT_STRING_H
-#define __MUSL_COMPAT_STRING_H
-
-#include_next <string.h>
-
-/* Change XSI compliant version into GNU extension hackery */
-static inline char *
-gnu_strerror_r(int err, char *buf, size_t buflen)
-{
- if (strerror_r(err, buf, buflen))
- return NULL;
- return buf;
-}
-#ifdef _GNU_SOURCE
-#define strerror_r gnu_strerror_r
-#endif
-
-#endif
+++ /dev/null
-#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=strace
-
-PKG_VERSION:=4.15
-PKG_RELEASE:=1
-PKG_HASH:=c0cdc094d6141fd9dbf6aaad605142d651ae10998b660fda57fc61f7ad583ca9
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@SF/$(PKG_NAME)
-
-PKG_LICENSE:=BSD-3c
-PKG_LICENSE_FILES:=COPYRIGHT
-
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-
-PKG_FIXUP:=autoreconf
-PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_strace_libunwind
-PKG_INSTALL:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-HOST_CFLAGS += -I$(LINUX_DIR)/user_headers/include
-
-CONFIGURE_VARS+= \
- LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
- CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
- CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
- CC_FOR_BUILD="$(HOST_CC)"
-
-define Package/strace
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=System call tracer
- DEPENDS:=+PACKAGE_strace_libunwind:libunwind
- URL:=http://strace.sourceforge.net/
-endef
-
-define Package/strace/description
-A useful diagnostic, instructional, and debugging tool. Allows you to track what
-system calls a program makes while it is running.
-endef
-
-define Package/strace/config
-config PACKAGE_strace_libunwind
- bool "Enable stack tracing support using libunwind (experimental)"
- default n
-endef
-
-CONFIGURE_ARGS += --with-libunwind=$(if $(CONFIG_PACKAGE_strace_libunwind),yes,no)
-MAKE_FLAGS := \
- CCOPT="$(TARGET_CFLAGS)"
-
-define Package/strace/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/strace $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,strace))
+++ /dev/null
---- a/ptrace.h
-+++ b/ptrace.h
-@@ -55,7 +55,14 @@ extern long ptrace(int, int, char *, lon
- # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
- #endif
-
-+#if POWERPC
-+#include <linux/types.h>
-+#define __ASSEMBLY__
-+#endif
- #include <linux/ptrace.h>
-+#if POWERPC
-+#undef __ASSEMBLY__
-+#endif
-
- #ifdef HAVE_STRUCT_IA64_FPREG
- # undef ia64_fpreg
+++ /dev/null
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=trace-cmd
-PKG_VERSION:=v2.6
-PKG_RELEASE=1
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=\
- https://kernel.googlesource.com/pub/scm/linux/kernel/git/rostedt/trace-cmd \
- https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
-PKG_SOURCE_VERSION:=9be5d74805830a291615f2f34a27c903f6a37b1e
-PKG_MIRROR_HASH:=735b69f61a8c627037dcc01361cdb8415e5ab0ec892fbd731236c444003b0c71
-PKG_INSTALL:=1
-PKG_USE_MIPS16:=0
-PKG_LICENSE:=GPL-2.0
-
-PKG_BUILD_PARALLEL:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/trace-cmd
- SECTION:=devel
- CATEGORY:=Development
- TITLE:=Linux trace command line utility
- DEPENDS:=
-endef
-
-define Package/trace-cmd-extra
- SECTION:=devel
- CATEGORY:=Development
- TITLE:=Extra plugins for trace-cmd
- DEPENDS:=
-endef
-
-MAKE_FLAGS += \
- NO_PYTHON=1 \
- prefix=/usr
-
-PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/trace-cmd/plugins
-PLUGINS_MAIN := function hrtimer mac80211 sched_switch
-
-TARGET_CFLAGS += --std=gnu99 -D_GNU_SOURCE
-
-define Package/trace-cmd/install
- $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/trace-cmd/plugins
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/trace-cmd $(1)/usr/bin/
- $(CP) \
- $(patsubst %,$(PLUGINS_DIR)/plugin_%.so,$(PLUGINS_MAIN)) \
- $(1)/usr/lib/trace-cmd/plugins
-endef
-
-define Package/trace-cmd-extra/install
- $(INSTALL_DIR) $(1)/usr/lib/trace-cmd/plugins
- $(CP) \
- $$(patsubst %,$(PLUGINS_DIR)/plugin_%.so, \
- $$(filter-out $(PLUGINS_MAIN), \
- $$(patsubst $(PLUGINS_DIR)/plugin_%.so,%, \
- $$(wildcard $(PLUGINS_DIR)/plugin_*.so)))) \
- $(1)/usr/lib/trace-cmd/plugins
-endef
-
-$(eval $(call BuildPackage,trace-cmd))
-$(eval $(call BuildPackage,trace-cmd-extra))
+++ /dev/null
---- a/plugin_mac80211.c
-+++ b/plugin_mac80211.c
-@@ -179,12 +179,15 @@ static int drv_config(struct trace_seq *
- { 2, "IDLE" },
- { 3, "QOS"},
- );
-- pevent_print_num_field(s, " chan:%d/", event, "center_freq", record, 1);
-- print_enum(s, event, "channel_type", data,
-- { 0, "noht" },
-- { 1, "ht20" },
-- { 2, "ht40-" },
-- { 3, "ht40+" });
-+ pevent_print_num_field(s, " chan:%d@", event, "control_freq", record, 1);
-+ print_enum(s, event, "chan_width", data,
-+ { 0, "20_noht" },
-+ { 1, "20" },
-+ { 2, "40" },
-+ { 3, "80" },
-+ { 4, "80p80" },
-+ { 5, "160" });
-+
- trace_seq_putc(s, ' ');
- SF("power_level");
-
+++ /dev/null
-#
-# Copyright (C) 2006-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=valgrind
-PKG_VERSION:=3.12.0
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://valgrind.org/downloads/
-PKG_HASH:=67ca4395b2527247780f36148b084f5743a68ab0c850cb43e4a5b4b012cf76a1
-
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-PKG_LICENSE:=GPL-2.0+
-
-PKG_FIXUP = autoreconf
-PKG_INSTALL := 1
-PKG_BUILD_PARALLEL := 1
-PKG_USE_MIPS16:=0
-PKG_SSP:=0
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-define Package/valgrind
- SECTION:=devel
- CATEGORY:=Development
- DEPENDS:=@mips||mipsel||i386||x86_64||powerpc||arm_v7 +libpthread +librt
- TITLE:=debugging and profiling tools for Linux
- URL:=http://www.valgrind.org
-endef
-
-define Package/valgrind/default
- $(Package/valgrind)
- DEPENDS := valgrind
-endef
-
-define Package/valgrind-cachegrind
- $(Package/valgrind/default)
- TITLE += (cache profiling)
-endef
-
-define Package/valgrind-callgrind
- $(Package/valgrind/default)
- TITLE += (callgraph profiling)
-endef
-
-define Package/valgrind-drd
- $(Package/valgrind/default)
- TITLE += (thread error detection)
-endef
-
-define Package/valgrind-massif
- $(Package/valgrind/default)
- TITLE += (heap profiling)
-endef
-
-define Package/valgrind-helgrind
- $(Package/valgrind/default)
- TITLE += (thread debugging)
-endef
-
-define Package/valgrind-vgdb
- $(Package/valgrind/default)
- TITLE += (GDB interface)
-endef
-
-define Package/valgrind/description
- Valgrind is an award-winning suite of tools for debugging and
- profiling Linux programs. With the tools that come with Valgrind,
- you can automatically detect many memory management and threading
- bugs, avoiding hours of frustrating bug-hunting, making your
- programs more stable. You can also perform detailed profiling,
- to speed up and reduce memory use of your programs.
-endef
-
-CPU := $(patsubst x86_64,amd64,$(patsubst x86,i386,$(patsubst um,$(ARCH),$(LINUX_KARCH))))
-
-CONFIGURE_VARS += \
- UNAME_R=$(LINUX_VERSION)
-
-ifeq ($(ARCH),x86_64)
- CONFIGURE_ARGS += \
- --enable-only64bit
- BITS := 64bit
-else
- CONFIGURE_ARGS += \
- --enable-only32bit
- BITS := 32bit
-endif
-
-CONFIGURE_ARGS += \
- --enable-tls \
- --without-x \
- --without-mpicc \
- --without-uiout \
- --disable-valgrindmi \
- --disable-tui \
- --disable-valgrindtk \
- --without-included-gettext \
- --with-pagesize=4 \
-
-define Package/valgrind/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/valgrind* $(1)/usr/bin/
- $(INSTALL_DIR) $(1)/usr/lib/valgrind
- $(CP) \
- ./files/default.supp \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_core*.so \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(CPU)-*.xml \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-core*.xml \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-linux*.xml \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-* \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_memcheck*.so \
- $(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-cachegrind/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cg_* $(1)/usr/bin/
- $(INSTALL_DIR) $(1)/usr/lib/valgrind
- $(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-* \
- $(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-callgrind/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/callgrind* $(1)/usr/bin/
- $(INSTALL_DIR) $(1)/usr/lib/valgrind
- $(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-* \
- $(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-drd/install
- $(INSTALL_DIR) $(1)/usr/lib/valgrind
- $(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-* \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_drd*.so \
- $(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-massif/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ms_print $(1)/usr/bin/
- $(INSTALL_DIR) $(1)/usr/lib/valgrind
- $(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-* \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_massif*.so \
- $(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-helgrind/install
- $(INSTALL_DIR) $(1)/usr/lib/valgrind
- $(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-* \
- $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_helgrind*.so \
- $(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-vgdb/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgdb $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,valgrind))
-$(eval $(call BuildPackage,valgrind-cachegrind))
-$(eval $(call BuildPackage,valgrind-callgrind))
-$(eval $(call BuildPackage,valgrind-drd))
-$(eval $(call BuildPackage,valgrind-massif))
-$(eval $(call BuildPackage,valgrind-helgrind))
-$(eval $(call BuildPackage,valgrind-vgdb))
+++ /dev/null
-{
- ld(Addr1)
- Memcheck:Addr1
- fun:*
- obj:/lib/ld-*
-}
-{
- ld(Addr2)
- Memcheck:Addr2
- fun:*
- obj:/lib/ld-*
-}
-{
- ld(Addr4)
- Memcheck:Addr4
- fun:*
- obj:/lib/ld-*
-}
-{
- ld(Cond)
- Memcheck:Cond
- fun:*
- obj:/lib/ld-*
-}
-{
- strlen(Cond)
- Memcheck:Cond
- fun:strlen
- fun:*
-}
-{
- strnlen(Cond)
- Memcheck:Cond
- fun:strnlen
- fun:*
-}
-{
- index(Cond)
- Memcheck:Cond
- fun:index
- fun:*
-}
+++ /dev/null
---- a/configure.ac
-+++ b/configure.ac
-@@ -328,7 +328,7 @@ case "${host_os}" in
- # Ok, this is linux. Check the kernel version
- AC_MSG_CHECKING([for the kernel version])
-
-- kernel=`uname -r`
-+ kernel=${UNAME_R:-`uname -r`}
-
- case "${kernel}" in
- 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
+++ /dev/null
-Description: Fix FTBFS on armhf by correctly detecting the architecture
-Origin: vendor
-Bug-Debian: http://bugs.debian.org/730844
-Author: Alessandro Ghedini <ghedo@debian.org>
-Last-Update: 2013-11-30
-
---- a/configure.ac
-+++ b/configure.ac
-@@ -234,7 +234,7 @@ case "${host_cpu}" in
- ARCH_MAX="s390x"
- ;;
-
-- armv7*)
-+ arm*)
- AC_MSG_RESULT([ok (${host_cpu})])
- ARCH_MAX="arm"
- ;;
+++ /dev/null
---- a/coregrind/vg_preloaded.c
-+++ b/coregrind/vg_preloaded.c
-@@ -57,7 +57,7 @@
- void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run);
- void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run)
- {
--# if !defined(__UCLIBC__) \
-+# if !defined(__UCLIBC__) && defined(__GLIBC__) \
- && !defined(VGPV_arm_linux_android) \
- && !defined(VGPV_x86_linux_android) \
- && !defined(VGPV_mips32_linux_android) \
---- a/include/pub_tool_redir.h
-+++ b/include/pub_tool_redir.h
-@@ -243,7 +243,7 @@
- /* --- Soname of the standard C library. --- */
-
- #if defined(VGO_linux) || defined(VGO_solaris)
--# define VG_Z_LIBC_SONAME libcZdsoZa // libc.so*
-+# define VG_Z_LIBC_SONAME libcZdZa // libc.*
-
- #elif defined(VGO_darwin) && (DARWIN_VERS <= DARWIN_10_6)
- # define VG_Z_LIBC_SONAME libSystemZdZaZddylib // libSystem.*.dylib
-@@ -275,7 +275,11 @@
- /* --- Soname of the pthreads library. --- */
-
- #if defined(VGO_linux)
-+# if defined(__GLIBC__) || defined(__UCLIBC__)
- # define VG_Z_LIBPTHREAD_SONAME libpthreadZdsoZd0 // libpthread.so.0
-+# else
-+# define VG_Z_LIBPTHREAD_SONAME libcZdZa // libc.*
-+# endif
- #elif defined(VGO_darwin)
- # define VG_Z_LIBPTHREAD_SONAME libSystemZdZaZddylib // libSystem.*.dylib
- #elif defined(VGO_solaris)
---- a/configure.ac
-+++ b/configure.ac
-@@ -1047,8 +1047,6 @@ case "${GLIBC_VERSION}" in
- ;;
- 2.0|2.1|*)
- AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
-- AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
-- AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
- ;;
- esac
-
+++ /dev/null
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=hwmon-gsc
-PKG_RELEASE:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/hwmon-gsc
- SUBMENU:=Hardware Monitoring Support
- DEPENDS:=@TARGET_imx6||TARGET_cns3xxx kmod-hwmon-core +kmod-i2c-core
- TITLE:=Driver for the Gateworks System Controller
- AUTOLOAD:=$(call AutoLoad,60,gsc)
- FILES:=$(PKG_BUILD_DIR)/gsc.ko
-endef
-
-define KernelPackage/hwmon-gsc/description
- Kernel module for the Gateworks System Controller chips.
-endef
-
-define Build/Compile
- $(MAKE) -C "$(LINUX_DIR)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- ARCH="$(LINUX_KARCH)" \
- SUBDIRS="$(PKG_BUILD_DIR)" \
- EXTRA_CFLAGS="$(BUILDFLAGS)" \
- modules
-endef
-
-$(eval $(call KernelPackage,hwmon-gsc))
+++ /dev/null
-obj-m := gsc.o
+++ /dev/null
-/*
- * A hwmon driver for the Gateworks System Controller
- * Copyright (C) 2009 Gateworks Corporation
- *
- * Author: Chris Lang <clang@gateworks.com>
- *
- * 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 - version 2.
- */
-
-#include <linux/module.h>
-#include <linux/i2c.h>
-#include <linux/hwmon.h>
-#include <linux/hwmon-sysfs.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-
-#define DRV_VERSION "0.2"
-
-enum chips { gsp };
-
-/* AD7418 registers */
-#define GSP_REG_TEMP_IN 0x00
-#define GSP_REG_VIN 0x02
-#define GSP_REG_3P3 0x05
-#define GSP_REG_BAT 0x08
-#define GSP_REG_5P0 0x0b
-#define GSP_REG_CORE 0x0e
-#define GSP_REG_CPU1 0x11
-#define GSP_REG_CPU2 0x14
-#define GSP_REG_DRAM 0x17
-#define GSP_REG_EXT_BAT 0x1a
-#define GSP_REG_IO1 0x1d
-#define GSP_REG_IO2 0x20
-#define GSP_REG_PCIE 0x23
-#define GSP_REG_CURRENT 0x26
-#define GSP_FAN_0 0x2C
-#define GSP_FAN_1 0x2E
-#define GSP_FAN_2 0x30
-#define GSP_FAN_3 0x32
-#define GSP_FAN_4 0x34
-#define GSP_FAN_5 0x36
-
-struct gsp_sensor_info {
- const char* name;
- int reg;
-};
-
-static const struct gsp_sensor_info gsp_sensors[] = {
- {"temp", GSP_REG_TEMP_IN},
- {"vin", GSP_REG_VIN},
- {"3p3", GSP_REG_3P3},
- {"bat", GSP_REG_BAT},
- {"5p0", GSP_REG_5P0},
- {"core", GSP_REG_CORE},
- {"cpu1", GSP_REG_CPU1},
- {"cpu2", GSP_REG_CPU2},
- {"dram", GSP_REG_DRAM},
- {"ext_bat", GSP_REG_EXT_BAT},
- {"io1", GSP_REG_IO1},
- {"io2", GSP_REG_IO2},
- {"pci2", GSP_REG_PCIE},
- {"current", GSP_REG_CURRENT},
- {"fan_point0", GSP_FAN_0},
- {"fan_point1", GSP_FAN_1},
- {"fan_point2", GSP_FAN_2},
- {"fan_point3", GSP_FAN_3},
- {"fan_point4", GSP_FAN_4},
- {"fan_point5", GSP_FAN_5},
-};
-
-struct gsp_data {
- struct device *hwmon_dev;
- struct attribute_group attrs;
- enum chips type;
-};
-
-static int gsp_probe(struct i2c_client *client,
- const struct i2c_device_id *id);
-static int gsp_remove(struct i2c_client *client);
-
-static const struct i2c_device_id gsp_id[] = {
- { "gsp", 0 },
- { }
-};
-MODULE_DEVICE_TABLE(i2c, gsp_id);
-
-static struct i2c_driver gsp_driver = {
- .driver = {
- .name = "gsp",
- },
- .probe = gsp_probe,
- .remove = gsp_remove,
- .id_table = gsp_id,
-};
-
-/* All registers are word-sized, except for the configuration registers.
- * AD7418 uses a high-byte first convention. Do NOT use those functions to
- * access the configuration registers CONF and CONF2, as they are byte-sized.
- */
-static inline int gsp_read(struct i2c_client *client, u8 reg)
-{
- unsigned int adc = 0;
- if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
- {
- adc |= i2c_smbus_read_byte_data(client, reg);
- adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
- return adc;
- }
- else
- {
- adc |= i2c_smbus_read_byte_data(client, reg);
- adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
- adc |= i2c_smbus_read_byte_data(client, reg + 2) << 16;
- return adc;
- }
-}
-
-static inline int gsp_write(struct i2c_client *client, u8 reg, u16 value)
-{
- i2c_smbus_write_byte_data(client, reg, value & 0xff);
- i2c_smbus_write_byte_data(client, reg + 1, ((value >> 8) & 0xff));
- return 1;
-}
-
-static ssize_t show_adc(struct device *dev, struct device_attribute *devattr,
- char *buf)
-{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
- struct i2c_client *client = to_i2c_client(dev);
- return sprintf(buf, "%d\n", gsp_read(client, gsp_sensors[attr->index].reg));
-}
-
-static ssize_t show_label(struct device *dev,
- struct device_attribute *devattr, char *buf)
-{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-
- return sprintf(buf, "%s\n", gsp_sensors[attr->index].name);
-}
-
-static ssize_t store_fan(struct device *dev,
- struct device_attribute *devattr, const char *buf, size_t count)
-{
- u16 val;
- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
- struct i2c_client *client = to_i2c_client(dev);
- val = simple_strtoul(buf, NULL, 10);
- gsp_write(client, gsp_sensors[attr->index].reg, val);
- return count;
-}
-
-static SENSOR_DEVICE_ATTR(temp0_input, S_IRUGO, show_adc, NULL, 0);
-static SENSOR_DEVICE_ATTR(temp0_label, S_IRUGO, show_label, NULL, 0);
-
-static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_adc, NULL, 1);
-static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, 1);
-static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 2);
-static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, 2);
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 3);
-static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, 3);
-static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 4);
-static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 4);
-static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 5);
-static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, 5);
-static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_adc, NULL, 6);
-static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, 6);
-static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_adc, NULL, 7);
-static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, 7);
-static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_adc, NULL, 8);
-static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 8);
-static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_adc, NULL, 9);
-static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 9);
-static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_adc, NULL, 10);
-static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 10);
-static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_adc, NULL, 11);
-static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_label, NULL, 11);
-static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_adc, NULL, 12);
-static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_label, NULL, 12);
-static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_adc, NULL, 13);
-static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_label, NULL, 13);
-
-static SENSOR_DEVICE_ATTR(fan0_point0, S_IRUGO | S_IWUSR, show_adc, store_fan, 14);
-static SENSOR_DEVICE_ATTR(fan0_point1, S_IRUGO | S_IWUSR, show_adc, store_fan, 15);
-static SENSOR_DEVICE_ATTR(fan0_point2, S_IRUGO | S_IWUSR, show_adc, store_fan, 16);
-static SENSOR_DEVICE_ATTR(fan0_point3, S_IRUGO | S_IWUSR, show_adc, store_fan, 17);
-static SENSOR_DEVICE_ATTR(fan0_point4, S_IRUGO | S_IWUSR, show_adc, store_fan, 18);
-static SENSOR_DEVICE_ATTR(fan0_point5, S_IRUGO | S_IWUSR, show_adc, store_fan, 19);
-
-static struct attribute *gsp_attributes[] = {
- &sensor_dev_attr_temp0_input.dev_attr.attr,
- &sensor_dev_attr_in0_input.dev_attr.attr,
- &sensor_dev_attr_in1_input.dev_attr.attr,
- &sensor_dev_attr_in2_input.dev_attr.attr,
- &sensor_dev_attr_in3_input.dev_attr.attr,
- &sensor_dev_attr_in4_input.dev_attr.attr,
- &sensor_dev_attr_in5_input.dev_attr.attr,
- &sensor_dev_attr_in6_input.dev_attr.attr,
- &sensor_dev_attr_in7_input.dev_attr.attr,
- &sensor_dev_attr_in8_input.dev_attr.attr,
- &sensor_dev_attr_in9_input.dev_attr.attr,
- &sensor_dev_attr_in10_input.dev_attr.attr,
- &sensor_dev_attr_in11_input.dev_attr.attr,
- &sensor_dev_attr_in12_input.dev_attr.attr,
-
- &sensor_dev_attr_temp0_label.dev_attr.attr,
- &sensor_dev_attr_in0_label.dev_attr.attr,
- &sensor_dev_attr_in1_label.dev_attr.attr,
- &sensor_dev_attr_in2_label.dev_attr.attr,
- &sensor_dev_attr_in3_label.dev_attr.attr,
- &sensor_dev_attr_in4_label.dev_attr.attr,
- &sensor_dev_attr_in5_label.dev_attr.attr,
- &sensor_dev_attr_in6_label.dev_attr.attr,
- &sensor_dev_attr_in7_label.dev_attr.attr,
- &sensor_dev_attr_in8_label.dev_attr.attr,
- &sensor_dev_attr_in9_label.dev_attr.attr,
- &sensor_dev_attr_in10_label.dev_attr.attr,
- &sensor_dev_attr_in11_label.dev_attr.attr,
- &sensor_dev_attr_in12_label.dev_attr.attr,
-
- &sensor_dev_attr_fan0_point0.dev_attr.attr,
- &sensor_dev_attr_fan0_point1.dev_attr.attr,
- &sensor_dev_attr_fan0_point2.dev_attr.attr,
- &sensor_dev_attr_fan0_point3.dev_attr.attr,
- &sensor_dev_attr_fan0_point4.dev_attr.attr,
- &sensor_dev_attr_fan0_point5.dev_attr.attr,
- NULL
-};
-
-
-static int gsp_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
-{
- struct i2c_adapter *adapter = client->adapter;
- struct gsp_data *data;
- int err;
-
- if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
- I2C_FUNC_SMBUS_WORD_DATA)) {
- err = -EOPNOTSUPP;
- goto exit;
- }
-
- if (!(data = kzalloc(sizeof(struct gsp_data), GFP_KERNEL))) {
- err = -ENOMEM;
- goto exit;
- }
-
- i2c_set_clientdata(client, data);
-
- data->type = id->driver_data;
-
- switch (data->type) {
- case 0:
- data->attrs.attrs = gsp_attributes;
- break;
- }
-
- dev_info(&client->dev, "%s chip found\n", client->name);
-
- /* Register sysfs hooks */
- if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs)))
- goto exit_free;
-
- data->hwmon_dev = hwmon_device_register(&client->dev);
- if (IS_ERR(data->hwmon_dev)) {
- err = PTR_ERR(data->hwmon_dev);
- goto exit_remove;
- }
-
- return 0;
-
-exit_remove:
- sysfs_remove_group(&client->dev.kobj, &data->attrs);
-exit_free:
- kfree(data);
-exit:
- return err;
-}
-
-static int gsp_remove(struct i2c_client *client)
-{
- struct gsp_data *data = i2c_get_clientdata(client);
- hwmon_device_unregister(data->hwmon_dev);
- sysfs_remove_group(&client->dev.kobj, &data->attrs);
- kfree(data);
- return 0;
-}
-
-static int __init gsp_init(void)
-{
- return i2c_add_driver(&gsp_driver);
-}
-
-static void __exit gsp_exit(void)
-{
- i2c_del_driver(&gsp_driver);
-}
-
-module_init(gsp_init);
-module_exit(gsp_exit);
-
-MODULE_AUTHOR("Chris Lang <clang@gateworks.com>");
-MODULE_DESCRIPTION("GSC HWMON driver");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_VERSION);
-
+++ /dev/null
-#
-# Copyright (C) 2006-2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=rtc-rv5c386a
-PKG_RELEASE:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/rtc-rv5c386a
- SUBMENU:=Other modules
- DEPENDS:=@TARGET_brcm47xx @!IN_SDK
- TITLE:=Driver for RTC RV5C386A (used in WL-700gE and WL-HDD)
- AUTOLOAD:=$(call AutoLoad,70,rtc)
- FILES:=$(PKG_BUILD_DIR)/rtc.ko
-endef
-
-define Build/Compile
- $(MAKE) -C "$(LINUX_DIR)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- ARCH="$(LINUX_KARCH)" \
- SUBDIRS="$(PKG_BUILD_DIR)" \
- EXTRA_CFLAGS="$(BUILDFLAGS)" \
- modules
-endef
-
-$(eval $(call KernelPackage,rtc-rv5c386a))
+++ /dev/null
-# $Id$
-#
-# Makefile for Real Time Clock driver for WL-HDD
-#
-# Copyright (C) 2007 Andreas Engel
-#
-# 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.
-#
-
-obj-m := rtc.o
-
-ifeq ($(MAKING_MODULES),1)
-
--include $(TOPDIR)/Rules.make
-endif
+++ /dev/null
-/*
- * Real Time Clock driver for WL-HDD
- *
- * Copyright (C) 2007 Andreas Engel
- *
- * Hacked together mostly by copying the relevant code parts from:
- * drivers/i2c/i2c-bcm5365.c
- * drivers/i2c/i2c-algo-bit.c
- * drivers/char/rtc.c
- *
- * Note 1:
- * This module uses the standard char device (10,135), while the Asus module
- * rtcdrv.o uses (12,0). So, both can coexist which might be handy during
- * development (but see the comment in rtc_open()).
- *
- * Note 2:
- * You might need to set the clock once after loading the driver the first
- * time because the driver switches the chip into 24h mode if it is running
- * in 12h mode.
- *
- * Usage:
- * For compatibility reasons with the original asus driver, the time can be
- * read and set via the /dev/rtc device entry. The only accepted data format
- * is "YYYY:MM:DD:W:HH:MM:SS\n". See OpenWrt wiki for a script which handles
- * this format.
- *
- * In addition, this driver supports the standard ioctl() calls for setting
- * and reading the hardware clock, so the ordinary hwclock utility can also
- * be used.
- *
- * 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.
- *
- * TODO:
- * - add a /proc/driver/rtc interface?
- * - make the battery failure bit available through the /proc interface?
- *
- * $Id: rtc.c 7 2007-05-25 19:37:01Z ae $
- */
-
-#include <linux/module.h>
-#include <linux/kmod.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/miscdevice.h>
-#include <linux/ioport.h>
-#include <linux/fcntl.h>
-#include <linux/mc146818rtc.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/rtc.h>
-#include <linux/delay.h>
-#include <linux/version.h>
-#include <linux/gpio.h>
-#include <linux/uaccess.h>
-
-#include <asm/current.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
-#include <asm/system.h>
-#endif
-
-#include <bcm47xx.h>
-#include <linux/bcm47xx_nvram.h>
-
-#define RTC_IS_OPEN 0x01 /* Means /dev/rtc is in use. */
-
-/* Can be changed via a module parameter. */
-static int rtc_debug = 0;
-
-static unsigned long rtc_status = 0; /* Bitmapped status byte. */
-
-/* These settings are platform dependents. */
-unsigned int sda_index = 0;
-unsigned int scl_index = 0;
-
-#define I2C_READ_MASK 1
-#define I2C_WRITE_MASK 0
-
-#define I2C_ACK 1
-#define I2C_NAK 0
-
-#define RTC_EPOCH 1900
-#define RTC_I2C_ADDRESS (0x32 << 1)
-#define RTC_24HOUR_MODE_MASK 0x20
-#define RTC_PM_MASK 0x20
-#define RTC_VDET_MASK 0x40
-#define RTC_Y2K_MASK 0x80
-
-/*
- * Delay in microseconds for generating the pulses on the I2C bus. We use
- * a rather conservative setting here. See datasheet of the RTC chip.
- */
-#define ADAP_DELAY 50
-
-/* Avoid spurious compiler warnings. */
-#define UNUSED __attribute__((unused))
-
-MODULE_AUTHOR("Andreas Engel");
-MODULE_LICENSE("GPL");
-
-/* Test stolen from switch-adm.c. */
-module_param(rtc_debug, int, 0);
-
-static inline void sdalo(void)
-{
- gpio_direction_output(sda_index, 1);
- udelay(ADAP_DELAY);
-}
-
-static inline void sdahi(void)
-{
- gpio_direction_input(sda_index);
- udelay(ADAP_DELAY);
-}
-
-static inline void scllo(void)
-{
- gpio_direction_output(scl_index, 1);
- udelay(ADAP_DELAY);
-}
-
-static inline int getscl(void)
-{
- return (gpio_get_value(scl_index));
-}
-
-static inline int getsda(void)
-{
- return (gpio_get_value(sda_index));
-}
-
-/*
- * We shouldn't simply set the SCL pin to high. Like SDA, the SCL line is
- * bidirectional too. According to the I2C spec, the slave is allowed to
- * pull down the SCL line to slow down the clock, so we need to check this.
- * Generally, we'd need a timeout here, but in our case, we just check the
- * line, assuming the RTC chip behaves well.
- */
-static int sclhi(void)
-{
- gpio_direction_input(scl_index);
- udelay(ADAP_DELAY);
- if (!getscl()) {
- printk(KERN_ERR "SCL pin should be low\n");
- return -ETIMEDOUT;
- }
- return 0;
-}
-
-static void i2c_start(void)
-{
- sdalo();
- scllo();
-}
-
-static void i2c_stop(void)
-{
- sdalo();
- sclhi();
- sdahi();
-}
-
-static int i2c_outb(int c)
-{
- int i;
- int ack;
-
- /* assert: scl is low */
- for (i = 7; i >= 0; i--) {
- if (c & ( 1 << i )) {
- sdahi();
- } else {
- sdalo();
- }
- if (sclhi() < 0) { /* timed out */
- sdahi(); /* we don't want to block the net */
- return -ETIMEDOUT;
- };
- scllo();
- }
- sdahi();
- if (sclhi() < 0) {
- return -ETIMEDOUT;
- };
- /* read ack: SDA should be pulled down by slave */
- ack = getsda() == 0; /* ack: sda is pulled low ->success. */
- scllo();
-
- if (rtc_debug)
- printk(KERN_DEBUG "i2c_outb(0x%02x) -> %s\n",
- c, ack ? "ACK": "NAK");
-
- return ack; /* return 1 if device acked */
- /* assert: scl is low (sda undef) */
-}
-
-static int i2c_inb(int ack)
-{
- int i;
- unsigned int indata = 0;
-
- /* assert: scl is low */
-
- sdahi();
- for (i = 0; i < 8; i++) {
- if (sclhi() < 0) {
- return -ETIMEDOUT;
- };
- indata *= 2;
- if (getsda())
- indata |= 0x01;
- scllo();
- }
- if (ack) {
- sdalo();
- } else {
- sdahi();
- }
-
- if (sclhi() < 0) {
- sdahi();
- return -ETIMEDOUT;
- }
- scllo();
- sdahi();
-
- if (rtc_debug)
- printk(KERN_DEBUG "i2c_inb() -> 0x%02x\n", indata);
-
- /* assert: scl is low */
- return indata & 0xff;
-}
-
-static void i2c_init(void)
-{
- /* no gpio_control for EXTIF */
- // ssb_gpio_control(&ssb, sda_mask | scl_mask, 0);
-
- gpio_set_value(sda_index, 0);
- gpio_set_value(scl_index, 0);
- sdahi();
- sclhi();
-}
-
-static int rtc_open(UNUSED struct inode *inode, UNUSED struct file *filp)
-{
- spin_lock_irq(&rtc_lock);
-
- if (rtc_status & RTC_IS_OPEN) {
- spin_unlock_irq(&rtc_lock);
- return -EBUSY;
- }
-
- rtc_status |= RTC_IS_OPEN;
-
- /*
- * The following call is only necessary if we use both this driver and
- * the proprietary one from asus at the same time (which, b.t.w. only
- * makes sense during development). Otherwise, each access via the asus
- * driver will make access via this driver impossible.
- */
- i2c_init();
-
- spin_unlock_irq(&rtc_lock);
-
- return 0;
-}
-
-static int rtc_release(UNUSED struct inode *inode, UNUSED struct file *filp)
-{
- /* No need for locking here. */
- rtc_status &= ~RTC_IS_OPEN;
- return 0;
-}
-
-static int from_bcd(int bcdnum)
-{
- int fac, num = 0;
-
- for (fac = 1; bcdnum; fac *= 10) {
- num += (bcdnum % 16) * fac;
- bcdnum /= 16;
- }
-
- return num;
-}
-
-static int to_bcd(int decnum)
-{
- int fac, num = 0;
-
- for (fac = 1; decnum; fac *= 16) {
- num += (decnum % 10) * fac;
- decnum /= 10;
- }
-
- return num;
-}
-
-static void get_rtc_time(struct rtc_time *rtc_tm)
-{
- int cr2;
-
- /*
- * Read date and time from the RTC. We use read method (3).
- */
-
- spin_lock_irq(&rtc_lock);
- i2c_start();
- i2c_outb(RTC_I2C_ADDRESS | I2C_READ_MASK);
- cr2 = i2c_inb(I2C_ACK);
- rtc_tm->tm_sec = i2c_inb(I2C_ACK);
- rtc_tm->tm_min = i2c_inb(I2C_ACK);
- rtc_tm->tm_hour = i2c_inb(I2C_ACK);
- rtc_tm->tm_wday = i2c_inb(I2C_ACK);
- rtc_tm->tm_mday = i2c_inb(I2C_ACK);
- rtc_tm->tm_mon = i2c_inb(I2C_ACK);
- rtc_tm->tm_year = i2c_inb(I2C_NAK);
- i2c_stop();
- spin_unlock_irq(&rtc_lock);
-
- if (cr2 & RTC_VDET_MASK) {
- printk(KERN_WARNING "***RTC BATTERY FAILURE***\n");
- }
-
- /* Handle century bit */
- if (rtc_tm->tm_mon & RTC_Y2K_MASK) {
- rtc_tm->tm_mon &= ~RTC_Y2K_MASK;
- rtc_tm->tm_year += 0x100;
- }
-
- rtc_tm->tm_sec = from_bcd(rtc_tm->tm_sec);
- rtc_tm->tm_min = from_bcd(rtc_tm->tm_min);
- rtc_tm->tm_hour = from_bcd(rtc_tm->tm_hour);
- rtc_tm->tm_mday = from_bcd(rtc_tm->tm_mday);
- rtc_tm->tm_mon = from_bcd(rtc_tm->tm_mon) - 1;
- rtc_tm->tm_year = from_bcd(rtc_tm->tm_year);
-
- rtc_tm->tm_isdst = -1; /* DST not known */
-}
-
-static void set_rtc_time(struct rtc_time *rtc_tm)
-{
- rtc_tm->tm_sec = to_bcd(rtc_tm->tm_sec);
- rtc_tm->tm_min = to_bcd(rtc_tm->tm_min);
- rtc_tm->tm_hour = to_bcd(rtc_tm->tm_hour);
- rtc_tm->tm_mday = to_bcd(rtc_tm->tm_mday);
- rtc_tm->tm_mon = to_bcd(rtc_tm->tm_mon + 1);
- rtc_tm->tm_year = to_bcd(rtc_tm->tm_year);
-
- if (rtc_tm->tm_year >= 0x100) {
- rtc_tm->tm_year -= 0x100;
- rtc_tm->tm_mon |= RTC_Y2K_MASK;
- }
-
- spin_lock_irq(&rtc_lock);
- i2c_start();
- i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
- i2c_outb(0x00); /* set starting register to 0 (=seconds) */
- i2c_outb(rtc_tm->tm_sec);
- i2c_outb(rtc_tm->tm_min);
- i2c_outb(rtc_tm->tm_hour);
- i2c_outb(rtc_tm->tm_wday);
- i2c_outb(rtc_tm->tm_mday);
- i2c_outb(rtc_tm->tm_mon);
- i2c_outb(rtc_tm->tm_year);
- i2c_stop();
- spin_unlock_irq(&rtc_lock);
-}
-
-static ssize_t rtc_write(UNUSED struct file *filp, const char *buf,
- size_t count, loff_t *ppos)
-{
- struct rtc_time rtc_tm;
- char buffer[23];
- char *p;
-
- if (!capable(CAP_SYS_TIME))
- return -EACCES;
-
- if (ppos != &filp->f_pos)
- return -ESPIPE;
-
- /*
- * For simplicity, the only acceptable format is:
- * YYYY:MM:DD:W:HH:MM:SS\n
- */
-
- if (count != 22)
- goto err_out;
-
- if (copy_from_user(buffer, buf, count))
- return -EFAULT;
-
- buffer[sizeof(buffer)-1] = '\0';
-
- p = &buffer[0];
-
- rtc_tm.tm_year = simple_strtoul(p, &p, 10);
- if (*p++ != ':') goto err_out;
-
- rtc_tm.tm_mon = simple_strtoul(p, &p, 10) - 1;
- if (*p++ != ':') goto err_out;
-
- rtc_tm.tm_mday = simple_strtoul(p, &p, 10);
- if (*p++ != ':') goto err_out;
-
- rtc_tm.tm_wday = simple_strtoul(p, &p, 10);
- if (*p++ != ':') goto err_out;
-
- rtc_tm.tm_hour = simple_strtoul(p, &p, 10);
- if (*p++ != ':') goto err_out;
-
- rtc_tm.tm_min = simple_strtoul(p, &p, 10);
- if (*p++ != ':') goto err_out;
-
- rtc_tm.tm_sec = simple_strtoul(p, &p, 10);
- if (*p != '\n') goto err_out;
-
- rtc_tm.tm_year -= RTC_EPOCH;
-
- set_rtc_time(&rtc_tm);
-
- *ppos += count;
-
- return count;
-
- err_out:
- printk(KERN_ERR "invalid format: use YYYY:MM:DD:W:HH:MM:SS\\n\n");
- return -EINVAL;
-}
-
-
-static ssize_t rtc_read(UNUSED struct file *filp, char *buf, size_t count,
- loff_t *ppos)
-{
- char wbuf[23];
- struct rtc_time tm;
- ssize_t len;
-
- if (count == 0 || *ppos != 0)
- return 0;
-
- get_rtc_time(&tm);
-
- len = sprintf(wbuf, "%04d:%02d:%02d:%d:%02d:%02d:%02d\n",
- tm.tm_year + RTC_EPOCH,
- tm.tm_mon + 1,
- tm.tm_mday,
- tm.tm_wday,
- tm.tm_hour,
- tm.tm_min,
- tm.tm_sec);
-
- if (len > (ssize_t)count)
- len = count;
-
- if (copy_to_user(buf, wbuf, len))
- return -EFAULT;
-
- *ppos += len;
-
- return len;
-}
-
-static int rtc_do_ioctl(unsigned int cmd, unsigned long arg)
-{
- struct rtc_time rtc_tm;
-
- switch (cmd) {
- case RTC_RD_TIME:
- memset(&rtc_tm, 0, sizeof(struct rtc_time));
- get_rtc_time(&rtc_tm);
- if (copy_to_user((void *)arg, &rtc_tm, sizeof(rtc_tm)))
- return -EFAULT;
- break;
-
- case RTC_SET_TIME:
- if (!capable(CAP_SYS_TIME))
- return -EACCES;
-
- if (copy_from_user(&rtc_tm, (struct rtc_time *)arg,
- sizeof(struct rtc_time)))
- return -EFAULT;
-
- set_rtc_time(&rtc_tm);
- break;
-
- default:
- return -ENOTTY;
- }
-
- return 0;
-}
-
-static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
- long ret;
- ret = rtc_do_ioctl(cmd, arg);
- return ret;
-}
-
-static const struct file_operations rtc_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .read = rtc_read,
- .write = rtc_write,
- .unlocked_ioctl = rtc_ioctl,
- .open = rtc_open,
- .release = rtc_release,
-};
-
-static struct miscdevice rtc_dev = {
- .minor = RTC_MINOR,
- .name = "rtc",
- .fops = &rtc_fops,
-};
-
-/* Savagely ripped from diag.c. */
-static inline int startswith (char *source, char *cmp)
-{
- return !strncmp(source, cmp, strlen(cmp));
-}
-
-static void platform_detect(void)
-{
- char buf[20];
- int et0phyaddr, et1phyaddr;
-
- /* Based on "model_no". */
- if (bcm47xx_nvram_getenv("model_no", buf, sizeof(buf)) >= 0) {
- if (startswith(buf, "WL700")) { /* WL700* */
- sda_index = 2;
- scl_index = 5;
- return;
- }
- }
-
- if (bcm47xx_nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 )
- et0phyaddr = simple_strtoul(buf, NULL, 0);
- if (bcm47xx_nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 )
- et1phyaddr = simple_strtoul(buf, NULL, 0);
-
- if (bcm47xx_nvram_getenv("hardware_version", buf, sizeof(buf)) >= 0) {
- /* Either WL-300g or WL-HDD, do more extensive checks */
- if (startswith(buf, "WL300-") && et0phyaddr == 0 && et1phyaddr == 1) {
- sda_index = 4;
- scl_index = 5;
- return;
- }
- }
- /* not found */
-}
-
-static int __init rtc_init(void)
-{
- int cr1;
-
- platform_detect();
-
- if (sda_index == scl_index) {
- printk(KERN_ERR "RTC-RV5C386A: unrecognized platform!\n");
- return -ENODEV;
- }
-
- i2c_init();
-
- /*
- * Switch RTC to 24h mode
- */
- spin_lock_irq(&rtc_lock);
- i2c_start();
- i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
- i2c_outb(0xE4); /* start at address 0xE, transmission mode 4 */
- cr1 = i2c_inb(I2C_NAK);
- i2c_stop();
- spin_unlock_irq(&rtc_lock);
- if ((cr1 & RTC_24HOUR_MODE_MASK) == 0) {
- /* RTC is running in 12h mode */
- printk(KERN_INFO "rtc.o: switching to 24h mode\n");
- spin_lock_irq(&rtc_lock);
- i2c_start();
- i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
- i2c_outb(0xE0);
- i2c_outb(cr1 | RTC_24HOUR_MODE_MASK);
- i2c_stop();
- spin_unlock_irq(&rtc_lock);
- }
-
- misc_register(&rtc_dev);
-
- printk(KERN_INFO "RV5C386A Real Time Clock Driver loaded\n");
-
- return 0;
-}
-
-static void __exit rtc_exit (void)
-{
- misc_deregister(&rtc_dev);
- printk(KERN_INFO "Successfully removed RTC RV5C386A driver\n");
-}
-
-module_init(rtc_init);
-module_exit(rtc_exit);
-
-/*
- * Local Variables:
- * indent-tabs-mode:t
- * c-basic-offset:8
- * End:
- */
+++ /dev/null
-#
-# Copyright (C) 2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=wrt55agv2-spidevs
-PKG_RELEASE:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/wrt55agv2-spidevs
- SUBMENU:=Other modules
- TITLE:=WRT55AG v2 SPI devices support
- DEPENDS:=@TARGET_ath25 +kmod-spi-gpio-old +kmod-spi-ks8995
- FILES:=$(PKG_BUILD_DIR)/wrt55agv2_spidevs.ko
-endef
-
-define KernelPackage/wrt55agv2-spidevs/description
- Kernel module for the SPI devices on the WRT55AG v2 board.
-endef
-
-MAKE_OPTS:= \
- ARCH="$(LINUX_KARCH)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- SUBDIRS="$(PKG_BUILD_DIR)"
-
-define Build/Compile
- $(MAKE) -C "$(LINUX_DIR)" \
- $(MAKE_OPTS) \
- modules
-endef
-
-$(eval $(call KernelPackage,wrt55agv2-spidevs))
+++ /dev/null
-config WRT55AGV2_SPIDEVS
- tristate "SPI device support for the WRT55AG v2 board"
- depends on SPI && MIPS_ATHEROS
+++ /dev/null
-obj-m += wrt55agv2_spidevs.o
+++ /dev/null
-/*
- * SPI driver for the Linksys WRT55AG v2 board.
- *
- * Copyright (C) 2008 Gabor Juhos <juhosg at openwrt.org>
- *
- * This file was based on the mmc_over_gpio driver:
- * Copyright 2008 Michael Buesch <mb@bu3sch.de>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- */
-
-#include <linux/platform_device.h>
-#include <linux/spi/spi_gpio_old.h>
-#include <linux/module.h>
-
-#define DRV_NAME "wrt55agv2-spidevs"
-#define DRV_DESC "SPI driver for the WRT55AG v2 board"
-#define DRV_VERSION "0.1.0"
-#define PFX DRV_NAME ": "
-
-#define GPIO_PIN_MISO 1
-#define GPIO_PIN_CS 2
-#define GPIO_PIN_CLK 3
-#define GPIO_PIN_MOSI 4
-
-static struct platform_device *spi_gpio_dev;
-
-static int __init boardinfo_setup(struct spi_board_info *bi,
- struct spi_master *master, void *data)
-{
-
- strlcpy(bi->modalias, "spi-ks8995", sizeof(bi->modalias));
-
- bi->max_speed_hz = 5000000 /* Hz */;
- bi->bus_num = master->bus_num;
- bi->mode = SPI_MODE_0;
-
- return 0;
-}
-
-static int __init wrt55agv2_spidevs_init(void)
-{
- struct spi_gpio_platform_data pdata;
- int err;
-
- spi_gpio_dev = platform_device_alloc("spi-gpio", 0);
- if (!spi_gpio_dev) {
- printk(KERN_ERR PFX "no memory for spi-gpio device\n");
- return -ENOMEM;
- }
-
- memset(&pdata, 0, sizeof(pdata));
- pdata.pin_miso = GPIO_PIN_MISO;
- pdata.pin_cs = GPIO_PIN_CS;
- pdata.pin_clk = GPIO_PIN_CLK;
- pdata.pin_mosi = GPIO_PIN_MOSI;
- pdata.cs_activelow = 1;
- pdata.no_spi_delay = 1;
- pdata.boardinfo_setup = boardinfo_setup;
- pdata.boardinfo_setup_data = NULL;
-
- err = platform_device_add_data(spi_gpio_dev, &pdata, sizeof(pdata));
- if (err)
- goto err_free_dev;
-
- err = platform_device_register(spi_gpio_dev);
- if (err) {
- printk(KERN_ERR PFX "unable to register device\n");
- goto err_free_pdata;
- }
-
- return 0;
-
-err_free_pdata:
- kfree(spi_gpio_dev->dev.platform_data);
- spi_gpio_dev->dev.platform_data = NULL;
-
-err_free_dev:
- platform_device_put(spi_gpio_dev);
- return err;
-}
-
-static void __exit wrt55agv2_spidevs_cleanup(void)
-{
- if (!spi_gpio_dev)
- return;
-
- platform_device_unregister(spi_gpio_dev);
-
- kfree(spi_gpio_dev->dev.platform_data);
- spi_gpio_dev->dev.platform_data = NULL;
- platform_device_put(spi_gpio_dev);
-}
-
-static int __init wrt55agv2_spidevs_modinit(void)
-{
- printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n");
- return wrt55agv2_spidevs_init();
-}
-module_init(wrt55agv2_spidevs_modinit);
-
-static void __exit wrt55agv2_spidevs_modexit(void)
-{
- wrt55agv2_spidevs_cleanup();
-}
-module_exit(wrt55agv2_spidevs_modexit);
-
-MODULE_DESCRIPTION(DRV_DESC);
-MODULE_VERSION(DRV_VERSION);
-MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>");
-MODULE_LICENSE("GPL v2");
-
+++ /dev/null
-# Copyright (C) 2016 LEDE project
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=lede-keyring
-PKG_RELEASE:=1
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/keyring.git
-PKG_SOURCE_DATE:=2017-01-20
-PKG_SOURCE_VERSION:=a50b7529880988ca96e72dede0279ff139a8ab1a
-PKG_MIRROR_HASH:=811ba79ba71925e949d2c690db7d7b031ac1dd965aa831ca9b6d9d70f5657254
-
-PKG_MAINTAINER:=John Crispin <john@phrozen.org>
-PKG_LICENSE:=GPL-2.0
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/lede-keyring
- SECTION:=base
- CATEGORY:=Base system
- TITLE:=LEDE Developer Keyring
- URL:=http://www.lede-project.org
-endef
-
-define Package/lede-keyring/description
- The keyring of with the developer using and gpg public keys.
-endef
-
-Build/Compile=
-
-define Package/lede-keyring/install
- $(INSTALL_DIR) $(1)/etc/opkg/keys/
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/* $(1)/etc/opkg/keys/
-endef
-
-$(eval $(call BuildPackage,lede-keyring))
+++ /dev/null
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=admswconfig
-PKG_VERSION:=0.1
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
-PKG_HASH:=37b4409ea2105520b4a7327e53c3210251000ddf58f81a8e4c19e6ff9d615afe
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/admswconfig
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=ADM5120 Switch configuration tool
- DEPENDS:=@TARGET_adm5120
- URL:=http://sharon.esrac.ele.tue.nl/users/pe1rxq/linux-adm/admswconfig/
- MAINTAINER:=Florian Fainelli <florian@openwrt.org>
-endef
-
-define Package/admswconfig/description
- A program to configure the internal ethernet switch of an ADM5120 processor.
- You need the corresponding driver for the switch in the kernel.
- With this program you can configure which ports of the switch belong
- to the different ethernet devices.
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
- $(TARGET_CC) $(TARGET_CFLAGS) -Os $(PKG_BUILD_DIR)/admswconfig.c -o $(PKG_BUILD_DIR)/$(PKG_NAME)
-endef
-
-define Package/admswconfig/install
- $(INSTALL_DIR) $(1)/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/admswconfig $(1)/sbin/
- $(INSTALL_DIR) $(1)/lib/network/
- $(INSTALL_DATA) ./files/admswswitch.sh $(1)/lib/network/admswswitch.sh
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_BIN) ./files/admswconfig $(1)/etc/init.d/admswconfig
-endef
-
-$(eval $(call BuildPackage,admswconfig))
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
-
-START=05
-
-start() {
- [ -e /etc/config/network ] && exit 0
-
- mkdir -p /etc/config
-
- board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo)
-
- case "$board_name" in
- "Compex WP54"*)
- board="Compex WP54";;
- esac
-
- echo "$board" |awk '
- function p(cfgname, name) {
- if (c[name] != "") print " option " cfgname " \"" c[name] "\""
- }
-
- BEGIN {
- FS="="
- c["lan_ifname"]="eth0"
- c["wan_ifname"]="eth1"
- c["eth0ports"]="1 2 3 4"
- c["eth1ports"]="0"
- }
- END {
- board=$1
- if (board == "Compex WP54") {
- c["eth0ports"]="0"
- c["eth1ports"]="1"
- }
-
- print "#### VLAN configuration "
- print "config switch"
- p("eth0", "eth0ports")
- p("eth1", "eth1ports")
- print ""
- print ""
- print "#### Loopback configuration"
- print "config interface loopback"
- print " option ifname \"lo\""
- print " option proto static"
- print " option ipaddr 127.0.0.1"
- print " option netmask 255.0.0.0"
- print ""
- print ""
- print "#### LAN configuration"
- print "config interface lan"
- print " option type bridge"
- p("ifname", "lan_ifname")
- p("macaddr", "lan_macaddr")
- print " option proto static"
- print " option ipaddr 192.168.1.1"
- print " option netmask 255.255.255.0"
- print ""
- print ""
- print "#### WAN configuration"
- print "config interface wan"
- p("ifname", "wan_ifname")
- p("macaddr", "wan_macaddr")
- print " option proto dhcp"
- }' > /etc/config/network
-}
-
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2006 OpenWrt.org
-
-setup_switch_vlan() {
- config_get ports "$CONFIG_SECTION" "eth$1"
- ports=`echo "$ports"| sed s/" "/""/g`
- ip link set dev eth$1 down
- admswconfig eth$1 ${ports}c
- ip link set dev eth$1 up
-}
-
-setup_switch() {
- config_cb() {
- case "$1" in
- switch)
- option_cb() {
- case "$1" in
- eth*) setup_switch_vlan "${1##eth}";;
- esac
- }
- ;;
- *)
- option_cb() { return 0; }
- ;;
- esac
- }
- config_load network
-}
+++ /dev/null
---- a/admswconfig.c
-+++ b/admswconfig.c
-@@ -111,9 +111,9 @@ int main(int argc, char **argv)
- }
- } else {
- /* display matrix */
-- printf("ethX\tport0\tport1\tport2\tport3\tport4");
-- if (info.ports == 6)
-- printf("\tport5");
-+ printf("ethX");
-+ for (i = 0; i < info.ports; i++)
-+ printf("\tport%d", i);
- printf("\tCPU\n");
- for (i = 0; i < info.ports; i++) {
- printf("%d", i);
+++ /dev/null
---- a/admswconfig.c
-+++ b/admswconfig.c
-@@ -68,7 +68,7 @@ int main(int argc, char **argv)
- return 1;
- }
- strcpy(ifr.ifr_name, device);
-- ifr.ifr_data = (caddr_t)&info;
-+ ifr.ifr_data = (void *)&info;
- if (ioctl(fd, SIOCGADMINFO, &ifr) < 0) {
- perror("SIOCGADMINFO");
- return 1;
+++ /dev/null
-#
-# Copyright (C) 2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=ct-bugcheck
-PKG_RELEASE:=2016-07-21
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/ct-bugcheck
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=Bug checking and reporting utility
- VERSION:=$(PKG_RELEASE)
- MAINTAINER:=Ben Greear <greearb@candelatech.com>
-endef
-
-define Package/ct-bugcheck/description
- Scripts to check for bugs (like firmware crashes) and package them for reporting.
- Currently this script only checks for ath10k firmware crashes.
- Once installed, you can enable this tool by creating a file called
- /etc/config/bugcheck with the following contents:
- DO_BUGCHECK=1
- export DO_BUGCHECK
-
-endef
-
-define Build/Prepare
- $(CP) src/bugcheck.sh $(PKG_BUILD_DIR)/
- $(CP) src/bugchecker.sh $(PKG_BUILD_DIR)/
- $(CP) src/bugcheck.initd $(PKG_BUILD_DIR)/
-endef
-
-define Build/Compile
- true
-endef
-
-define Package/ct-bugcheck/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/bugcheck.sh $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/bugchecker.sh $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/bugcheck.initd $(1)/etc/init.d/bugcheck
-endef
-
-$(eval $(call BuildPackage,ct-bugcheck))
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2016 OpenWrt.org
-
-START=99
-
-USE_PROCD=1
-PROG=/usr/bin/bugchecker.sh
-
-# To actually make bugchecker.sh run, see comments
-# at top of its file.
-
-start_service () {
- procd_open_instance
- procd_set_param command "$PROG"
- procd_close_instance
-}
+++ /dev/null
-#!/bin/sh
-
-# Check for ath10k (and maybe other) bugs, package them up,
-# and let user know what to do with them.
-
-TMPLOC=/tmp
-CRASHDIR=$TMPLOC/bugcheck
-FOUND_BUG=0
-
-# set -x
-
-bugcheck_generic()
-{
- echo "LEDE crashlog report" > $CRASHDIR/info.txt
- date >> $CRASHDIR/info.txt
- echo >> $CRASHDIR/info.txt
- echo "uname" >> $CRASHDIR/info.txt
- uname -a >> $CRASHDIR/info.txt
- echo >> $CRASHDIR/info.txt
- echo "os-release" >> $CRASHDIR/info.txt
- cat /etc/os-release >> $CRASHDIR/info.txt
- echo >> $CRASHDIR/info.txt
- echo "os-release" >> $CRASHDIR/info.txt
- cat /etc/os-release >> $CRASHDIR/info.txt
- echo >> $CRASHDIR/info.txt
- echo "dmesg output" >> $CRASHDIR/info.txt
- dmesg >> $CRASHDIR/info.txt
- if [ -x /usr/bin/lspci ]
- then
- echo >> $CRASHDIR/info.txt
- echo "lspci" >> $CRASHDIR/info.txt
- lspci >> $CRASHDIR/info.txt
- fi
- echo >> $CRASHDIR/info.txt
- echo "cpuinfo" >> $CRASHDIR/info.txt
- cat /proc/cpuinfo >> $CRASHDIR/info.txt
- echo >> $CRASHDIR/info.txt
- echo "meminfo" >> $CRASHDIR/info.txt
- cat /proc/cpuinfo >> $CRASHDIR/info.txt
- echo >> $CRASHDIR/info.txt
- echo "cmdline" >> $CRASHDIR/info.txt
- cat /proc/cmdline >> $CRASHDIR/info.txt
- echo >> $CRASHDIR/info.txt
- echo "lsmod" >> $CRASHDIR/info.txt
- lsmod >> $CRASHDIR/info.txt
-}
-
-roll_crashes()
-{
- # Roll any existing crashes
- if [ -d $CRASHDIR ]
- then
- if [ -d $CRASHDIR.1 ]
- then
- rm -fr $CRASHDIR.1
- fi
- mv $CRASHDIR $CRASHDIR.1
- fi
-
- # Prepare location
- mkdir -p $CRASHDIR
-}
-
-# ath10k, check debugfs entries.
-for i in /sys/kernel/debug/ieee80211/*/ath10k/fw_crash_dump
-do
- #echo "Checking $i"
- if cat $i > $TMPLOC/ath10k_crash.bin 2>&1
- then
- FOUND_BUG=1
-
- #echo "Found ath10k crash data in $i"
- roll_crashes
-
- ADIR=${i/fw_crash_dump/}
-
- CTFW=0
- if grep -- -ct- $TMPLOC/ath10k_crash.bin > /dev/null 2>&1
- then
- CTFW=1
- fi
-
- echo "Send bug reports to:" > $CRASHDIR/report_to.txt
- if [ -f $ADIR/ct_special -o $CTFW == "1" ]
- then
- # Looks like this is CT firmware or driver...
- echo "greearb@candelatech.com" >> $CRASHDIR/report_to.txt
- echo "and/or report or check for duplicates here:" >> $CRASHDIR/report_to.txt
- echo "https://github.com/greearb/ath10k-ct/issues" >> $CRASHDIR/report_to.txt
- else
- # Not sure who would want these bug reports for upstream...
- echo "https://www.lede-project.org/" >> $CRASHDIR/report_to.txt
- fi
- echo >> $CRASHDIR/report_to.txt
- echo "Please attach all files in this directory to bug reports." >> $CRASHDIR/report_to.txt
-
- mv $TMPLOC/ath10k_crash.bin $CRASHDIR
-
- # Add any more ath10k specific stuff here.
-
- # And call generic bug reporting logic
- bugcheck_generic
- fi
-done
-
-if [ $FOUND_BUG == "1" ]
- then
- # Notify LUCI somehow?
- echo "bugcheck.sh found an issue to be reported" > /dev/kmsg
- echo "See $CRASHDIR for details on how to report this" > /dev/kmsg
- # Let calling code know something was wrong.
- exit 1
-fi
-
-exit 0
+++ /dev/null
-#!/bin/sh
-
-# Periodically call bugcheck.sh script
-
-CHECKER=bugcheck.sh
-SLEEPFOR=60
-
-DO_BUGCHECK=0
-
-# So, to enable this, you create an /etc/config/bugcheck file
-# with contents like:
-# DO_BUGCHECK=1
-# export DO_BUGCHECK
-
-if [ -f /etc/config/bugcheck ]
- then
- . /etc/config/bugcheck
-fi
-
-if [ $DO_BUGCHECK == 0 ]
-then
- exit 0
-fi
-
-while true
- do
- $CHECKER
- sleep $SLEEPFOR
-done
+++ /dev/null
-#
-# Copyright (C) 2016 Rafał Miłecki <zajec5@gmail.com>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=oseama
-PKG_RELEASE:=1
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/oseama
- SECTION:=utils
- CATEGORY:=Base system
- TITLE:=Utility for handling Seama firmware images
- MAINTAINER:=Rafał Miłecki <zajec5@gmail.com>
- DEPENDS:=@TARGET_bcm53xx
-endef
-
-define Package/oseama/description
- This package contains an utility that allows handling Seama images.
-endef
-
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) \
- CC="$(TARGET_CC)" \
- CFLAGS="$(TARGET_CFLAGS) -Wall"
-endef
-
-define Package/oseama/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/oseama $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,oseama))
+++ /dev/null
-all: oseama
-
-oseama:
- $(CC) $(CFLAGS) -Wall oseama.c md5.c -o $@ $^
-
-clean:
- rm -f oseama
+++ /dev/null
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
- * MD5 Message-Digest Algorithm (RFC 1321).
- *
- * Homepage:
- * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
- *
- * Author:
- * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
- *
- * This software was written by Alexander Peslyak in 2001. No copyright is
- * claimed, and the software is hereby placed in the public domain.
- * In case this attempt to disclaim copyright and place the software in the
- * public domain is deemed null and void, then the software is
- * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
- * general public under the following terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted.
- *
- * There's ABSOLUTELY NO WARRANTY, express or implied.
- *
- * (This is a heavily cut-down "BSD license".)
- *
- * This differs from Colin Plumb's older public domain implementation in that
- * no exactly 32-bit integer data type is required (any 32-bit or wider
- * unsigned integer data type will do), there's no compile-time endianness
- * configuration, and the function prototypes match OpenSSL's. No code from
- * Colin Plumb's implementation has been reused; this comment merely compares
- * the properties of the two independent implementations.
- *
- * The primary goals of this implementation are portability and ease of use.
- * It is meant to be fast, but not as fast as possible. Some known
- * optimizations are not included to reduce source code size and avoid
- * compile-time configuration.
- */
-
-#ifndef HAVE_OPENSSL
-
-#include <string.h>
-
-#include "md5.h"
-
-/*
- * The basic MD5 functions.
- *
- * F and G are optimized compared to their RFC 1321 definitions for
- * architectures that lack an AND-NOT instruction, just like in Colin Plumb's
- * implementation.
- */
-#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
-#define H(x, y, z) (((x) ^ (y)) ^ (z))
-#define H2(x, y, z) ((x) ^ ((y) ^ (z)))
-#define I(x, y, z) ((y) ^ ((x) | ~(z)))
-
-/*
- * The MD5 transformation for all four rounds.
- */
-#define STEP(f, a, b, c, d, x, t, s) \
- (a) += f((b), (c), (d)) + (x) + (t); \
- (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
- (a) += (b);
-
-/*
- * SET reads 4 input bytes in little-endian byte order and stores them
- * in a properly aligned word in host byte order.
- *
- * The check for little-endian architectures that tolerate unaligned
- * memory accesses is just an optimization. Nothing will break if it
- * doesn't work.
- */
-#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
-#define SET(n) \
- (*(MD5_u32plus *)&ptr[(n) * 4])
-#define GET(n) \
- SET(n)
-#else
-#define SET(n) \
- (ctx->block[(n)] = \
- (MD5_u32plus)ptr[(n) * 4] | \
- ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
- ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
- ((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
-#define GET(n) \
- (ctx->block[(n)])
-#endif
-
-/*
- * This processes one or more 64-byte data blocks, but does NOT update
- * the bit counters. There are no alignment requirements.
- */
-static const void *body(MD5_CTX *ctx, const void *data, unsigned long size)
-{
- const unsigned char *ptr;
- MD5_u32plus a, b, c, d;
- MD5_u32plus saved_a, saved_b, saved_c, saved_d;
-
- ptr = (const unsigned char *)data;
-
- a = ctx->a;
- b = ctx->b;
- c = ctx->c;
- d = ctx->d;
-
- do {
- saved_a = a;
- saved_b = b;
- saved_c = c;
- saved_d = d;
-
-/* Round 1 */
- STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
- STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
- STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
- STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
- STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
- STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
- STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
- STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
- STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
- STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
- STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
- STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
- STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
- STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
- STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
- STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
-
-/* Round 2 */
- STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
- STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
- STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
- STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
- STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
- STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
- STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
- STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
- STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
- STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
- STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
- STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
- STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
- STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
- STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
- STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
-
-/* Round 3 */
- STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
- STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11)
- STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
- STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23)
- STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
- STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11)
- STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
- STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23)
- STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
- STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11)
- STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
- STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23)
- STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
- STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11)
- STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
- STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23)
-
-/* Round 4 */
- STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
- STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
- STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
- STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
- STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
- STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
- STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
- STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
- STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
- STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
- STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
- STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
- STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
- STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
- STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
- STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
-
- a += saved_a;
- b += saved_b;
- c += saved_c;
- d += saved_d;
-
- ptr += 64;
- } while (size -= 64);
-
- ctx->a = a;
- ctx->b = b;
- ctx->c = c;
- ctx->d = d;
-
- return ptr;
-}
-
-void MD5_Init(MD5_CTX *ctx)
-{
- ctx->a = 0x67452301;
- ctx->b = 0xefcdab89;
- ctx->c = 0x98badcfe;
- ctx->d = 0x10325476;
-
- ctx->lo = 0;
- ctx->hi = 0;
-}
-
-void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
-{
- MD5_u32plus saved_lo;
- unsigned long used, available;
-
- saved_lo = ctx->lo;
- if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
- ctx->hi++;
- ctx->hi += size >> 29;
-
- used = saved_lo & 0x3f;
-
- if (used) {
- available = 64 - used;
-
- if (size < available) {
- memcpy(&ctx->buffer[used], data, size);
- return;
- }
-
- memcpy(&ctx->buffer[used], data, available);
- data = (const unsigned char *)data + available;
- size -= available;
- body(ctx, ctx->buffer, 64);
- }
-
- if (size >= 64) {
- data = body(ctx, data, size & ~(unsigned long)0x3f);
- size &= 0x3f;
- }
-
- memcpy(ctx->buffer, data, size);
-}
-
-void MD5_Final(unsigned char *result, MD5_CTX *ctx)
-{
- unsigned long used, available;
-
- used = ctx->lo & 0x3f;
-
- ctx->buffer[used++] = 0x80;
-
- available = 64 - used;
-
- if (available < 8) {
- memset(&ctx->buffer[used], 0, available);
- body(ctx, ctx->buffer, 64);
- used = 0;
- available = 64;
- }
-
- memset(&ctx->buffer[used], 0, available - 8);
-
- ctx->lo <<= 3;
- ctx->buffer[56] = ctx->lo;
- ctx->buffer[57] = ctx->lo >> 8;
- ctx->buffer[58] = ctx->lo >> 16;
- ctx->buffer[59] = ctx->lo >> 24;
- ctx->buffer[60] = ctx->hi;
- ctx->buffer[61] = ctx->hi >> 8;
- ctx->buffer[62] = ctx->hi >> 16;
- ctx->buffer[63] = ctx->hi >> 24;
-
- body(ctx, ctx->buffer, 64);
-
- result[0] = ctx->a;
- result[1] = ctx->a >> 8;
- result[2] = ctx->a >> 16;
- result[3] = ctx->a >> 24;
- result[4] = ctx->b;
- result[5] = ctx->b >> 8;
- result[6] = ctx->b >> 16;
- result[7] = ctx->b >> 24;
- result[8] = ctx->c;
- result[9] = ctx->c >> 8;
- result[10] = ctx->c >> 16;
- result[11] = ctx->c >> 24;
- result[12] = ctx->d;
- result[13] = ctx->d >> 8;
- result[14] = ctx->d >> 16;
- result[15] = ctx->d >> 24;
-
- memset(ctx, 0, sizeof(*ctx));
-}
-
-#endif
+++ /dev/null
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
- * MD5 Message-Digest Algorithm (RFC 1321).
- *
- * Homepage:
- * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
- *
- * Author:
- * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
- *
- * This software was written by Alexander Peslyak in 2001. No copyright is
- * claimed, and the software is hereby placed in the public domain.
- * In case this attempt to disclaim copyright and place the software in the
- * public domain is deemed null and void, then the software is
- * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
- * general public under the following terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted.
- *
- * There's ABSOLUTELY NO WARRANTY, express or implied.
- *
- * See md5.c for more information.
- */
-
-#ifdef HAVE_OPENSSL
-#include <openssl/md5.h>
-#elif !defined(_MD5_H)
-#define _MD5_H
-
-/* Any 32-bit or wider unsigned integer data type will do */
-typedef unsigned int MD5_u32plus;
-
-typedef struct {
- MD5_u32plus lo, hi;
- MD5_u32plus a, b, c, d;
- unsigned char buffer[64];
- MD5_u32plus block[16];
-} MD5_CTX;
-
-extern void MD5_Init(MD5_CTX *ctx);
-extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
-extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
-
-#endif
+++ /dev/null
-/*
- * oseama
- *
- * Copyright (C) 2016 Rafał Miłecki <zajec5@gmail.com>
- *
- * 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.
- */
-
-#include <byteswap.h>
-#include <endian.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "md5.h"
-
-#if !defined(__BYTE_ORDER)
-#error "Unknown byte order"
-#endif
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define cpu_to_be32(x) (x)
-#define be32_to_cpu(x) (x)
-#define cpu_to_be16(x) (x)
-#define be16_to_cpu(x) (x)
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_be32(x) bswap_32(x)
-#define be32_to_cpu(x) bswap_32(x)
-#define cpu_to_be16(x) bswap_16(x)
-#define be16_to_cpu(x) bswap_16(x)
-#else
-#error "Unsupported endianness"
-#endif
-
-#define SEAMA_MAGIC 0x5ea3a417
-
-struct seama_seal_header {
- uint32_t magic;
- uint16_t reserved;
- uint16_t metasize;
- uint32_t imagesize;
-} __attribute__ ((packed));
-
-struct seama_entity_header {
- uint32_t magic;
- uint16_t reserved;
- uint16_t metasize;
- uint32_t imagesize;
- uint8_t md5[16];
-} __attribute__ ((packed));
-
-char *seama_path;
-int entity_idx = -1;
-char *out_path;
-
-static inline size_t oseama_min(size_t x, size_t y) {
- return x < y ? x : y;
-}
-
-/**************************************************
- * Info
- **************************************************/
-
-static void oseama_info_parse_options(int argc, char **argv) {
- int c;
-
- while ((c = getopt(argc, argv, "e:")) != -1) {
- switch (c) {
- case 'e':
- entity_idx = atoi(optarg);
- break;
- }
- }
-}
-
-static int oseama_info_entities(FILE *seama) {
- struct seama_entity_header hdr;
- size_t bytes, metasize, imagesize;
- uint8_t buf[1024];
- char *end, *tmp;
- int i = 0;
- int err = 0;
-
- while ((bytes = fread(&hdr, 1, sizeof(hdr), seama)) == sizeof(hdr)) {
- if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC) {
- fprintf(stderr, "Invalid Seama magic: 0x%08x\n", be32_to_cpu(hdr.magic));
- err = -EINVAL;
- goto err_out;
- }
- metasize = be16_to_cpu(hdr.metasize);
- imagesize = be32_to_cpu(hdr.imagesize);
-
- if (entity_idx >= 0 && i != entity_idx) {
- fseek(seama, metasize + imagesize, SEEK_CUR);
- i++;
- continue;
- }
-
- if (metasize >= sizeof(buf)) {
- fprintf(stderr, "Too small buffer (%zu B) to read all meta info (%zd B)\n", sizeof(buf), metasize);
- err = -EINVAL;
- goto err_out;
- }
-
- if (entity_idx < 0)
- printf("\n");
- printf("Entity offset:\t%ld\n", ftell(seama) - sizeof(hdr));
- printf("Entity size:\t%zd\n", sizeof(hdr) + metasize + imagesize);
- printf("Meta size:\t%zd\n", metasize);
- printf("Image size:\t%zd\n", imagesize);
-
- bytes = fread(buf, 1, metasize, seama);
- if (bytes != metasize) {
- fprintf(stderr, "Couldn't read %zd B of meta\n", metasize);
- err = -EIO;
- goto err_out;
- }
-
- end = (char *)&buf[metasize - 1];
- *end = '\0';
- for (tmp = (char *)buf; tmp < end && strlen(tmp); tmp += strlen(tmp) + 1) {
- printf("Meta entry:\t%s\n", tmp);
- }
-
- fseek(seama, imagesize, SEEK_CUR);
- i++;
- }
-
-err_out:
- return err;
-}
-
-static int oseama_info(int argc, char **argv) {
- FILE *seama;
- struct seama_seal_header hdr;
- size_t bytes;
- uint16_t metasize;
- uint32_t imagesize;
- uint8_t buf[1024];
- int err = 0;
-
- if (argc < 3) {
- fprintf(stderr, "No Seama file passed\n");
- err = -EINVAL;
- goto out;
- }
- seama_path = argv[2];
-
- optind = 3;
- oseama_info_parse_options(argc, argv);
-
- seama = fopen(seama_path, "r");
- if (!seama) {
- fprintf(stderr, "Couldn't open %s\n", seama_path);
- err = -EACCES;
- goto out;
- }
-
- bytes = fread(&hdr, 1, sizeof(hdr), seama);
- if (bytes != sizeof(hdr)) {
- fprintf(stderr, "Couldn't read %s header\n", seama_path);
- err = -EIO;
- goto err_close;
- }
- metasize = be16_to_cpu(hdr.metasize);
- imagesize = be32_to_cpu(hdr.imagesize);
-
- if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC) {
- fprintf(stderr, "Invalid Seama magic: 0x%08x\n", be32_to_cpu(hdr.magic));
- err = -EINVAL;
- goto err_close;
- }
-
- if (metasize >= sizeof(buf)) {
- fprintf(stderr, "Too small buffer (%zu B) to read all meta info (%d B)\n", sizeof(buf), metasize);
- err = -EINVAL;
- goto err_close;
- }
-
- if (imagesize) {
- fprintf(stderr, "Invalid Seama image size: 0x%08x (should be 0)\n", imagesize);
- err = -EINVAL;
- goto err_close;
- }
-
- bytes = fread(buf, 1, metasize, seama);
- if (bytes != metasize) {
- fprintf(stderr, "Couldn't read %d B of meta\n", metasize);
- err = -EIO;
- goto err_close;
- }
-
- if (entity_idx < 0) {
- char *end, *tmp;
-
- printf("Meta size:\t%d\n", metasize);
- printf("Image size:\t%d\n", imagesize);
-
- end = (char *)&buf[metasize - 1];
- *end = '\0';
- for (tmp = (char *)buf; tmp < end && strlen(tmp); tmp += strlen(tmp) + 1) {
- printf("Meta entry:\t%s\n", tmp);
- }
- }
-
- oseama_info_entities(seama);
-
-err_close:
- fclose(seama);
-out:
- return err;
-}
-
-/**************************************************
- * Create
- **************************************************/
-
-static ssize_t oseama_entity_append_file(FILE *seama, const char *in_path) {
- FILE *in;
- size_t bytes;
- ssize_t length = 0;
- uint8_t buf[128];
-
- in = fopen(in_path, "r");
- if (!in) {
- fprintf(stderr, "Couldn't open %s\n", in_path);
- return -EACCES;
- }
-
- while ((bytes = fread(buf, 1, sizeof(buf), in)) > 0) {
- if (fwrite(buf, 1, bytes, seama) != bytes) {
- fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, seama_path);
- length = -EIO;
- break;
- }
- length += bytes;
- }
-
- fclose(in);
-
- return length;
-}
-
-static ssize_t oseama_entity_append_zeros(FILE *seama, size_t length) {
- uint8_t *buf;
-
- buf = malloc(length);
- if (!buf)
- return -ENOMEM;
- memset(buf, 0, length);
-
- if (fwrite(buf, 1, length, seama) != length) {
- fprintf(stderr, "Couldn't write %zu B to %s\n", length, seama_path);
- return -EIO;
- }
-
- return length;
-}
-
-static ssize_t oseama_entity_align(FILE *seama, size_t curr_offset, size_t alignment) {
- if (curr_offset & (alignment - 1)) {
- size_t length = alignment - (curr_offset % alignment);
-
- return oseama_entity_append_zeros(seama, length);
- }
-
- return 0;
-}
-
-static int oseama_entity_write_hdr(FILE *seama, size_t metasize, size_t imagesize) {
- struct seama_entity_header hdr = {};
- uint8_t buf[128];
- size_t length = imagesize;
- size_t bytes;
- MD5_CTX ctx;
-
- fseek(seama, sizeof(hdr) + metasize, SEEK_SET);
- MD5_Init(&ctx);
- while ((bytes = fread(buf, 1, oseama_min(sizeof(buf), length), seama)) > 0) {
- MD5_Update(&ctx, buf, bytes);
- length -= bytes;
- }
- MD5_Final(hdr.md5, &ctx);
-
- hdr.magic = cpu_to_be32(SEAMA_MAGIC);
- hdr.metasize = cpu_to_be16(metasize);
- hdr.imagesize = cpu_to_be32(imagesize);
-
- fseek(seama, 0, SEEK_SET);
- bytes = fwrite(&hdr, 1, sizeof(hdr), seama);
- if (bytes != sizeof(hdr)) {
- fprintf(stderr, "Couldn't write Seama entity header to %s\n", seama_path);
- return -EIO;
- }
-
- return 0;
-}
-
-static int oseama_entity(int argc, char **argv) {
- FILE *seama;
- ssize_t sbytes;
- size_t curr_offset = sizeof(struct seama_entity_header);
- size_t metasize = 0, imagesize = 0;
- int c;
- int err = 0;
-
- if (argc < 3) {
- fprintf(stderr, "No Seama file passed\n");
- err = -EINVAL;
- goto out;
- }
- seama_path = argv[2];
-
- seama = fopen(seama_path, "w+");
- if (!seama) {
- fprintf(stderr, "Couldn't open %s\n", seama_path);
- err = -EACCES;
- goto out;
- }
- fseek(seama, curr_offset, SEEK_SET);
-
- optind = 3;
- while ((c = getopt(argc, argv, "m:f:b:")) != -1) {
- switch (c) {
- case 'm':
- sbytes = fwrite(optarg, 1, strlen(optarg) + 1, seama);
- if (sbytes < 0) {
- fprintf(stderr, "Failed to write meta %s\n", optarg);
- } else {
- curr_offset += sbytes;
- metasize += sbytes;
- }
-
- sbytes = oseama_entity_align(seama, curr_offset, 4);
- if (sbytes < 0) {
- fprintf(stderr, "Failed to append zeros\n");
- } else {
- curr_offset += sbytes;
- metasize += sbytes;
- }
-
- break;
- case 'f':
- case 'b':
- break;
- }
- }
-
- optind = 3;
- while ((c = getopt(argc, argv, "m:f:b:")) != -1) {
- switch (c) {
- case 'm':
- break;
- case 'f':
- sbytes = oseama_entity_append_file(seama, optarg);
- if (sbytes < 0) {
- fprintf(stderr, "Failed to append file %s\n", optarg);
- } else {
- curr_offset += sbytes;
- imagesize += sbytes;
- }
- break;
- case 'b':
- sbytes = strtol(optarg, NULL, 0) - curr_offset;
- if (sbytes < 0) {
- fprintf(stderr, "Current Seama entity length is 0x%zx, can't pad it with zeros to 0x%lx\n", curr_offset, strtol(optarg, NULL, 0));
- } else {
- sbytes = oseama_entity_append_zeros(seama, sbytes);
- if (sbytes < 0) {
- fprintf(stderr, "Failed to append zeros\n");
- } else {
- curr_offset += sbytes;
- imagesize += sbytes;
- }
- }
- break;
- }
- if (err)
- break;
- }
-
- oseama_entity_write_hdr(seama, metasize, imagesize);
-
- fclose(seama);
-out:
- return err;
-}
-
-/**************************************************
- * Extract
- **************************************************/
-
-static void oseama_extract_parse_options(int argc, char **argv) {
- int c;
-
- while ((c = getopt(argc, argv, "e:o:")) != -1) {
- switch (c) {
- case 'e':
- entity_idx = atoi(optarg);
- break;
- case 'o':
- out_path = optarg;
- break;
- }
- }
-}
-
-static int oseama_extract_entity(FILE *seama, FILE *out) {
- struct seama_entity_header hdr;
- size_t bytes, metasize, imagesize, length;
- uint8_t buf[1024];
- int i = 0;
- int err = 0;
-
- while ((bytes = fread(&hdr, 1, sizeof(hdr), seama)) == sizeof(hdr)) {
- if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC) {
- fprintf(stderr, "Invalid Seama magic: 0x%08x\n", be32_to_cpu(hdr.magic));
- err = -EINVAL;
- break;
- }
- metasize = be16_to_cpu(hdr.metasize);
- imagesize = be32_to_cpu(hdr.imagesize);
-
- if (i != entity_idx) {
- fseek(seama, metasize + imagesize, SEEK_CUR);
- i++;
- continue;
- }
-
- fseek(seama, -sizeof(hdr), SEEK_CUR);
-
- length = sizeof(hdr) + metasize + imagesize;
- while ((bytes = fread(buf, 1, oseama_min(sizeof(buf), length), seama)) > 0) {
- if (fwrite(buf, 1, bytes, out) != bytes) {
- fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, out_path);
- err = -EIO;
- break;
- }
- length -= bytes;
- }
-
- if (length) {
- fprintf(stderr, "Couldn't extract whole entity %d from %s (%zu B left)\n", entity_idx, seama_path, length);
- err = -EIO;
- break;
- }
-
- break;
- }
-
- return err;
-}
-
-static int oseama_extract(int argc, char **argv) {
- FILE *seama;
- FILE *out;
- struct seama_seal_header hdr;
- size_t bytes;
- uint16_t metasize;
- int err = 0;
-
- if (argc < 3) {
- fprintf(stderr, "No Seama file passed\n");
- err = -EINVAL;
- goto out;
- }
- seama_path = argv[2];
-
- optind = 3;
- oseama_extract_parse_options(argc, argv);
- if (entity_idx < 0) {
- fprintf(stderr, "No entity specified\n");
- err = -EINVAL;
- goto out;
- } else if (!out_path) {
- fprintf(stderr, "No output file specified\n");
- err = -EINVAL;
- goto out;
- }
-
- seama = fopen(seama_path, "r");
- if (!seama) {
- fprintf(stderr, "Couldn't open %s\n", seama_path);
- err = -EACCES;
- goto out;
- }
-
- out = fopen(out_path, "w");
- if (!out) {
- fprintf(stderr, "Couldn't open %s\n", out_path);
- err = -EACCES;
- goto err_close_seama;
- }
-
- bytes = fread(&hdr, 1, sizeof(hdr), seama);
- if (bytes != sizeof(hdr)) {
- fprintf(stderr, "Couldn't read %s header\n", seama_path);
- err = -EIO;
- goto err_close_out;
- }
- metasize = be16_to_cpu(hdr.metasize);
-
- fseek(seama, metasize, SEEK_CUR);
-
- oseama_extract_entity(seama, out);
-
-err_close_out:
- fclose(out);
-err_close_seama:
- fclose(seama);
-out:
- return err;
-}
-
-/**************************************************
- * Start
- **************************************************/
-
-static void usage() {
- printf("Usage:\n");
- printf("\n");
- printf("Info about Seama seal (container):\n");
- printf("\toseama info <file> [options]\n");
- printf("\t-e\t\t\t\tprint info about specified entity only\n");
- printf("\n");
- printf("Create Seama entity:\n");
- printf("\toseama entity <file> [options]\n");
- printf("\t-m meta\t\t\t\tmeta into to put in header\n");
- printf("\t-f file\t\t\t\tappend content from file\n");
- printf("\t-b offset\t\t\tappend zeros till reaching absolute offset\n");
- printf("\n");
- printf("Extract from Seama seal (container):\n");
- printf("\toseama extract <file> [options]\n");
- printf("\t-e\t\t\t\tindex of entity to extract\n");
- printf("\t-o file\t\t\t\toutput file\n");
-}
-
-int main(int argc, char **argv) {
- if (argc > 1) {
- if (!strcmp(argv[1], "info"))
- return oseama_info(argc, argv);
- else if (!strcmp(argv[1], "entity"))
- return oseama_entity(argc, argv);
- else if (!strcmp(argv[1], "extract"))
- return oseama_extract(argc, argv);
- }
-
- usage();
- return 0;
-}
+++ /dev/null
-#
-# Copyright (C) 2015 Rafał Miłecki <zajec5@gmail.com>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=otrx
-PKG_RELEASE:=1
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/otrx
- SECTION:=utils
- CATEGORY:=Base system
- TITLE:=Utility for opening (analyzing) TRX firmware images
- MAINTAINER:=Rafał Miłecki <zajec5@gmail.com>
- DEPENDS:=@TARGET_brcm47xx||@TARGET_bcm53xx
-endef
-
-define Package/otrx/description
- This package contains an utility that allows validating TRX images.
-endef
-
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) \
- CC="$(TARGET_CC)" \
- CFLAGS="$(TARGET_CFLAGS) -Wall"
-endef
-
-define Package/otrx/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/otrx $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,otrx))
+++ /dev/null
-all: otrx
-
-otrx:
- $(CC) $(CFLAGS) -o $@ otrx.c -Wall
-
-clean:
- rm -f otrx
+++ /dev/null
-/*
- * otrx
- *
- * Copyright (C) 2015 Rafał Miłecki <zajec5@gmail.com>
- *
- * 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.
- */
-
-#include <byteswap.h>
-#include <endian.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#if !defined(__BYTE_ORDER)
-#error "Unknown byte order"
-#endif
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define cpu_to_le32(x) bswap_32(x)
-#define le32_to_cpu(x) bswap_32(x)
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_le32(x) (x)
-#define le32_to_cpu(x) (x)
-#else
-#error "Unsupported endianness"
-#endif
-
-#define TRX_MAGIC 0x30524448
-#define TRX_FLAGS_OFFSET 12
-#define TRX_MAX_PARTS 3
-
-struct trx_header {
- uint32_t magic;
- uint32_t length;
- uint32_t crc32;
- uint16_t flags;
- uint16_t version;
- uint32_t offset[3];
-};
-
-char *trx_path;
-size_t trx_offset = 0;
-char *partition[TRX_MAX_PARTS] = {};
-
-static inline size_t otrx_min(size_t x, size_t y) {
- return x < y ? x : y;
-}
-
-/**************************************************
- * CRC32
- **************************************************/
-
-static const uint32_t crc32_tbl[] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
- 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
- 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
- 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
- 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
- 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
- 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
- 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
- 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
- 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
- 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
- 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
- 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
- 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
- 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
- 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
- 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
- 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
- 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
- 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
- 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
- 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
- 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
- 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
- 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
- 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
- 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
- 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
- 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
- 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
- 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
- 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
- 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
- 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
- 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
-};
-
-uint32_t otrx_crc32(uint8_t *buf, size_t len) {
- uint32_t crc = 0xffffffff;
-
- while (len) {
- crc = crc32_tbl[(crc ^ *buf) & 0xff] ^ (crc >> 8);
- buf++;
- len--;
- }
-
- return crc;
-}
-
-/**************************************************
- * Check
- **************************************************/
-
-static void otrx_check_parse_options(int argc, char **argv) {
- int c;
-
- while ((c = getopt(argc, argv, "o:")) != -1) {
- switch (c) {
- case 'o':
- trx_offset = atoi(optarg);
- break;
- }
- }
-}
-
-static int otrx_check(int argc, char **argv) {
- FILE *trx;
- struct trx_header hdr;
- size_t bytes, length;
- uint8_t buf[1024];
- uint32_t crc32;
- int i;
- int err = 0;
-
- if (argc < 3) {
- fprintf(stderr, "No TRX file passed\n");
- err = -EINVAL;
- goto out;
- }
- trx_path = argv[2];
-
- optind = 3;
- otrx_check_parse_options(argc, argv);
-
- trx = fopen(trx_path, "r");
- if (!trx) {
- fprintf(stderr, "Couldn't open %s\n", trx_path);
- err = -EACCES;
- goto out;
- }
-
- fseek(trx, trx_offset, SEEK_SET);
- bytes = fread(&hdr, 1, sizeof(hdr), trx);
- if (bytes != sizeof(hdr)) {
- fprintf(stderr, "Couldn't read %s header\n", trx_path);
- err = -EIO;
- goto err_close;
- }
-
- if (le32_to_cpu(hdr.magic) != TRX_MAGIC) {
- fprintf(stderr, "Invalid TRX magic: 0x%08x\n", le32_to_cpu(hdr.magic));
- err = -EINVAL;
- goto err_close;
- }
-
- length = le32_to_cpu(hdr.length);
- if (length < sizeof(hdr)) {
- fprintf(stderr, "Length read from TRX too low (%zu B)\n", length);
- err = -EINVAL;
- goto err_close;
- }
-
- crc32 = 0xffffffff;
- fseek(trx, trx_offset + TRX_FLAGS_OFFSET, SEEK_SET);
- length -= TRX_FLAGS_OFFSET;
- while ((bytes = fread(buf, 1, otrx_min(sizeof(buf), length), trx)) > 0) {
- for (i = 0; i < bytes; i++)
- crc32 = crc32_tbl[(crc32 ^ buf[i]) & 0xff] ^ (crc32 >> 8);
- length -= bytes;
- }
-
- if (length) {
- fprintf(stderr, "Couldn't read last %zd B of data from %s\n", length, trx_path);
- err = -EIO;
- goto err_close;
- }
-
- if (crc32 != le32_to_cpu(hdr.crc32)) {
- fprintf(stderr, "Invalid data crc32: 0x%08x instead of 0x%08x\n", crc32, le32_to_cpu(hdr.crc32));
- err = -EINVAL;
- goto err_close;
- }
-
- printf("Found a valid TRX version %d\n", le32_to_cpu(hdr.version));
-
-err_close:
- fclose(trx);
-out:
- return err;
-}
-
-/**************************************************
- * Create
- **************************************************/
-
-static void otrx_create_parse_options(int argc, char **argv) {
-}
-
-static ssize_t otrx_create_append_file(FILE *trx, const char *in_path) {
- FILE *in;
- size_t bytes;
- ssize_t length = 0;
- uint8_t buf[128];
-
- in = fopen(in_path, "r");
- if (!in) {
- fprintf(stderr, "Couldn't open %s\n", in_path);
- return -EACCES;
- }
-
- while ((bytes = fread(buf, 1, sizeof(buf), in)) > 0) {
- if (fwrite(buf, 1, bytes, trx) != bytes) {
- fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, trx_path);
- length = -EIO;
- break;
- }
- length += bytes;
- }
-
- fclose(in);
-
- return length;
-}
-
-static ssize_t otrx_create_append_zeros(FILE *trx, size_t length) {
- uint8_t *buf;
-
- buf = malloc(length);
- if (!buf)
- return -ENOMEM;
- memset(buf, 0, length);
-
- if (fwrite(buf, 1, length, trx) != length) {
- fprintf(stderr, "Couldn't write %zu B to %s\n", length, trx_path);
- return -EIO;
- }
-
- return length;
-}
-
-static ssize_t otrx_create_align(FILE *trx, size_t curr_offset, size_t alignment) {
- if (curr_offset & (alignment - 1)) {
- size_t length = alignment - (curr_offset % alignment);
- return otrx_create_append_zeros(trx, length);
- }
-
- return 0;
-}
-
-static int otrx_create_write_hdr(FILE *trx, struct trx_header *hdr) {
- size_t bytes, length;
- uint8_t *buf;
- uint32_t crc32;
-
- hdr->magic = cpu_to_le32(TRX_MAGIC);
- hdr->version = 1;
-
- fseek(trx, 0, SEEK_SET);
- bytes = fwrite(hdr, 1, sizeof(struct trx_header), trx);
- if (bytes != sizeof(struct trx_header)) {
- fprintf(stderr, "Couldn't write TRX header to %s\n", trx_path);
- return -EIO;
- }
-
- length = le32_to_cpu(hdr->length);
-
- buf = malloc(length);
- if (!buf) {
- fprintf(stderr, "Couldn't alloc %zu B buffer\n", length);
- return -ENOMEM;
- }
-
- fseek(trx, 0, SEEK_SET);
- bytes = fread(buf, 1, length, trx);
- if (bytes != length) {
- fprintf(stderr, "Couldn't read %zu B of data from %s\n", length, trx_path);
- return -ENOMEM;
- }
-
- crc32 = otrx_crc32(buf + TRX_FLAGS_OFFSET, length - TRX_FLAGS_OFFSET);
- hdr->crc32 = cpu_to_le32(crc32);
-
- fseek(trx, 0, SEEK_SET);
- bytes = fwrite(hdr, 1, sizeof(struct trx_header), trx);
- if (bytes != sizeof(struct trx_header)) {
- fprintf(stderr, "Couldn't write TRX header to %s\n", trx_path);
- return -EIO;
- }
-
- return 0;
-}
-
-static int otrx_create(int argc, char **argv) {
- FILE *trx;
- struct trx_header hdr = {};
- ssize_t sbytes;
- size_t curr_idx = 0;
- size_t curr_offset = sizeof(hdr);
- int c;
- int err = 0;
-
- if (argc < 3) {
- fprintf(stderr, "No TRX file passed\n");
- err = -EINVAL;
- goto out;
- }
- trx_path = argv[2];
-
- optind = 3;
- otrx_create_parse_options(argc, argv);
-
- trx = fopen(trx_path, "w+");
- if (!trx) {
- fprintf(stderr, "Couldn't open %s\n", trx_path);
- err = -EACCES;
- goto out;
- }
- fseek(trx, curr_offset, SEEK_SET);
-
- optind = 3;
- while ((c = getopt(argc, argv, "f:b:")) != -1) {
- switch (c) {
- case 'f':
- if (curr_idx >= TRX_MAX_PARTS) {
- err = -ENOSPC;
- fprintf(stderr, "Reached TRX partitions limit, no place for %s\n", optarg);
- goto err_close;
- }
-
- sbytes = otrx_create_append_file(trx, optarg);
- if (sbytes < 0) {
- fprintf(stderr, "Failed to append file %s\n", optarg);
- } else {
- hdr.offset[curr_idx++] = curr_offset;
- curr_offset += sbytes;
- }
-
- sbytes = otrx_create_align(trx, curr_offset, 4);
- if (sbytes < 0)
- fprintf(stderr, "Failed to append zeros\n");
- else
- curr_offset += sbytes;
-
- break;
- case 'b':
- sbytes = strtol(optarg, NULL, 0) - curr_offset;
- if (sbytes < 0) {
- fprintf(stderr, "Current TRX length is 0x%zx, can't pad it with zeros to 0x%lx\n", curr_offset, strtol(optarg, NULL, 0));
- } else {
- sbytes = otrx_create_append_zeros(trx, sbytes);
- if (sbytes < 0)
- fprintf(stderr, "Failed to append zeros\n");
- else
- curr_offset += sbytes;
- }
- break;
- }
- if (err)
- break;
- }
-
- hdr.length = curr_offset;
- otrx_create_write_hdr(trx, &hdr);
-err_close:
- fclose(trx);
-out:
- return err;
-}
-
-/**************************************************
- * Extract
- **************************************************/
-
-static void otrx_extract_parse_options(int argc, char **argv) {
- int c;
-
- while ((c = getopt(argc, argv, "c:e:o:1:2:3:")) != -1) {
- switch (c) {
- case 'o':
- trx_offset = atoi(optarg);
- break;
- case '1':
- partition[0] = optarg;
- break;
- case '2':
- partition[1] = optarg;
- break;
- case '3':
- partition[2] = optarg;
- break;
- }
- }
-}
-
-static int otrx_extract_copy(FILE *trx, size_t offset, size_t length, char *out_path) {
- FILE *out;
- size_t bytes;
- uint8_t *buf;
- int err = 0;
-
- out = fopen(out_path, "w");
- if (!out) {
- fprintf(stderr, "Couldn't open %s\n", out_path);
- err = -EACCES;
- goto out;
- }
-
- buf = malloc(length);
- if (!buf) {
- fprintf(stderr, "Couldn't alloc %zu B buffer\n", length);
- err = -ENOMEM;
- goto err_close;
- }
-
- fseek(trx, offset, SEEK_SET);
- bytes = fread(buf, 1, length, trx);
- if (bytes != length) {
- fprintf(stderr, "Couldn't read %zu B of data from %s\n", length, trx_path);
- err = -ENOMEM;
- goto err_free_buf;
- };
-
- bytes = fwrite(buf, 1, length, out);
- if (bytes != length) {
- fprintf(stderr, "Couldn't write %zu B to %s\n", length, out_path);
- err = -ENOMEM;
- goto err_free_buf;
- }
-
- printf("Extracted 0x%zx bytes into %s\n", length, out_path);
-
-err_free_buf:
- free(buf);
-err_close:
- fclose(out);
-out:
- return err;
-}
-
-static int otrx_extract(int argc, char **argv) {
- FILE *trx;
- struct trx_header hdr;
- size_t bytes;
- int i;
- int err = 0;
-
- if (argc < 3) {
- fprintf(stderr, "No TRX file passed\n");
- err = -EINVAL;
- goto out;
- }
- trx_path = argv[2];
-
- optind = 3;
- otrx_extract_parse_options(argc, argv);
-
- trx = fopen(trx_path, "r");
- if (!trx) {
- fprintf(stderr, "Couldn't open %s\n", trx_path);
- err = -EACCES;
- goto out;
- }
-
- fseek(trx, trx_offset, SEEK_SET);
- bytes = fread(&hdr, 1, sizeof(hdr), trx);
- if (bytes != sizeof(hdr)) {
- fprintf(stderr, "Couldn't read %s header\n", trx_path);
- err = -EIO;
- goto err_close;
- }
-
- if (le32_to_cpu(hdr.magic) != TRX_MAGIC) {
- fprintf(stderr, "Invalid TRX magic: 0x%08x\n", le32_to_cpu(hdr.magic));
- err = -EINVAL;
- goto err_close;
- }
-
- for (i = 0; i < TRX_MAX_PARTS; i++) {
- size_t length;
-
- if (!partition[i])
- continue;
- if (!hdr.offset[i]) {
- printf("TRX doesn't contain partition %d, can't extract %s\n", i + 1, partition[i]);
- continue;
- }
-
- if (i + 1 >= TRX_MAX_PARTS || !hdr.offset[i + 1])
- length = le32_to_cpu(hdr.length) - le32_to_cpu(hdr.offset[i]);
- else
- length = le32_to_cpu(hdr.offset[i + 1]) - le32_to_cpu(hdr.offset[i]);
-
- otrx_extract_copy(trx, trx_offset + le32_to_cpu(hdr.offset[i]), length, partition[i]);
- }
-
-err_close:
- fclose(trx);
-out:
- return err;
-}
-
-/**************************************************
- * Start
- **************************************************/
-
-static void usage() {
- printf("Usage:\n");
- printf("\n");
- printf("Checking TRX file:\n");
- printf("\totrx check <file> [options]\tcheck if file is a valid TRX\n");
- printf("\t-o offset\t\t\toffset of TRX data in file (default: 0)\n");
- printf("\n");
- printf("Creating new TRX file:\n");
- printf("\totrx create <file> [options] [partitions]\n");
- printf("\t-f file\t\t\t\t[partition] start new partition with content copied from file\n");
- printf("\t-b offset\t\t\t[partition] append zeros to partition till reaching absolute offset\n");
- printf("\n");
- printf("Extracting from TRX file:\n");
- printf("\totrx extract <file> [options]\textract partitions from TRX file\n");
- printf("\t-o offset\t\t\toffset of TRX data in file (default: 0)\n");
- printf("\t-1 file\t\t\t\tfile to extract 1st partition to (optional)\n");
- printf("\t-2 file\t\t\t\tfile to extract 2nd partition to (optional)\n");
- printf("\t-3 file\t\t\t\tfile to extract 3rd partition to (optional)\n");
-}
-
-int main(int argc, char **argv) {
- if (argc > 1) {
- if (!strcmp(argv[1], "check"))
- return otrx_check(argc, argv);
- else if (!strcmp(argv[1], "create"))
- return otrx_create(argc, argv);
- else if (!strcmp(argv[1], "extract"))
- return otrx_extract(argc, argv);
- }
-
- usage();
- return 0;
-}
+++ /dev/null
-#
-# Copyright (C) 2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=ugps
-PKG_RELEASE:=3
-
-PKG_SOURCE_URL=$(LEDE_GIT)/project/ugps.git
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2016-10-24
-PKG_SOURCE_VERSION:=32a6b2b702c3b9f8c425f3d9dc9f4273e276029c
-PKG_MIRROR_HASH:=41d24ef335e9b2847895b04cee4d1c7efa56fc207798f5858e7a1f229a33c5eb
-
-PKG_MAINTAINER:=John Crispin <john@phrozen.org>
-PKG_LICENSE:=GPL-2.0+
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/cmake.mk
-
-define Package/ugps
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=OpenWrt GPS Daemon
- DEPENDS:=+libubox +libubus
-endef
-
-TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
-
-ifneq ($(CONFIG_USE_GLIBC),)
- TARGET_CFLAGS += -D_DEFAULT_SOURCE
-endif
-
-define Package/ugps/conffiles
-/etc/config/gps
-endef
-
-define Package/ugps/install
- $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/ugps $(1)/usr/sbin/
- $(INSTALL_BIN) ./files/ugps.init $(1)/etc/init.d/ugps
- $(INSTALL_CONF) ./files/gps.config $(1)/etc/config/gps
-endef
-
-$(eval $(call BuildPackage,ugps))
+++ /dev/null
-config gps
- option 'tty' 'ttyACM0'
- option 'adjust_time' '1'
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (c) 2014 OpenWrt.org
-
-START=80
-
-USE_PROCD=1
-PROG=/usr/sbin/ugps
-
-service_triggers() {
- procd_add_reload_trigger gps
-}
-
-start_service() {
- local tty="$(uci get gps.@gps[-1].tty)"
- local atime="$(uci get gps.@gps[-1].adjust_time)"
-
- [ -c "$tty" ] || {
- tty="/dev/$tty"
- [ -c "$tty" ] || return
- }
-
- procd_open_instance
- procd_set_param command "$PROG"
- [ "$atime" -eq 0 ] || procd_append_param command "-a"
- procd_append_param command "$tty"
- procd_set_param respawn
- procd_close_instance
-}
endef
LEGACY_DEVICES += MR900
-define LegacyDevice/ALL0305
- DEVICE_TITLE := Allnet ALL0305
- DEVICE_PACKAGES := fconfig kmod-ath5k -kmod-ath9k
-endef
-LEGACY_DEVICES += ALL0305
-
define LegacyDevice/EAP7660D
DEVICE_TITLE := Senao EAP7660D
endef
+++ /dev/null
-define Device/mikrotik
- PROFILES := Default
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport
- BOARD_NAME := routerboard
- KERNEL_INITRAMFS :=
- KERNEL_NAME := loader-generic.elf
- KERNEL := kernel-bin | kernel2minor -s 2048 -e -c
- FILESYSTEMS := squashfs
- IMAGES := sysupgrade.bin
- IMAGE/sysupgrade.bin := sysupgrade-tar
-endef
-
-define Device/nand-64m
- DEVICE_TITLE := MikroTik RouterBoard with 64 MB NAND flash
-$(Device/mikrotik)
- KERNEL := kernel-bin | kernel2minor -s 512 -e -c
-endef
-
-define Device/nand-large
- DEVICE_TITLE := MikroTik RouterBoard with >= 128 MB NAND flash
-$(Device/mikrotik)
- KERNEL := kernel-bin | kernel2minor -s 2048 -e -c
-endef
-
-TARGET_DEVICES += nand-64m nand-large
-
-define Device/rb-nor-flash-16M
- DEVICE_TITLE := MikroTik RouterBoard with 16 MB NOR flash
- DEVICE_PACKAGES := rbcfg -nand-utils
- BLOCKSIZE := 64k
- IMAGE_SIZE := 16000k
- LOADER_TYPE := elf
- KERNEL_INSTALL := 1
- KERNEL := kernel-bin | lzma | loader-kernel | kernel2minor -s 1024 -e
- KERNEL_INITRAMFS := kernel-bin | lzma | loader-kernel
- IMAGES := sysupgrade.bin
- IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
-endef
-
-define Device/rb-941-2nd
-$(Device/rb-nor-flash-16M)
- DEVICE_TITLE := hAP lite
- BOARDNAME:= rb-941-2nd
-endef
+++ /dev/null
-# CONFIG_ATH79_DEV_DSA is not set
-# CONFIG_ATH79_MACH_ALFA_AP120C is not set
-# CONFIG_ATH79_MACH_ALFA_AP96 is not set
-# CONFIG_ATH79_MACH_ALFA_NX is not set
-# CONFIG_ATH79_MACH_ALL0258N is not set
-# CONFIG_ATH79_MACH_ALL0315N is not set
-# CONFIG_ATH79_MACH_ANTMINER_S1 is not set
-# CONFIG_ATH79_MACH_ANTMINER_S3 is not set
-# CONFIG_ATH79_MACH_ANTROUTER_R1 is not set
-# CONFIG_ATH79_MACH_AP121 is not set
-# CONFIG_ATH79_MACH_AP121F is not set
-# CONFIG_ATH79_MACH_AP132 is not set
-# CONFIG_ATH79_MACH_AP136 is not set
-# CONFIG_ATH79_MACH_AP143 is not set
-# CONFIG_ATH79_MACH_AP147 is not set
-# CONFIG_ATH79_MACH_AP152 is not set
-# CONFIG_ATH79_MACH_AP90Q is not set
-# CONFIG_ATH79_MACH_AP96 is not set
-# CONFIG_ATH79_MACH_ARCHER_C7 is not set
-# CONFIG_ATH79_MACH_ARDUINO_YUN is not set
-# CONFIG_ATH79_MACH_AW_NR580 is not set
-# CONFIG_ATH79_MACH_BHR_4GRV2 is not set
-# CONFIG_ATH79_MACH_BHU_BXU2000N2_A is not set
-# CONFIG_ATH79_MACH_BSB is not set
-# CONFIG_ATH79_MACH_C55 is not set
-# CONFIG_ATH79_MACH_C60 is not set
-# CONFIG_ATH79_MACH_CAP324 is not set
-# CONFIG_ATH79_MACH_CAP4200AG is not set
-# CONFIG_ATH79_MACH_CARAMBOLA2 is not set
-# CONFIG_ATH79_MACH_CF_E316N_V2 is not set
-# CONFIG_ATH79_MACH_CF_E320N_V2 is not set
-# CONFIG_ATH79_MACH_CF_E380AC_V1 is not set
-# CONFIG_ATH79_MACH_CF_E380AC_V2 is not set
-# CONFIG_ATH79_MACH_CF_E520N is not set
-# CONFIG_ATH79_MACH_CF_E530N is not set
-# CONFIG_ATH79_MACH_CPE510 is not set
-# CONFIG_ATH79_MACH_CPE830 is not set
-# CONFIG_ATH79_MACH_CPE870 is not set
-# CONFIG_ATH79_MACH_CR3000 is not set
-# CONFIG_ATH79_MACH_CR5000 is not set
-# CONFIG_ATH79_MACH_DAP_2695_A1 is not set
-# CONFIG_ATH79_MACH_DB120 is not set
-# CONFIG_ATH79_MACH_DGL_5500_A1 is not set
-# CONFIG_ATH79_MACH_DHP_1565_A1 is not set
-# CONFIG_ATH79_MACH_DIR_505_A1 is not set
-# CONFIG_ATH79_MACH_DIR_600_A1 is not set
-# CONFIG_ATH79_MACH_DIR_615_C1 is not set
-# CONFIG_ATH79_MACH_DIR_615_I1 is not set
-# CONFIG_ATH79_MACH_DIR_825_B1 is not set
-# CONFIG_ATH79_MACH_DIR_825_C1 is not set
-# CONFIG_ATH79_MACH_DIR_869_A1 is not set
-# CONFIG_ATH79_MACH_DLAN_HOTSPOT is not set
-# CONFIG_ATH79_MACH_DLAN_PRO_1200_AC is not set
-# CONFIG_ATH79_MACH_DLAN_PRO_500_WP is not set
-# CONFIG_ATH79_MACH_DOMYWIFI_DW33D is not set
-# CONFIG_ATH79_MACH_DR344 is not set
-# CONFIG_ATH79_MACH_DR531 is not set
-# CONFIG_ATH79_MACH_DRAGINO2 is not set
-# CONFIG_ATH79_MACH_E2100L is not set
-# CONFIG_ATH79_MACH_EAP120 is not set
-# CONFIG_ATH79_MACH_EAP300V2 is not set
-# CONFIG_ATH79_MACH_EAP7660D is not set
-# CONFIG_ATH79_MACH_EL_M150 is not set
-# CONFIG_ATH79_MACH_EL_MINI is not set
-# CONFIG_ATH79_MACH_EPG5000 is not set
-# CONFIG_ATH79_MACH_ESR1750 is not set
-# CONFIG_ATH79_MACH_ESR900 is not set
-# CONFIG_ATH79_MACH_EW_DORIN is not set
-# CONFIG_ATH79_MACH_F9K1115V2 is not set
-# CONFIG_ATH79_MACH_GL_AR150 is not set
-# CONFIG_ATH79_MACH_GL_AR300 is not set
-# CONFIG_ATH79_MACH_GL_AR300M is not set
-# CONFIG_ATH79_MACH_GL_DOMINO is not set
-# CONFIG_ATH79_MACH_GL_INET is not set
-# CONFIG_ATH79_MACH_GL_MIFI is not set
-# CONFIG_ATH79_MACH_GS_MINIBOX_V1 is not set
-# CONFIG_ATH79_MACH_GS_OOLITE is not set
-# CONFIG_ATH79_MACH_HIWIFI_HC6361 is not set
-# CONFIG_ATH79_MACH_HORNET_UB is not set
-# CONFIG_ATH79_MACH_JA76PF is not set
-# CONFIG_ATH79_MACH_JWAP003 is not set
-# CONFIG_ATH79_MACH_JWAP230 is not set
-# CONFIG_ATH79_MACH_MC_MAC1200R is not set
-# CONFIG_ATH79_MACH_MR12 is not set
-# CONFIG_ATH79_MACH_MR16 is not set
-# CONFIG_ATH79_MACH_MR1750 is not set
-# CONFIG_ATH79_MACH_MR18 is not set
-# CONFIG_ATH79_MACH_MR600 is not set
-# CONFIG_ATH79_MACH_MR900 is not set
-# CONFIG_ATH79_MACH_MYNET_N600 is not set
-# CONFIG_ATH79_MACH_MYNET_N750 is not set
-# CONFIG_ATH79_MACH_MYNET_REXT is not set
-# CONFIG_ATH79_MACH_MZK_W04NU is not set
-# CONFIG_ATH79_MACH_MZK_W300NH is not set
-# CONFIG_ATH79_MACH_NBG460N is not set
-# CONFIG_ATH79_MACH_NBG6716 is not set
-# CONFIG_ATH79_MACH_OM2P is not set
-# CONFIG_ATH79_MACH_OM5P is not set
-# CONFIG_ATH79_MACH_OM5P_AC is not set
-# CONFIG_ATH79_MACH_OM5P_ACv2 is not set
-# CONFIG_ATH79_MACH_OMY_G1 is not set
-# CONFIG_ATH79_MACH_OMY_X1 is not set
-# CONFIG_ATH79_MACH_ONION_OMEGA is not set
-# CONFIG_ATH79_MACH_PB42 is not set
-# CONFIG_ATH79_MACH_PB44 is not set
-# CONFIG_ATH79_MACH_QIHOO_C301 is not set
-# CONFIG_ATH79_MACH_R6100 is not set
-CONFIG_ATH79_MACH_RB2011=y
-CONFIG_ATH79_MACH_RB4XX=y
-CONFIG_ATH79_MACH_RB750=y
-CONFIG_ATH79_MACH_RB91X=y
-CONFIG_ATH79_MACH_RB922=y
-CONFIG_ATH79_MACH_RB941=y
-CONFIG_ATH79_MACH_RB95X=y
-CONFIG_ATH79_MACH_RBSXTLITE=y
-# CONFIG_ATH79_MACH_RE450 is not set
-# CONFIG_ATH79_MACH_RW2458N is not set
-# CONFIG_ATH79_MACH_SMART_300 is not set
-# CONFIG_ATH79_MACH_SOM9331 is not set
-# CONFIG_ATH79_MACH_SR3200 is not set
-# CONFIG_ATH79_MACH_TELLSTICK_ZNET_LITE is not set
-# CONFIG_ATH79_MACH_TEW_632BRP is not set
-# CONFIG_ATH79_MACH_TEW_673GRU is not set
-# CONFIG_ATH79_MACH_TEW_712BR is not set
-# CONFIG_ATH79_MACH_TEW_732BR is not set
-# CONFIG_ATH79_MACH_TEW_823DRU is not set
-# CONFIG_ATH79_MACH_TL_MR11U is not set
-# CONFIG_ATH79_MACH_TL_MR13U is not set
-# CONFIG_ATH79_MACH_TL_MR3020 is not set
-# CONFIG_ATH79_MACH_TL_MR3X20 is not set
-# CONFIG_ATH79_MACH_TL_WA701ND_V2 is not set
-# CONFIG_ATH79_MACH_TL_WA7210N_V2 is not set
-# CONFIG_ATH79_MACH_TL_WA801ND_V3 is not set
-# CONFIG_ATH79_MACH_TL_WA830RE_V2 is not set
-# CONFIG_ATH79_MACH_TL_WA901ND is not set
-# CONFIG_ATH79_MACH_TL_WA901ND_V2 is not set
-# CONFIG_ATH79_MACH_TL_WA901ND_V4 is not set
-# CONFIG_ATH79_MACH_TL_WAX50RE is not set
-# CONFIG_ATH79_MACH_TL_WDR3320_V2 is not set
-# CONFIG_ATH79_MACH_TL_WDR3500 is not set
-# CONFIG_ATH79_MACH_TL_WDR4300 is not set
-# CONFIG_ATH79_MACH_TL_WDR6500_V2 is not set
-# CONFIG_ATH79_MACH_TL_WPA8630 is not set
-# CONFIG_ATH79_MACH_TL_WR1041N_V2 is not set
-# CONFIG_ATH79_MACH_TL_WR1043ND is not set
-# CONFIG_ATH79_MACH_TL_WR1043ND_V2 is not set
-# CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set
-# CONFIG_ATH79_MACH_TL_WR2543N is not set
-# CONFIG_ATH79_MACH_TL_WR703N is not set
-# CONFIG_ATH79_MACH_TL_WR720N_V3 is not set
-# CONFIG_ATH79_MACH_TL_WR741ND is not set
-# CONFIG_ATH79_MACH_TL_WR741ND_V4 is not set
-# CONFIG_ATH79_MACH_TL_WR802N_V1 is not set
-# CONFIG_ATH79_MACH_TL_WR810N is not set
-# CONFIG_ATH79_MACH_TL_WR841N_V1 is not set
-# CONFIG_ATH79_MACH_TL_WR841N_V8 is not set
-# CONFIG_ATH79_MACH_TL_WR841N_V9 is not set
-# CONFIG_ATH79_MACH_TL_WR940N_V4 is not set
-# CONFIG_ATH79_MACH_TL_WR941ND is not set
-# CONFIG_ATH79_MACH_TL_WR941ND_V6 is not set
-# CONFIG_ATH79_MACH_TUBE2H is not set
-# CONFIG_ATH79_MACH_UBNT is not set
-# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set
-# CONFIG_ATH79_MACH_UBNT_XM is not set
-# CONFIG_ATH79_MACH_WEIO is not set
-# CONFIG_ATH79_MACH_WHR_HP_G300N is not set
-# CONFIG_ATH79_MACH_WLAE_AG300N is not set
-# CONFIG_ATH79_MACH_WLR8100 is not set
-# CONFIG_ATH79_MACH_WNDAP360 is not set
-# CONFIG_ATH79_MACH_WNDR3700 is not set
-# CONFIG_ATH79_MACH_WNDR4300 is not set
-# CONFIG_ATH79_MACH_WNR2000 is not set
-# CONFIG_ATH79_MACH_WNR2000_V3 is not set
-# CONFIG_ATH79_MACH_WNR2000_V4 is not set
-# CONFIG_ATH79_MACH_WNR2200 is not set
-# CONFIG_ATH79_MACH_WP543 is not set
-# CONFIG_ATH79_MACH_WPE72 is not set
-# CONFIG_ATH79_MACH_WPJ342 is not set
-# CONFIG_ATH79_MACH_WPJ344 is not set
-# CONFIG_ATH79_MACH_WPJ531 is not set
-# CONFIG_ATH79_MACH_WPJ558 is not set
-# CONFIG_ATH79_MACH_WRT160NL is not set
-# CONFIG_ATH79_MACH_WRT400N is not set
-# CONFIG_ATH79_MACH_WRTNODE2Q is not set
-# CONFIG_ATH79_MACH_WZR_450HP2 is not set
-# CONFIG_ATH79_MACH_WZR_HP_AG300H is not set
-# CONFIG_ATH79_MACH_WZR_HP_G300NH is not set
-# CONFIG_ATH79_MACH_WZR_HP_G300NH2 is not set
-# CONFIG_ATH79_MACH_WZR_HP_G450H is not set
-# CONFIG_ATH79_MACH_XD3200 is not set
-# CONFIG_ATH79_MACH_Z1 is not set
-# CONFIG_ATH79_MACH_ZBT_WE1526 is not set
-# CONFIG_ATH79_MACH_ZCN_1523H is not set
-# CONFIG_ATH79_NVRAM is not set
-CONFIG_ATH79_ROUTERBOOT=y
-CONFIG_CMDLINE="rootfstype=squashfs noinitrd"
-CONFIG_CRC16=y
-CONFIG_CRYPTO_DEFLATE=y
-CONFIG_GPIO_74X164=y
-CONFIG_GPIO_LATCH=y
-CONFIG_LEDS_RB750=y
-CONFIG_LZO_DECOMPRESS=y
-# CONFIG_MTD_CFI is not set
-CONFIG_MTD_CFI_I2=y
-# CONFIG_MTD_CYBERTAN_PARTS is not set
-CONFIG_MTD_MAP_BANK_WIDTH_1=y
-CONFIG_MTD_MAP_BANK_WIDTH_4=y
-# CONFIG_MTD_MYLOADER_PARTS is not set
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_AR934X=y
-CONFIG_MTD_NAND_ECC=y
-CONFIG_MTD_NAND_RB4XX=y
-CONFIG_MTD_NAND_RB750=y
-CONFIG_MTD_NAND_RB91X=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_TPLINK_PARTS is not set
-CONFIG_MTD_UBI=y
-CONFIG_MTD_UBI_BEB_LIMIT=20
-CONFIG_MTD_UBI_BLOCK=y
-# CONFIG_MTD_UBI_FASTMAP is not set
-# CONFIG_MTD_UBI_GLUEBI is not set
-CONFIG_MTD_UBI_WL_THRESHOLD=4096
-CONFIG_RLE_DECOMPRESS=y
-# CONFIG_SOC_AR913X is not set
-# CONFIG_SOC_AR933X is not set
-# CONFIG_SOC_QCA956X is not set
-CONFIG_SPI_RB4XX=y
-CONFIG_SPI_RB4XX_CPLD=y
-CONFIG_UBIFS_FS=y
-CONFIG_UBIFS_FS_ADVANCED_COMPR=y
-# CONFIG_UBIFS_FS_LZO is not set
-CONFIG_UBIFS_FS_ZLIB=y
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_ZLIB_INFLATE=y
+++ /dev/null
-#
-# Copyright (C) 2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/Default
- NAME:=Default Profile
- PACKAGES:= \
- kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport nand-utils
- PRIORITY := 1
-endef
-
-define Profile/Default/Description
- Default package set compatible with most boards.
-endef
-$(eval $(call Profile,Default))
+++ /dev/null
-BOARDNAME:=Mikrotik devices with NAND/NOR flash
-FEATURES += squashfs ramdisk minor nand
-
-DEFAULT_PACKAGES += nand-utils
-
-define Target/Description
- Build firmware images for Atheros AR71xx/AR913x based Mikrotik boards.
- e.g. MikroTik RB-4xx or RB-750
-endef
-
-