Merge Official Source

This commit is contained in:
AmadeusGhost 2020-04-27 10:29:16 +08:00
commit 515108c600
39 changed files with 1071 additions and 282 deletions

View File

@ -8,11 +8,11 @@ endif
LINUX_VERSION-4.14 = .176
LINUX_VERSION-4.19 = .115
LINUX_VERSION-5.4 = .34
LINUX_VERSION-5.4 = .35
LINUX_KERNEL_HASH-4.14.176 = bcae0956baaeb55dab5bad0401873fbc5baaa7fbe957ea6d27a5ab241cec5ca2
LINUX_KERNEL_HASH-4.19.115 = 11b2d97c8ea5ceb40c5e1d0bb87ad5b2b8c84560181bc60c0d28ec3a3e3801c2
LINUX_KERNEL_HASH-5.4.34 = 903ec1334daba6a626688f799cc947b420cf6fc8ce83055313dc4e9978d64cd2
LINUX_KERNEL_HASH-5.4.35 = e16bd5f7284a80a41328bf712e1136b0adf5b71cc0bd263efa7cac75539806d4
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))

View File

@ -3,7 +3,8 @@ PKG_NAME ?= u-boot
ifndef PKG_SOURCE_PROTO
PKG_SOURCE = $(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL = \
https://sources.openwrt.org \
https://mirror.cyberbits.eu/u-boot \
https://ftp.denx.de/pub/u-boot \
ftp://ftp.denx.de/pub/u-boot
endif

View File

@ -9,16 +9,17 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=uboot-envtools
PKG_DISTNAME:=u-boot
PKG_VERSION:=2019.07
PKG_RELEASE:=3
PKG_VERSION:=2020.04
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
https://ftp.denx.de/pub/u-boot \
https://mirror.cyberbits.eu/u-boot \
ftp://ftp.denx.de/pub/u-boot
PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://git.denx.de/u-boot.git
PKG_SOURCE_VERSION:=e5aee22e4be75e75a854ab64503fc80598bc2004
PKG_MIRROR_HASH:=58c1ecaf901b6bf65c5e872b5449b642694ae5acebf61f91f0d4bc20b4c654b7
PKG_BUILD_DEPENDS:=fstools

View File

@ -16,7 +16,6 @@ case "$board" in
alfa-network,ap121f|\
buffalo,bhr-4grv2|\
devolo,magic-2-wifi|\
domywifi,dw33d|\
engenius,ecb1750|\
etactica,eg200|\
glinet,gl-ar300m-lite|\
@ -46,6 +45,9 @@ yuncore,xd4200)
buffalo,wzr-hp-ag300h)
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
;;
domywifi,dw33d)
ubootenv_add_uci_config "/dev/mtd4" "0x0" "0x10000" "0x10000"
;;
glinet,gl-ar150)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000"
;;

View File

@ -17,6 +17,9 @@ case "$board" in
cznic,turris-omnia)
ubootenv_add_uci_config "/dev/mtd0" "0xC0000" "0x10000" "0x40000"
;;
glinet,gl-mv1000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x8000" "1"
;;
globalscale,espressobin|\
globalscale,espressobin-emmc|\
globalscale,espressobin-v7|\

View File

@ -44,6 +44,7 @@ endef
define Package/gdbserver
$(call Package/gdb/Default)
TITLE:=Remote server for GNU Debugger
DEPENDS=@!arc
endef
define Package/gdbserver/description

View File

@ -48,6 +48,7 @@ MAKE_FLAGS = \
NO_LIBAUDIT=1 \
NO_LIBCRYPTO=1 \
NO_LIBUNWIND=1 \
NO_LIBCAP=1 \
CROSS_COMPILE="$(TARGET_CROSS)" \
CC="$(TARGET_CC)" \
LD="$(TARGET_CROSS)ld" \

View File

@ -107,6 +107,22 @@ endef
$(eval $(call KernelPackage,libphy))
define KernelPackage/phylink
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Model for MAC to optional PHY connection
KCONFIG:=CONFIG_PHYLINK
FILES:=$(LINUX_DIR)/drivers/net/phy/phylink.ko
AUTOLOAD:=$(call AutoLoad,15,phylink,1)
endef
define KernelPackage/phylink/description
Model for MAC to optional PHY connection
endef
$(eval $(call KernelPackage,phylink))
define KernelPackage/mii
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=MII library
@ -733,6 +749,48 @@ endef
$(eval $(call KernelPackage,i40evf))
define KernelPackage/i40e
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Intel(R) Ethernet Controller XL710 Family support
DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core +LINUX_5_4:kmod-libphy
KCONFIG:=CONFIG_I40E \
CONFIG_I40E_VXLAN=n \
CONFIG_I40E_HWMON=y \
CONFIG_I40E_DCA=n
FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/i40e/i40e.ko
AUTOLOAD:=$(call AutoProbe,i40e)
endef
define KernelPackage/i40e/description
Kernel modules for Intel(R) Ethernet Controller XL710 Family 40 Gigabit Ethernet adapters.
endef
$(eval $(call KernelPackage,i40e))
define KernelPackage/iavf
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Intel(R) Ethernet Adaptive Virtual Function support
DEPENDS:=@PCI_SUPPORT
KCONFIG:= \
CONFIG_I40EVF \
CONFIG_IAVF
FILES:= \
$(LINUX_DIR)/drivers/net/ethernet/intel/i40evf/i40evf.ko@lt4.20 \
$(LINUX_DIR)/drivers/net/ethernet/intel/iavf/iavf.ko@ge4.20
AUTOLOAD:=$(call AutoProbe,i40evf iavf)
AUTOLOAD:=$(call AutoProbe,iavf)
endef
define KernelPackage/iavf/description
Kernel modules for Intel XL710,
X710, X722, XXV710, and all devices advertising support for
Intel Ethernet Adaptive Virtual Function devices.
endef
$(eval $(call KernelPackage,iavf))
define KernelPackage/b44
TITLE:=Broadcom 44xx driver
KCONFIG:=CONFIG_B44
@ -1195,3 +1253,23 @@ define KernelPackage/mlx5-core/description
endef
$(eval $(call KernelPackage,mlx5-core))
define KernelPackage/sfp
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=SFP cage support
DEPENDS:=+kmod-i2c-core +kmod-hwmon-core +kmod-phylink
KCONFIG:= \
CONFIG_SFP \
CONFIG_MDIO_I2C
FILES:= \
$(LINUX_DIR)/drivers/net/phy/sfp.ko \
$(LINUX_DIR)/drivers/net/phy/mdio-i2c.ko
AUTOLOAD:=$(call AutoProbe,mdio-i2c sfp)
endef
define KernelPackage/sfp/description
Kernel module to support SFP cages
endef
$(eval $(call KernelPackage,sfp))

