From 7a60bb66aac832c0ac72b512f558c6b771ff5491 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Jul 12 2017 19:12:02 +0000 Subject: add proposed upstream patch to fix abort on net-boot --- diff --git a/net-Mark-the-ip_udp_hdr-struct-as-packed.patch b/net-Mark-the-ip_udp_hdr-struct-as-packed.patch new file mode 100644 index 0000000..5ff6a93 --- /dev/null +++ b/net-Mark-the-ip_udp_hdr-struct-as-packed.patch @@ -0,0 +1,41 @@ +From patchwork Wed Jul 12 14:34:50 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [U-Boot] net: Mark the ip_udp_hdr struct as packed +From: Maxime Ripard +X-Patchwork-Id: 787298 +Message-Id: <20170712143450.12233-1-maxime.ripard@free-electrons.com> +To: Tom Rini +Cc: u-boot@lists.denx.de, Maxime Ripard +Date: Wed, 12 Jul 2017 16:34:50 +0200 + +The -mno-unaligned-access flag used on ARM to prevent GCC from generating +unaligned accesses (obviously) will only do so on packed structures. + +It seems like gcc 7.1 is a bit stricter than previous gcc versions on this, +and using it lead to data abort for unaligned accesses when generating +network traffic. + +Fix this by adding the packed attribute to the ip_udp_hdr structure in +order to let GCC do its job. + +Signed-off-by: Maxime Ripard +Reviewed-by: Philipp Tomsich +--- + include/net.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/net.h b/include/net.h +index 997db9210a8f..7b815afffafa 100644 +--- a/include/net.h ++++ b/include/net.h +@@ -390,7 +390,7 @@ struct ip_udp_hdr { + u16 udp_dst; /* UDP destination port */ + u16 udp_len; /* Length of UDP packet */ + u16 udp_xsum; /* Checksum */ +-}; ++} __attribute__ ((packed)); + + #define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) + #define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) diff --git a/uboot-tools.spec b/uboot-tools.spec index e59189c..302583f 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -19,6 +19,7 @@ Patch3: mx6cuboxi-Add-support-for-sata.patch Patch4: mx6-Initial-Hummingboard-2-support.patch Patch5: uefi-fixes.patch Patch6: use-Fedora-specific-EFI-path-name.patch +Patch7: net-Mark-the-ip_udp_hdr-struct-as-packed.patch # Patch11: sti-STiH410-B2260-support.patch # Patch12: AW64-add-spl-atf-support.patch