View File

@ -0,0 +1,37 @@
From: Linus Lüssing <ll@simonwunderlich.de>
Date: Wed, 5 Feb 2020 20:10:43 +0100
Subject: ath10k: increase rx buffer size to 2048
Before, only frames with a maximum size of 1528 bytes could be
transmitted between two 802.11s nodes.
For batman-adv for instance, which adds its own header to each frame,
we typically need an MTU of at least 1532 bytes to be able to transmit
without fragmentation.
This patch now increases the maxmimum frame size from 1528 to 1656
bytes.
Tested with two ath10k devices in 802.11s mode, as well as with
batman-adv on top of 802.11s with forwarding disabled.
Fix originally found and developed by Ben Greear.
Link: https://github.com/greearb/ath10k-ct/issues/89
Link: https://github.com/greearb/ath10k-ct/commit/9e5ab25027e0971fa24ccf93373324c08c4e992d
Cc: Ben Greear <greearb@candelatech.com>
Signed-off-by: Linus Lüssing <ll@simonwunderlich.de>
Forwarded: https://patchwork.kernel.org/patch/11367055/
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -2219,7 +2219,7 @@ struct htt_rx_chan_info {
* Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size,
* rounded up to a cache line size.
*/
-#define HTT_RX_BUF_SIZE 1920
+#define HTT_RX_BUF_SIZE 2048
#define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc))
/* Refill a bunch of RX buffers for each refill round so that FW/HW can handle

View File

@ -59,7 +59,7 @@ Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
if (id < 0) {
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2452,7 +2452,7 @@ static int ieee80211_store_ack_skb(struc
@@ -2458,7 +2458,7 @@ static int ieee80211_store_ack_skb(struc
spin_lock_irqsave(&local->ack_status_lock, flags);
id = idr_alloc(&local->ack_status_frames, ack_skb,

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=$(PROJECT_GIT)/project/relayd.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2020-04-20
PKG_SOURCE_VERSION:=ad0b25ad74345d367c62311e14b279f5ccb8ef13
PKG_MIRROR_HASH:=e3e3598e5d37ea225db153288726036c5164bfc98e46d76ad8c317cc19b25a22
PKG_SOURCE_DATE:=2020-04-25
PKG_SOURCE_VERSION:=f4d759be54ceb37714e9a6ca320d5b50c95e9ce9
PKG_MIRROR_HASH:=b1ff6e99072867be0975ba0be52ba9da3a876c8b8da893d68301e8238243a51e
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2020-04-20
PKG_SOURCE_VERSION:=e74a3f9883199e9db7220d52b78e5fbdb4441ca3
PKG_MIRROR_HASH:=a54410a6407c3dad985c94e3ca6f9c2bb5786876c9545cf65a56e4dfc2b380ff
PKG_SOURCE_DATE:=2020-04-25
PKG_SOURCE_VERSION:=cdac0460ba50dc45735f0be2e19a5a8efc3dafe1
PKG_MIRROR_HASH:=261cb929dfc03c1f293156cfdec8c2cd1541dcdc57ae42a323f9df5d26e6f7d2
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=LGPL-2.1

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
PKG_SOURCE_DATE:=2020-04-19
PKG_SOURCE_VERSION:=d200b70e5d5b0b3b61e2573f1c2fa22b3fa9d63a
PKG_MIRROR_HASH:=f56a7d8d74a9996fb83b6815446979550b7786019c97343fa5591d78e2b9c528
PKG_SOURCE_DATE:=2020-04-25
PKG_SOURCE_VERSION:=17e7ae769a4739e4b41a93f588d52cfd216b8eb2
PKG_MIRROR_HASH:=6763cb63a53222d44be3b1ef238f3b9198d31fd533534abbbdc02202d3ef88e0
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0

View File

@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1054,10 +1054,12 @@ static int vc4_hdmi_audio_init(struct vc
@@ -1066,10 +1066,12 @@ static int vc4_hdmi_audio_init(struct vc
struct device *dev = &hdmi->pdev->dev;
const __be32 *addr;
int ret;

View File

@ -307,10 +307,8 @@ CONFIG_MODULES_USE_ELF_REL=y
CONFIG_MTD_BCM47XXSFLASH=y
CONFIG_MTD_BCM47XX_PARTS=y
# CONFIG_MTD_HYPERBUS is not set
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_BRCMNAND=y
CONFIG_MTD_NAND_CORE=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_SW_HAMMING=y
CONFIG_MTD_PARSER_TRX=y
CONFIG_MTD_RAW_NAND=y

View File

@ -0,0 +1,69 @@
From dda9f4b9cac6bdd2a96253b4444d7a6ce5132edb Mon Sep 17 00:00:00 2001
From: Chao Yu <yuchao0@huawei.com>
Date: Sat, 11 Aug 2018 23:42:09 +0800
Subject: f2fs: fix to skip verifying block address for non-regular inode
generic/184 1s ... [failed, exit status 1]- output mismatch
--- tests/generic/184.out 2015-01-11 16:52:27.643681072 +0800
QA output created by 184 - silence is golden
+rm: cannot remove '/mnt/f2fs/null': Bad address
+mknod: '/mnt/f2fs/null': Bad address
+chmod: cannot access '/mnt/f2fs/null': Bad address
+./tests/generic/184: line 36: /mnt/f2fs/null: Bad address
...
F2FS-fs (zram0): access invalid blkaddr:259
EIP: f2fs_is_valid_blkaddr+0x14b/0x1b0 [f2fs]
f2fs_iget+0x927/0x1010 [f2fs]
f2fs_lookup+0x26e/0x630 [f2fs]
__lookup_slow+0xb3/0x140
lookup_slow+0x31/0x50
walk_component+0x185/0x1f0
path_lookupat+0x51/0x190
filename_lookup+0x7f/0x140
user_path_at_empty+0x36/0x40
vfs_statx+0x61/0xc0
__do_sys_stat64+0x29/0x40
sys_stat64+0x13/0x20
do_fast_syscall_32+0xaa/0x22c
entry_SYSENTER_32+0x53/0x86
In f2fs_iget(), we will check inode's first block address, if it is valid,
we will set FI_FIRST_BLOCK_WRITTEN flag in inode.
But we should only do this for regular inode, otherwise, like special
inode, i_addr[0] is used for storing device info instead of block address,
it will fail checking flow obviously.
So for non-regular inode, let's skip verifying address and setting flag.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/inode.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -310,13 +310,15 @@ static int do_read_inode(struct inode *i
/* get rdev by using inline_info */
__get_inode_rdev(inode, ri);
- err = __written_first_block(sbi, ri);
- if (err < 0) {
- f2fs_put_page(node_page, 1);
- return err;
+ if (S_ISREG(inode->i_mode)) {
+ err = __written_first_block(sbi, ri);
+ if (err < 0) {
+ f2fs_put_page(node_page, 1);
+ return err;
+ }
+ if (!err)
+ set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
}
- if (!err)
- set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
if (!need_inode_block_update(sbi, inode->i_ino))
fi->last_disk_size = inode->i_size;

View File

@ -0,0 +1,199 @@
From fa6e98cee558622565c97924e922b97340aeabd8 Mon Sep 17 00:00:00 2001
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Tue, 22 Oct 2019 11:31:07 -0700
Subject: [PATCH] net: phy: add support for clause 37 auto-negotiation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch adds support for clause 37 1000Base-X auto-negotiation.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Tao Ren <taoren@fb.com>
Tested-by: René van Dorst <opensource@vdorst.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/phy/phy_device.c | 139 +++++++++++++++++++++++++++++++++++
include/linux/phy.h | 4 +
2 files changed, 143 insertions(+)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index f1f60bd4865a..fa71998fea51 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1607,6 +1607,40 @@ static int genphy_config_advert(struct phy_device *phydev)
return changed;
}
+/**
+ * genphy_c37_config_advert - sanitize and advertise auto-negotiation parameters
+ * @phydev: target phy_device struct
+ *
+ * Description: Writes MII_ADVERTISE with the appropriate values,
+ * after sanitizing the values to make sure we only advertise
+ * what is supported. Returns < 0 on error, 0 if the PHY's advertisement
+ * hasn't changed, and > 0 if it has changed. This function is intended
+ * for Clause 37 1000Base-X mode.
+ */
+static int genphy_c37_config_advert(struct phy_device *phydev)
+{
+ u16 adv = 0;
+
+ /* Only allow advertising what this PHY supports */
+ linkmode_and(phydev->advertising, phydev->advertising,
+ phydev->supported);
+
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
+ phydev->advertising))
+ adv |= ADVERTISE_1000XFULL;
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
+ phydev->advertising))
+ adv |= ADVERTISE_1000XPAUSE;
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
+ phydev->advertising))
+ adv |= ADVERTISE_1000XPSE_ASYM;
+
+ return phy_modify_changed(phydev, MII_ADVERTISE,
+ ADVERTISE_1000XFULL | ADVERTISE_1000XPAUSE |
+ ADVERTISE_1000XHALF | ADVERTISE_1000XPSE_ASYM,
+ adv);
+}
+
/**
* genphy_config_eee_advert - disable unwanted eee mode advertisement
* @phydev: target phy_device struct
@@ -1715,6 +1749,54 @@ int __genphy_config_aneg(struct phy_device *phydev, bool changed)
}
EXPORT_SYMBOL(__genphy_config_aneg);
+/**
+ * genphy_c37_config_aneg - restart auto-negotiation or write BMCR
+ * @phydev: target phy_device struct
+ *
+ * Description: If auto-negotiation is enabled, we configure the
+ * advertising, and then restart auto-negotiation. If it is not
+ * enabled, then we write the BMCR. This function is intended
+ * for use with Clause 37 1000Base-X mode.
+ */
+int genphy_c37_config_aneg(struct phy_device *phydev)
+{
+ int err, changed;
+
+ if (phydev->autoneg != AUTONEG_ENABLE)
+ return genphy_setup_forced(phydev);
+
+ err = phy_modify(phydev, MII_BMCR, BMCR_SPEED1000 | BMCR_SPEED100,
+ BMCR_SPEED1000);
+ if (err)
+ return err;
+
+ changed = genphy_c37_config_advert(phydev);
+ if (changed < 0) /* error */
+ return changed;
+
+ if (!changed) {
+ /* Advertisement hasn't changed, but maybe aneg was never on to
+ * begin with? Or maybe phy was isolated?
+ */
+ int ctl = phy_read(phydev, MII_BMCR);
+
+ if (ctl < 0)
+ return ctl;
+
+ if (!(ctl & BMCR_ANENABLE) || (ctl & BMCR_ISOLATE))
+ changed = 1; /* do restart aneg */
+ }
+
+ /* Only restart aneg if we are advertising something different
+ * than we were before.
+ */
+ if (changed > 0)
+ return genphy_restart_aneg(phydev);
+
+ return 0;
+}
+EXPORT_SYMBOL(genphy_c37_config_aneg);
+
/**
* genphy_aneg_done - return auto-negotiation status
* @phydev: target phy_device struct
@@ -1886,6 +1968,63 @@ int genphy_read_status(struct phy_device *phydev)
}
EXPORT_SYMBOL(genphy_read_status);
+/**
+ * genphy_c37_read_status - check the link status and update current link state
+ * @phydev: target phy_device struct
+ *
+ * Description: Check the link, then figure out the current state
+ * by comparing what we advertise with what the link partner
+ * advertises. This function is for Clause 37 1000Base-X mode.
+ */
+int genphy_c37_read_status(struct phy_device *phydev)
+{
+ int lpa, err, old_link = phydev->link;
+
+ /* Update the link, but return if there was an error */
+ err = genphy_update_link(phydev);
+ if (err)
+ return err;
+
+ /* why bother the PHY if nothing can have changed */
+ if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
+ return 0;
+
+ phydev->duplex = DUPLEX_UNKNOWN;
+ phydev->pause = 0;
+ phydev->asym_pause = 0;
+
+ if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
+ lpa = phy_read(phydev, MII_LPA);
+ if (lpa < 0)
+ return lpa;
+
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+ phydev->lp_advertising, lpa & LPA_LPACK);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
+ phydev->lp_advertising, lpa & LPA_1000XFULL);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT,
+ phydev->lp_advertising, lpa & LPA_1000XPAUSE);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
+ phydev->lp_advertising,
+ lpa & LPA_1000XPAUSE_ASYM);
+
+ phy_resolve_aneg_linkmode(phydev);
+ } else if (phydev->autoneg == AUTONEG_DISABLE) {
+ int bmcr = phy_read(phydev, MII_BMCR);
+
+ if (bmcr < 0)
+ return bmcr;
+
+ if (bmcr & BMCR_FULLDPLX)
+ phydev->duplex = DUPLEX_FULL;
+ else
+ phydev->duplex = DUPLEX_HALF;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(genphy_c37_read_status);
+
/**
* genphy_soft_reset - software reset the PHY via BMCR_RESET bit
* @phydev: target phy_device struct
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9a0e981df502..78436d58ce7c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1106,6 +1106,10 @@ int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad,
int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,
u16 regnum, u16 val);
+/* Clause 37 */
+int genphy_c37_config_aneg(struct phy_device *phydev);
+int genphy_c37_read_status(struct phy_device *phydev);
+
/* Clause 45 PHY */
int genphy_c45_restart_aneg(struct phy_device *phydev);
int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart);

View File

@ -202,6 +202,7 @@ CONFIG_FIXED_PHY=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_FSL_GUTS=y
CONFIG_FS_ENCRYPTION=y
# CONFIG_FSL_IMX8_DDR_PMU is not set
CONFIG_FS_IOMAP=y
CONFIG_FS_MBCACHE=y
CONFIG_FS_POSIX_ACL=y

View File

@ -11,6 +11,7 @@ board_config_update
board=$(board_name)
case "$board" in
glinet,gl-mv1000|\
globalscale,espressobin|\
globalscale,espressobin-emmc|\
globalscale,espressobin-v7|\

View File

@ -0,0 +1,162 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include "armada-372x.dtsi"
/ {
model = "GL.iNet GL-MV1000";
compatible = "glinet,gl-mv1000", "marvell,armada3720";
chosen {
stdout-path = "serial0:115200n8";
};
memory@0 {
device_type = "memory";
reg = <0x00000000 0x00000000 0x00000000 0x20000000>;
};
vcc_sd_reg1: regulator {
compatible = "regulator-gpio";
regulator-name = "vcc_sd1";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
gpios-states = <0>;
states = <1800000 0x1
3300000 0x0>;
enable-active-high;
};
};
&spi0 {
status = "okay";
flash@0 {
reg = <0>;
compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>;
m25p,fast-read;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0 0xf0000>;
};
partition@f0000 {
label = "u-boot-env";
reg = <0Xf0000 0x8000>;
};
factory: partition@f8000 {
label = "factory";
reg = <0xf8000 0x8000>;
};
};
};
};
&sdhci1 {
wp-inverted;
bus-width = <4>;
cd-gpios = <&gpionb 17 GPIO_ACTIVE_LOW>;
marvell,pad-type = "sd";
no-1-8-v;
vqmmc-supply = <&vcc_sd_reg1>;
status = "okay";
};
&sdhci0 {
bus-width = <8>;
mmc-ddr-1_8v;
mmc-hs400-1_8v;
non-removable;
no-sd;
no-sdio;
marvell,pad-type = "fixed-1-8v";
status = "okay";
};
&usb3 {
status = "okay";
};
&usb2 {
status = "okay";
};
&uart0 {
status = "okay";
};
&mdio {
switch0: switch0@1 {
compatible = "marvell,mv88e6085";
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
dsa,member = <0 0>;
ports: ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "cpu";
ethernet = <&eth0>;
};
port@1 {
reg = <1>;
label = "wan";
phy-handle = <&switch0phy0>;
};
port@2 {
reg = <2>;
label = "lan0";
phy-handle = <&switch0phy1>;
};
port@3 {
reg = <3>;
label = "lan1";
phy-handle = <&switch0phy2>;
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
switch0phy0: switch0phy0@11 {
reg = <0x11>;
};
switch0phy1: switch0phy1@12 {
reg = <0x12>;
};
switch0phy2: switch0phy2@13 {
reg = <0x13>;
};
};
};
};
&eth0 {
mtd-mac-address = <&factory 0x0>;
phy-mode = "rgmii-id";
status = "okay";
fixed-link {
speed = <1000>;
full-duplex;
};
};

View File

@ -0,0 +1,162 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include "armada-372x.dtsi"
/ {
model = "GL.iNet GL-MV1000";
compatible = "glinet,gl-mv1000", "marvell,armada3720";
chosen {
stdout-path = "serial0:115200n8";
};
memory@0 {
device_type = "memory";
reg = <0x00000000 0x00000000 0x00000000 0x20000000>;
};
vcc_sd_reg1: regulator {
compatible = "regulator-gpio";
regulator-name = "vcc_sd1";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
gpios-states = <0>;
states = <1800000 0x1
3300000 0x0>;
enable-active-high;
};
};
&spi0 {
status = "okay";
flash@0 {
reg = <0>;
compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>;
m25p,fast-read;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0 0xf0000>;
};
partition@f0000 {
label = "u-boot-env";
reg = <0Xf0000 0x8000>;
};
factory: partition@f8000 {
label = "factory";
reg = <0xf8000 0x8000>;
};
};
};
};
&sdhci1 {
wp-inverted;
bus-width = <4>;
cd-gpios = <&gpionb 17 GPIO_ACTIVE_LOW>;
marvell,pad-type = "sd";
no-1-8-v;
vqmmc-supply = <&vcc_sd_reg1>;
status = "okay";
};
&sdhci0 {
bus-width = <8>;
mmc-ddr-1_8v;
mmc-hs400-1_8v;
non-removable;
no-sd;
no-sdio;
marvell,pad-type = "fixed-1-8v";
status = "okay";
};
&usb3 {
status = "okay";
};
&usb2 {
status = "okay";
};
&uart0 {
status = "okay";
};
&mdio {
switch0: switch0@1 {
compatible = "marvell,mv88e6085";
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
dsa,member = <0 0>;
ports: ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "cpu";
ethernet = <&eth0>;
};
port@1 {
reg = <1>;
label = "wan";
phy-handle = <&switch0phy0>;
};
port@2 {
reg = <2>;
label = "lan0";
phy-handle = <&switch0phy1>;
};
port@3 {
reg = <3>;
label = "lan1";
phy-handle = <&switch0phy2>;
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
switch0phy0: switch0phy0@11 {
reg = <0x11>;
};
switch0phy1: switch0phy1@12 {
reg = <0x12>;
};
switch0phy2: switch0phy2@13 {
reg = <0x13>;
};
};
};
};
&eth0 {
mtd-mac-address = <&factory 0x0>;
phy-mode = "rgmii-id";
status = "okay";
fixed-link {
speed = <1000>;
full-duplex;
};
};

View File

@ -1,3 +1,11 @@
define Device/glinet_gl-mv1000
$(call Device/Default-arm64)
DEVICE_VENDOR := GL.iNet
DEVICE_MODEL := GL-MV1000
SOC := armada-3720
endef
TARGET_DEVICES += glinet_gl-mv1000
define Device/globalscale_espressobin
$(call Device/Default-arm64)
DEVICE_VENDOR := Marvell

View File

@ -5,13 +5,71 @@
/ {
model = "Ubiquiti EdgeRouter X SFP";
compatible = "ubnt,edgerouter-x-sfp", "mediatek,mt7621-soc";
sfp_eth5: sfp_eth5 {
compatible = "sff,sfp";
i2c-bus = <&i2c>;
mod-def0-gpio = <&expander0 5 GPIO_ACTIVE_LOW>;
maximum-power-milliwatt = <1000>;
};
};
&i2c {
status = "okay";
pca9555@25 {
/*
* PCA9655 GPIO expander
* 0-POE power port eth0
* 1-POE power port eth1
* 2-POE power port eth2
* 3-POE power port eth3
* 4-POE power port eth4
* 5-SFP_MOD_DEF0#
* 6-
* 7-
* 8-Pull up to VCC
* 9-Pull down to GND
* 10-Pull down to GND
* 11-Pull down to GND
* 12-Pull down to GND
* 13-Pull down to GND
* 14-Pull down to GND
* 15-Pull down to GND
*/
expander0: pca9555@25 {
compatible = "nxp,pca9555";
interrupt-parent = <&gpio>;
interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
gpio-controller;
#gpio-cells = <2>;
reg = <0x25>;
};
};
&gpio {
sfp_i2c_clk_gate {
gpio-hog;
gpios = <7 GPIO_ACTIVE_LOW>;
output-high;
};
};
&mdio {
ephy7: ethernet-phy@7 {
reg = <7>;
sfp = <&sfp_eth5>;
};
};
&switch0 {
ports {
port@5 {
reg = <5>;
label = "eth5";
phy-handle = <&ephy7>;
phy-mode = "rgmii-rxid";
mtd-mac-address = <&factory 0x22>;
mtd-mac-address-increment = <5>;
};
};
};

View File

@ -818,7 +818,7 @@ TARGET_DEVICES += ubnt_edgerouter-x
define Device/ubnt_edgerouter-x-sfp
$(Device/ubnt_edgerouter_common)
DEVICE_MODEL := EdgeRouter X SFP
DEVICE_PACKAGES += kmod-i2c-algo-pca kmod-gpio-pca953x
DEVICE_PACKAGES += kmod-i2c-algo-pca kmod-gpio-pca953x kmod-sfp
SUPPORTED_DEVICES += ubnt-erx-sfp ubiquiti,edgerouterx-sfp
endef
TARGET_DEVICES += ubnt_edgerouter-x-sfp

View File

@ -161,7 +161,6 @@ define Device/mercury_mac1200r-v2
DEVICE_VENDOR := Mercury
DEVICE_MODEL := MAC1200R
DEVICE_VARIANT := v2.0
SUPPORTED_DEVICES := mac1200rv2
DEVICE_PACKAGES := kmod-mt76x2
SUPPORTED_DEVICES += mac1200rv2
endef

View File

@ -298,7 +298,6 @@ define Device/belkin_f7c027
IMAGE_SIZE := 7616k
DEVICE_VENDOR := Belkin
DEVICE_MODEL := F7C027
DEVICE_PACKAGES := --kmod-usb-dwc2 -kmod-usb-ledtrig-usbport
SUPPORTED_DEVICES += f7c027
endef
TARGET_DEVICES += belkin_f7c027

View File

@ -42,10 +42,12 @@ ramips_setup_interfaces()
mikrotik,routerboard-750gr3)
ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan"
;;
ubnt,edgerouter-x|\
ubnt,edgerouter-x-sfp)
ubnt,edgerouter-x)
ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth4"
;;
ubnt,edgerouter-x-sfp)
ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth4 eth5"
;;
*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;

View File

@ -19,6 +19,7 @@ CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_AT803X_PHY=y
CONFIG_BLK_MQ_PCI=y
CONFIG_BOARD_SCACHE=y
CONFIG_BOUNCE=y

View File

@ -0,0 +1,141 @@
From 60ae82b0ea56c279be384b99cd2a42ae5ba7c5c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= <opensource@vdorst.com>
Date: Mon, 4 Nov 2019 22:22:17 +0100
Subject: [PATCH] net: phy: at803x: add support for SFP module in
RGMII-to-x-base mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: René van Dorst <opensource@vdorst.com>
---
drivers/net/phy/at803x.c | 74 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 481cf48c9b9e4..a6536ecf15db4 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -19,6 +19,7 @@
#include <linux/etherdevice.h>
#include <linux/of_gpio.h>
#include <linux/gpio/consumer.h>
+#include <linux/sfp.h>
#define AT803X_SPECIFIC_STATUS 0x11
#define AT803X_SS_SPEED_MASK (3 << 14)
@@ -57,9 +58,18 @@
#define AT803X_MODE_CFG_MASK 0x0F
#define AT803X_MODE_CFG_SGMII 0x01
+#define AT803X_MODE_CFG_BX1000_RGMII_50 0x02
+#define AT803X_MODE_CFG_BX1000_RGMII_75 0x03
+#define AT803X_MODE_FIBER 0x01
+#define AT803X_MODE_COPPER 0x00
#define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/
#define AT803X_PSSR_MR_AN_COMPLETE 0x0200
+#define PSSR_LINK BIT(10)
+#define PSSR_SYNC_STATUS BIT(8)
+#define PSSR_DUPLEX BIT(13)
+#define PSSR_SPEED_1000 BIT(15)
+#define PSSR_SPEED_100 BIT(14)
#define AT803X_DEBUG_REG_0 0x00
#define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15)
@@ -475,10 +485,56 @@ static int at803x_parse_dt(struct phy_device *phydev)
return 0;
}
+static int at803x_mode(struct phy_device *phydev)
+{
+ int mode;
+
+ mode = phy_read(phydev, AT803X_REG_CHIP_CONFIG) & AT803X_MODE_CFG_MASK;
+
+ if (mode == AT803X_MODE_CFG_BX1000_RGMII_50 ||
+ mode == AT803X_MODE_CFG_BX1000_RGMII_75)
+ return AT803X_MODE_FIBER;
+ return AT803X_MODE_COPPER;
+}
+
+static int at803x_sfp_insert(void *upstream, const struct sfp_eeprom_id *id)
+{
+ struct phy_device *phydev = upstream;
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, };
+ phy_interface_t iface;
+
+ sfp_parse_support(phydev->sfp_bus, id, support);
+ iface = sfp_select_interface(phydev->sfp_bus, support);
+
+ if (iface != PHY_INTERFACE_MODE_SGMII &&
+ iface != PHY_INTERFACE_MODE_1000BASEX) {
+ dev_info(&phydev->mdio.dev, "incompatible SFP module inserted;"
+ "Only SGMII/1000BASEX are supported!\n");
+ return -EINVAL;
+ }
+
+ dev_info(&phydev->mdio.dev, "SFP interface %s", phy_modes(iface));
+
+ return 0;
+}
+
+static const struct sfp_upstream_ops at803x_sfp_ops = {
+ .attach = phy_sfp_attach,
+ .detach = phy_sfp_detach,
+ .module_insert = at803x_sfp_insert,
+};
+
static int at803x_probe(struct phy_device *phydev)
{
struct device *dev = &phydev->mdio.dev;
struct at803x_priv *priv;
+ int ret;
+
+ if (at803x_mode(phydev) == AT803X_MODE_FIBER) {
+ ret = phy_sfp_probe(phydev, &at803x_sfp_ops);
+ if (ret < 0)
+ return ret;
+ }
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -658,6 +714,10 @@ static int at803x_read_status(struct phy_device *phydev)
{
int ss, err, old_link = phydev->link;
+ /* Handle (Fiber) SGMII to RGMII mode */
+ if (at803x_mode(phydev) == AT803X_MODE_FIBER)
+ return genphy_c37_read_status(phydev);
+
/* Update the link, but return if there was an error */
err = genphy_update_link(phydev);
if (err)
@@ -712,6 +772,19 @@ static int at803x_read_status(struct phy_device *phydev)
return 0;
}
+static int at803x_config_aneg(struct phy_device *phydev)
+{
+ /* Handle (Fiber) SerDes to RGMII mode */
+ if (at803x_mode(phydev) == AT803X_MODE_FIBER) {
+ pr_warn("%s: fiber\n", __func__);
+ return genphy_c37_config_aneg(phydev);
+ }
+
+ pr_warn("%s: enter\n", __func__);
+
+ return genphy_config_aneg(phydev);
+}
+
static struct phy_driver at803x_driver[] = {
{
/* Qualcomm Atheros AR8035 */
@@ -758,6 +831,7 @@ static struct phy_driver at803x_driver[] = {
.suspend = at803x_suspend,
.resume = at803x_resume,
/* PHY_GBIT_FEATURES */
+ .config_aneg = at803x_config_aneg,
.read_status = at803x_read_status,
.aneg_done = at803x_aneg_done,
.ack_interrupt = &at803x_ack_interrupt,

View File

@ -111,8 +111,8 @@ define Device/Default
IMAGE/combined.img.gz := grub-config pc | combined | grub-install | gzip | append-metadata
IMAGE/combined.vdi := grub-config pc | combined | grub-install | qemu-image vdi
IMAGE/combined.vmdk := grub-config pc | combined | grub-install | qemu-image vmdk
IMAGE/rootfs.img := append-rootfs
IMAGE/rootfs.img.gz := append-rootfs | gzip
IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE)
IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip
ARTIFACT/image-efi.iso := grub-config iso | iso efi
IMAGE/combined-efi.img := grub-config efi | combined efi | grub-install efi | append-metadata
IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata

View File

@ -115,7 +115,8 @@ GCC_CONFIGURE:= \
--with-mpfr=$(TOPDIR)/staging_dir/host \
--with-mpc=$(TOPDIR)/staging_dir/host \
--disable-decimal-float \
--with-diagnostics-color=auto-if-env
--with-diagnostics-color=auto-if-env \
--enable-__cxa_atexit
ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
GCC_CONFIGURE += --with-mips-plt
endif
@ -150,14 +151,6 @@ ifdef CONFIG_sparc
--with-long-double-128
endif
ifeq ($(LIBC),uClibc)
GCC_CONFIGURE+= \
--disable-__cxa_atexit
else
GCC_CONFIGURE+= \
--enable-__cxa_atexit
endif
ifneq ($(GCC_ARCH),)
GCC_CONFIGURE+= --with-arch=$(GCC_ARCH)
endif

View File

@ -7,11 +7,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mkimage
PKG_VERSION:=2019.07
PKG_VERSION:=2020.04
PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://ftp.denx.de/pub/u-boot
PKG_HASH:=bff4fa77e8da17521c030ca4c5b947a056c1b1be4d3e6ee8637020b8d50251d0
PKG_SOURCE_URL:= \
https://mirror.cyberbits.eu/u-boot \
https://ftp.denx.de/pub/u-boot \
ftp://ftp.denx.de/pub/u-boot
PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION)

View File

@ -50,7 +50,7 @@ This patch makes it possible to set a custom image magic.
break;
--- a/tools/default_image.c
+++ b/tools/default_image.c
@@ -116,7 +116,7 @@ static void image_set_header(void *ptr,
@@ -120,7 +120,7 @@ static void image_set_header(void *ptr,
}
/* Build new header */

View File

@ -0,0 +1,95 @@
From 590b23a46b7ae0f5ec5e8f57a85c0e7578c71141 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 26 Apr 2020 17:15:17 +0200
Subject: [PATCH 1/2] Add compatibility with non Linux hosts
This adds some changes to the u-boot tools to make it possible to build
them on non Linux hosts like MacOS or FreeBSD.
asm/byteorder.h, asm/posix_types.h, asm/types.h and linux/kernel.h are
not available on such systems. Remove the include and add the necessary
parts for these header files manually or remove the usage too.
__u64 is not available on FreeBSD, remove its usage.
<malloc.h> has been replaced by <stdlib.h>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
include/image.h | 2 ++
include/imx8image.h | 5 +++++
include/linux/posix_types.h | 2 ++
include/linux/types.h | 4 +++-
lib/rsa/rsa-sign.c | 2 +-
5 files changed, 13 insertions(+), 2 deletions(-)
--- a/include/image.h
+++ b/include/image.h
@@ -16,7 +16,9 @@
#define __IMAGE_H__
#include "compiler.h"
+#ifdef linux
#include <asm/byteorder.h>
+#endif
#include <stdbool.h>
/* Define this to avoid #ifdefs later on */
--- a/include/imx8image.h
+++ b/include/imx8image.h
@@ -11,7 +11,12 @@
#include <image.h>
#include <inttypes.h>
#include "imagetool.h"
+#ifdef linux
#include "linux/kernel.h"
+#else
+#define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1)
+#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
+#endif
#define __packed __attribute__((packed))
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -43,6 +43,8 @@ typedef void (*__kernel_sighandler_t)(in
/* Type of a SYSV IPC key. */
typedef int __kernel_key_t;
+#ifdef linux
#include <asm/posix_types.h>
+#endif
#endif /* _LINUX_POSIX_TYPES_H */
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -2,7 +2,9 @@
#define _LINUX_TYPES_H
#include <linux/posix_types.h>
+#ifdef linux
#include <asm/types.h>
+#endif
#include <stdbool.h>
#ifndef __KERNEL_STRICT_NAMES
@@ -142,7 +144,7 @@ typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __le32;
typedef __u32 __bitwise __be32;
-#if defined(__GNUC__)
+#if defined(__GNUC__) && defined(linux)
typedef __u64 __bitwise __le64;
typedef __u64 __bitwise __be64;
#endif
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -4,7 +4,7 @@
*/
#include "mkimage.h"
-#include <malloc.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <image.h>

View File

@ -1,207 +0,0 @@
Some of the Linux header files are not available on non Linux host
systems like FreeBSD or MacOSX.
The __le32 and __be32 types are only defined in Linux in
asm/byteorder.h, but not on all other BSD systems.
Use uint32_t instead of __le32 and __be32.
__swab32 is also a Linux only function, it looks like be32_to_cpu()
would be better here anyway.
--- a/include/image.h
+++ b/include/image.h
@@ -16,7 +16,6 @@
#define __IMAGE_H__
#include "compiler.h"
-#include <asm/byteorder.h>
#include <stdbool.h>
/* Define this to avoid #ifdefs later on */
@@ -317,13 +316,13 @@ enum {
* all data in network byte order (aka natural aka bigendian).
*/
typedef struct image_header {
- __be32 ih_magic; /* Image Header Magic Number */
- __be32 ih_hcrc; /* Image Header CRC Checksum */
- __be32 ih_time; /* Image Creation Timestamp */
- __be32 ih_size; /* Image Data Size */
- __be32 ih_load; /* Data Load Address */
- __be32 ih_ep; /* Entry Point Address */
- __be32 ih_dcrc; /* Image Data CRC Checksum */
+ uint32_t ih_magic; /* Image Header Magic Number */
+ uint32_t ih_hcrc; /* Image Header CRC Checksum */
+ uint32_t ih_time; /* Image Creation Timestamp */
+ uint32_t ih_size; /* Image Data Size */
+ uint32_t ih_load; /* Data Load Address */
+ uint32_t ih_ep; /* Entry Point Address */
+ uint32_t ih_dcrc; /* Image Data CRC Checksum */
uint8_t ih_os; /* Operating System */
uint8_t ih_arch; /* CPU architecture */
uint8_t ih_type; /* Image Type */
--- a/tools/mtk_image.h
+++ b/tools/mtk_image.h
@@ -15,8 +15,8 @@
union gen_boot_header {
struct {
char name[12];
- __le32 version;
- __le32 size;
+ uint32_t version;
+ uint32_t size;
};
uint8_t pad[0x200];
@@ -32,14 +32,14 @@ union nand_boot_header {
char name[12];
char version[4];
char id[8];
- __le16 ioif;
- __le16 pagesize;
- __le16 addrcycles;
- __le16 oobsize;
- __le16 pages_of_block;
- __le16 numblocks;
- __le16 writesize_shift;
- __le16 erasesize_shift;
+ uint16_t ioif;
+ uint16_t pagesize;
+ uint16_t addrcycles;
+ uint16_t oobsize;
+ uint16_t pages_of_block;
+ uint16_t numblocks;
+ uint16_t writesize_shift;
+ uint16_t erasesize_shift;
uint8_t dummy[60];
uint8_t ecc_parity[28];
};
@@ -54,14 +54,14 @@ union nand_boot_header {
/* BootROM layout header */
struct brom_layout_header {
char name[8];
- __le32 version;
- __le32 header_size;
- __le32 total_size;
- __le32 magic;
- __le32 type;
- __le32 header_size_2;
- __le32 total_size_2;
- __le32 unused;
+ uint32_t version;
+ uint32_t header_size;
+ uint32_t total_size;
+ uint32_t magic;
+ uint32_t type;
+ uint32_t header_size_2;
+ uint32_t total_size_2;
+ uint32_t unused;
};
#define BRLYT_NAME "BRLYT"
@@ -90,8 +90,8 @@ struct gen_device_header {
struct gfh_common_header {
uint8_t magic[3];
uint8_t version;
- __le16 size;
- __le16 type;
+ uint16_t size;
+ uint16_t type;
};
#define GFH_HEADER_MAGIC "MMM"
@@ -106,17 +106,17 @@ struct gfh_common_header {
struct gfh_file_info {
struct gfh_common_header gfh;
char name[12];
- __le32 unused;
- __le16 file_type;
+ uint32_t unused;
+ uint16_t file_type;
uint8_t flash_type;
uint8_t sig_type;
- __le32 load_addr;
- __le32 total_size;
- __le32 max_size;
- __le32 hdr_size;
- __le32 sig_size;
- __le32 jump_offset;
- __le32 processed;
+ uint32_t load_addr;
+ uint32_t total_size;
+ uint32_t max_size;
+ uint32_t hdr_size;
+ uint32_t sig_size;
+ uint32_t jump_offset;
+ uint32_t processed;
};
#define GFH_FILE_INFO_NAME "FILE_INFO"
@@ -129,16 +129,16 @@ struct gfh_file_info {
struct gfh_bl_info {
struct gfh_common_header gfh;
- __le32 attr;
+ uint32_t attr;
};
struct gfh_brom_cfg {
struct gfh_common_header gfh;
- __le32 cfg_bits;
- __le32 usbdl_by_auto_detect_timeout_ms;
+ uint32_t cfg_bits;
+ uint32_t usbdl_by_auto_detect_timeout_ms;
uint8_t unused[0x48];
- __le32 usbdl_by_kcol0_timeout_ms;
- __le32 usbdl_by_flag_timeout_ms;
+ uint32_t usbdl_by_kcol0_timeout_ms;
+ uint32_t usbdl_by_flag_timeout_ms;
uint32_t pad;
};
@@ -157,15 +157,15 @@ struct gfh_anti_clone {
uint8_t ac_b2k;
uint8_t ac_b2c;
uint16_t pad;
- __le32 ac_offset;
- __le32 ac_len;
+ uint32_t ac_offset;
+ uint32_t ac_len;
};
struct gfh_brom_sec_cfg {
struct gfh_common_header gfh;
- __le32 cfg_bits;
+ uint32_t cfg_bits;
char customer_name[0x20];
- __le32 pad;
+ uint32_t pad;
};
#define BROM_SEC_CFG_JTAG_EN 1
@@ -184,11 +184,11 @@ struct gfh_header {
union lk_hdr {
struct {
- __le32 magic;
- __le32 size;
+ uint32_t magic;
+ uint32_t size;
char name[32];
- __le32 loadaddr;
- __le32 mode;
+ uint32_t loadaddr;
+ uint32_t mode;
};
uint8_t data[512];
--- a/tools/zynqmpbif.c
+++ b/tools/zynqmpbif.c
@@ -517,7 +517,7 @@ static int bif_add_bit(struct bif_entry
debug("Bitstream Length: 0x%x\n", bitlen);
for (i = 0; i < bitlen; i += sizeof(uint32_t)) {
uint32_t *bitbin32 = (uint32_t *)&bitbin[i];
- *bitbin32 = __swab32(*bitbin32);
+ *bitbin32 = be32_to_cpu(*bitbin32);
}
if (!bf->dest_dev)

View File

@ -1,29 +0,0 @@
The Kernel includes are only available on Linux hosts, remove then on
non Linux hosts.
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -43,6 +43,8 @@ typedef void (*__kernel_sighandler_t)(in
/* Type of a SYSV IPC key. */
typedef int __kernel_key_t;
+#ifdef linux
#include <asm/posix_types.h>
+#endif
#endif /* _LINUX_POSIX_TYPES_H */
--- a/include/imx8image.h
+++ b/include/imx8image.h
@@ -11,7 +11,12 @@
#include <image.h>
#include <inttypes.h>
#include "imagetool.h"
+#ifdef linux
#include "linux/kernel.h"
+#else
+#define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1)
+#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
+#endif
#define __packed __attribute__((packed))

View File

@ -0,0 +1,10 @@
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -11,7 +11,6 @@
#include "imagetool.h"
#include <image.h>
#include "imximage.h"
-#include <generated/autoconf.h>
#define UNDEFINED 0xFFFFFFFF

View File

@ -3,7 +3,7 @@ needed dependencies are added too.
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -151,7 +151,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
@@ -162,7 +162,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
HOSTCFLAGS_kwbimage.o += \
$(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
HOSTLOADLIBES_mkimage += \