Initial commit
This commit is contained in:
61
package/boot/uboot-fritz4040/Makefile
Normal file
61
package/boot/uboot-fritz4040/Makefile
Normal file
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# 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
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/chunkeey/FritzBox-4040-UBOOT
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=6946ebbaf7b12a4a092d763c8f0c87a25984f103
|
||||
PKG_SOURCE_DATE:=2017-01-29
|
||||
PKG_MIRROR_HASH:=4f3f5d9e3f047910d2bbd31325cc622c3dd64662c20ea740b27ac4bef9736a34
|
||||
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=ipq40xx
|
||||
endef
|
||||
|
||||
define U-Boot/fritz4040
|
||||
NAME:=FritzBox 4040
|
||||
UBOOT_IMAGE:=uboot-fritz4040.bin
|
||||
BUILD_DEVICES:=avm_fritzbox-4040
|
||||
endef
|
||||
|
||||
UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes
|
||||
UBOOT_MAKE_FLAGS = USE_PRIVATE_LIBGCC=yes
|
||||
export DTC
|
||||
|
||||
define Build/Configure
|
||||
$(Build/Configure/U-Boot)
|
||||
$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $(PKG_BUILD_DIR)/fritz/lzma2eva $(PKG_BUILD_DIR)/fritz/src/lzma2eva.c -lz
|
||||
$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $(PKG_BUILD_DIR)/fritz/tichksum $(PKG_BUILD_DIR)/fritz/src/tichksum.c
|
||||
ln -sf $(STAGING_DIR_HOST)/bin/lzma $(PKG_BUILD_DIR)/fritz
|
||||
ln -sf compiler-gcc5.h $(PKG_BUILD_DIR)/include/linux/compiler-gcc7.h
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(Build/Compile/U-Boot)
|
||||
(cd $(PKG_BUILD_DIR); ./fritz/fritzcreator.sh;)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(UBOOT_IMAGE)
|
||||
endef
|
||||
|
||||
define Package/u-boot/install
|
||||
$(Package/u-boot/install/default)
|
||||
$(INSTALL_BIN) ./files/upload-to-f4040.sh $(1)/
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := fritz4040
|
||||
|
||||
$(eval $(call BuildPackage/U-Boot))
|
||||
41
package/boot/uboot-fritz4040/files/upload-to-f4040.sh
Executable file
41
package/boot/uboot-fritz4040/files/upload-to-f4040.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
die() {
|
||||
echo $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
FRITZBOX='192.168.178.1'
|
||||
USER='adam2'
|
||||
PASSWD='adam2'
|
||||
FILE='uboot-fritz4040.bin'
|
||||
|
||||
ping -q -4 -w 1 -c 1 "$FRITZBOX" &> /dev/null || die "Fritzbox at $FRITZBOX is not reachable. aborting"
|
||||
|
||||
cat << EOS
|
||||
|
||||
This will take ages (2 minutes)! If you want a
|
||||
status bar: Attach a serial to the device and look there.
|
||||
|
||||
Note: If this fails, you need to use AVM\' recover
|
||||
utility to get your box back. However this step
|
||||
should not damage your box....
|
||||
|
||||
Also it doesn't terminate.. :/
|
||||
|
||||
(Note: Make sure that you connected the router on
|
||||
the yellow LAN ports and not the blue WAN).
|
||||
|
||||
EOS
|
||||
|
||||
ftp -n -4 "$FRITZBOX" << END_SCRIPT
|
||||
quote USER $USER
|
||||
quote PASS $PASSWD
|
||||
quote MEDIA FLSH
|
||||
binary
|
||||
passive
|
||||
put $FILE mtd1
|
||||
quote check mtd1
|
||||
bye
|
||||
END_SCRIPT
|
||||
exit 0
|
||||
274
package/boot/uboot-fritz4040/patches/100-private-libgcc.patch
Normal file
274
package/boot/uboot-fritz4040/patches/100-private-libgcc.patch
Normal file
@@ -0,0 +1,274 @@
|
||||
--- a/arch/arm/lib/Makefile
|
||||
+++ b/arch/arm/lib/Makefile
|
||||
@@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk
|
||||
LIB = $(obj)lib$(ARCH).o
|
||||
LIBGCC = $(obj)libgcc.o
|
||||
|
||||
-ifndef CONFIG_SPL_BUILD
|
||||
GLSOBJS += _ashldi3.o
|
||||
GLSOBJS += _ashrdi3.o
|
||||
GLSOBJS += _divsi3.o
|
||||
@@ -34,9 +33,11 @@ GLSOBJS += _lshrdi3.o
|
||||
GLSOBJS += _modsi3.o
|
||||
GLSOBJS += _udivsi3.o
|
||||
GLSOBJS += _umodsi3.o
|
||||
+GLSOBJS += uldivmod.o
|
||||
|
||||
GLCOBJS += div0.o
|
||||
|
||||
+ifndef CONFIG_SPL_BUILD
|
||||
COBJS-y += board.o
|
||||
COBJS-y += bootm.o
|
||||
COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/lib/uldivmod.S
|
||||
@@ -0,0 +1,249 @@
|
||||
+/*
|
||||
+ * Copyright 2010, Google Inc.
|
||||
+ *
|
||||
+ * Brought in from coreboot uldivmod.S
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0
|
||||
+ */
|
||||
+
|
||||
+#include <linux/linkage.h>
|
||||
+#include <asm/assembler.h>
|
||||
+
|
||||
+/*
|
||||
+ * A, Q = r0 + (r1 << 32)
|
||||
+ * B, R = r2 + (r3 << 32)
|
||||
+ * A / B = Q ... R
|
||||
+ */
|
||||
+
|
||||
+#define ARM(x...) x
|
||||
+#define THUMB(x...)
|
||||
+
|
||||
+A_0 .req r0
|
||||
+A_1 .req r1
|
||||
+B_0 .req r2
|
||||
+B_1 .req r3
|
||||
+C_0 .req r4
|
||||
+C_1 .req r5
|
||||
+D_0 .req r6
|
||||
+D_1 .req r7
|
||||
+
|
||||
+Q_0 .req r0
|
||||
+Q_1 .req r1
|
||||
+R_0 .req r2
|
||||
+R_1 .req r3
|
||||
+
|
||||
+THUMB(
|
||||
+TMP .req r8
|
||||
+)
|
||||
+
|
||||
+.pushsection .text.__aeabi_uldivmod, "ax"
|
||||
+ENTRY(__aeabi_uldivmod)
|
||||
+
|
||||
+ stmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) lr}
|
||||
+ @ Test if B == 0
|
||||
+ orrs ip, B_0, B_1 @ Z set -> B == 0
|
||||
+ beq L_div_by_0
|
||||
+ @ Test if B is power of 2: (B & (B - 1)) == 0
|
||||
+ subs C_0, B_0, #1
|
||||
+ sbc C_1, B_1, #0
|
||||
+ tst C_0, B_0
|
||||
+ tsteq B_1, C_1
|
||||
+ beq L_pow2
|
||||
+ @ Test if A_1 == B_1 == 0
|
||||
+ orrs ip, A_1, B_1
|
||||
+ beq L_div_32_32
|
||||
+
|
||||
+L_div_64_64:
|
||||
+/* CLZ only exists in ARM architecture version 5 and above. */
|
||||
+#ifdef HAVE_CLZ
|
||||
+ mov C_0, #1
|
||||
+ mov C_1, #0
|
||||
+ @ D_0 = clz A
|
||||
+ teq A_1, #0
|
||||
+ clz D_0, A_1
|
||||
+ clzeq ip, A_0
|
||||
+ addeq D_0, D_0, ip
|
||||
+ @ D_1 = clz B
|
||||
+ teq B_1, #0
|
||||
+ clz D_1, B_1
|
||||
+ clzeq ip, B_0
|
||||
+ addeq D_1, D_1, ip
|
||||
+ @ if clz B - clz A > 0
|
||||
+ subs D_0, D_1, D_0
|
||||
+ bls L_done_shift
|
||||
+ @ B <<= (clz B - clz A)
|
||||
+ subs D_1, D_0, #32
|
||||
+ rsb ip, D_0, #32
|
||||
+ movmi B_1, B_1, lsl D_0
|
||||
+ARM( orrmi B_1, B_1, B_0, lsr ip )
|
||||
+THUMB( lsrmi TMP, B_0, ip )
|
||||
+THUMB( orrmi B_1, B_1, TMP )
|
||||
+ movpl B_1, B_0, lsl D_1
|
||||
+ mov B_0, B_0, lsl D_0
|
||||
+ @ C = 1 << (clz B - clz A)
|
||||
+ movmi C_1, C_1, lsl D_0
|
||||
+ARM( orrmi C_1, C_1, C_0, lsr ip )
|
||||
+THUMB( lsrmi TMP, C_0, ip )
|
||||
+THUMB( orrmi C_1, C_1, TMP )
|
||||
+ movpl C_1, C_0, lsl D_1
|
||||
+ mov C_0, C_0, lsl D_0
|
||||
+L_done_shift:
|
||||
+ mov D_0, #0
|
||||
+ mov D_1, #0
|
||||
+ @ C: current bit; D: result
|
||||
+#else
|
||||
+ @ C: current bit; D: result
|
||||
+ mov C_0, #1
|
||||
+ mov C_1, #0
|
||||
+ mov D_0, #0
|
||||
+ mov D_1, #0
|
||||
+L_lsl_4:
|
||||
+ cmp B_1, #0x10000000
|
||||
+ cmpcc B_1, A_1
|
||||
+ cmpeq B_0, A_0
|
||||
+ bcs L_lsl_1
|
||||
+ @ B <<= 4
|
||||
+ mov B_1, B_1, lsl #4
|
||||
+ orr B_1, B_1, B_0, lsr #28
|
||||
+ mov B_0, B_0, lsl #4
|
||||
+ @ C <<= 4
|
||||
+ mov C_1, C_1, lsl #4
|
||||
+ orr C_1, C_1, C_0, lsr #28
|
||||
+ mov C_0, C_0, lsl #4
|
||||
+ b L_lsl_4
|
||||
+L_lsl_1:
|
||||
+ cmp B_1, #0x80000000
|
||||
+ cmpcc B_1, A_1
|
||||
+ cmpeq B_0, A_0
|
||||
+ bcs L_subtract
|
||||
+ @ B <<= 1
|
||||
+ mov B_1, B_1, lsl #1
|
||||
+ orr B_1, B_1, B_0, lsr #31
|
||||
+ mov B_0, B_0, lsl #1
|
||||
+ @ C <<= 1
|
||||
+ mov C_1, C_1, lsl #1
|
||||
+ orr C_1, C_1, C_0, lsr #31
|
||||
+ mov C_0, C_0, lsl #1
|
||||
+ b L_lsl_1
|
||||
+#endif
|
||||
+L_subtract:
|
||||
+ @ if A >= B
|
||||
+ cmp A_1, B_1
|
||||
+ cmpeq A_0, B_0
|
||||
+ bcc L_update
|
||||
+ @ A -= B
|
||||
+ subs A_0, A_0, B_0
|
||||
+ sbc A_1, A_1, B_1
|
||||
+ @ D |= C
|
||||
+ orr D_0, D_0, C_0
|
||||
+ orr D_1, D_1, C_1
|
||||
+L_update:
|
||||
+ @ if A == 0: break
|
||||
+ orrs ip, A_1, A_0
|
||||
+ beq L_exit
|
||||
+ @ C >>= 1
|
||||
+ movs C_1, C_1, lsr #1
|
||||
+ movs C_0, C_0, rrx
|
||||
+ @ if C == 0: break
|
||||
+ orrs ip, C_1, C_0
|
||||
+ beq L_exit
|
||||
+ @ B >>= 1
|
||||
+ movs B_1, B_1, lsr #1
|
||||
+ mov B_0, B_0, rrx
|
||||
+ b L_subtract
|
||||
+L_exit:
|
||||
+ @ Note: A, B & Q, R are aliases
|
||||
+ mov R_0, A_0
|
||||
+ mov R_1, A_1
|
||||
+ mov Q_0, D_0
|
||||
+ mov Q_1, D_1
|
||||
+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc}
|
||||
+
|
||||
+L_div_32_32:
|
||||
+ @ Note: A_0 & r0 are aliases
|
||||
+ @ Q_1 r1
|
||||
+ mov r1, B_0
|
||||
+ bl __aeabi_uidivmod
|
||||
+ mov R_0, r1
|
||||
+ mov R_1, #0
|
||||
+ mov Q_1, #0
|
||||
+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc}
|
||||
+
|
||||
+L_pow2:
|
||||
+#ifdef HAVE_CLZ
|
||||
+ @ Note: A, B and Q, R are aliases
|
||||
+ @ R = A & (B - 1)
|
||||
+ and C_0, A_0, C_0
|
||||
+ and C_1, A_1, C_1
|
||||
+ @ Q = A >> log2(B)
|
||||
+ @ Note: B must not be 0 here!
|
||||
+ clz D_0, B_0
|
||||
+ add D_1, D_0, #1
|
||||
+ rsbs D_0, D_0, #31
|
||||
+ bpl L_1
|
||||
+ clz D_0, B_1
|
||||
+ rsb D_0, D_0, #31
|
||||
+ mov A_0, A_1, lsr D_0
|
||||
+ add D_0, D_0, #32
|
||||
+L_1:
|
||||
+ movpl A_0, A_0, lsr D_0
|
||||
+ARM( orrpl A_0, A_0, A_1, lsl D_1 )
|
||||
+THUMB( lslpl TMP, A_1, D_1 )
|
||||
+THUMB( orrpl A_0, A_0, TMP )
|
||||
+ mov A_1, A_1, lsr D_0
|
||||
+ @ Mov back C to R
|
||||
+ mov R_0, C_0
|
||||
+ mov R_1, C_1
|
||||
+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc}
|
||||
+#else
|
||||
+ @ Note: A, B and Q, R are aliases
|
||||
+ @ R = A & (B - 1)
|
||||
+ and C_0, A_0, C_0
|
||||
+ and C_1, A_1, C_1
|
||||
+ @ Q = A >> log2(B)
|
||||
+ @ Note: B must not be 0 here!
|
||||
+ @ Count the leading zeroes in B.
|
||||
+ mov D_0, #0
|
||||
+ orrs B_0, B_0, B_0
|
||||
+ @ If B is greater than 1 << 31, divide A and B by 1 << 32.
|
||||
+ moveq A_0, A_1
|
||||
+ moveq A_1, #0
|
||||
+ moveq B_0, B_1
|
||||
+ @ Count the remaining leading zeroes in B.
|
||||
+ movs B_1, B_0, lsl #16
|
||||
+ addeq D_0, #16
|
||||
+ moveq B_0, B_0, lsr #16
|
||||
+ tst B_0, #0xff
|
||||
+ addeq D_0, #8
|
||||
+ moveq B_0, B_0, lsr #8
|
||||
+ tst B_0, #0xf
|
||||
+ addeq D_0, #4
|
||||
+ moveq B_0, B_0, lsr #4
|
||||
+ tst B_0, #0x3
|
||||
+ addeq D_0, #2
|
||||
+ moveq B_0, B_0, lsr #2
|
||||
+ tst B_0, #0x1
|
||||
+ addeq D_0, #1
|
||||
+ @ Shift A to the right by the appropriate amount.
|
||||
+ rsb D_1, D_0, #32
|
||||
+ mov Q_0, A_0, lsr D_0
|
||||
+ ARM( orr Q_0, Q_0, A_1, lsl D_1 )
|
||||
+ THUMB( lsl A_1, D_1 )
|
||||
+ THUMB( orr Q_0, A_1 )
|
||||
+ mov Q_1, A_1, lsr D_0
|
||||
+ @ Move C to R
|
||||
+ mov R_0, C_0
|
||||
+ mov R_1, C_1
|
||||
+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc}
|
||||
+#endif
|
||||
+
|
||||
+L_div_by_0:
|
||||
+ bl __div0
|
||||
+ @ As wrong as it could be
|
||||
+ mov Q_0, #0
|
||||
+ mov Q_1, #0
|
||||
+ mov R_0, #0
|
||||
+ mov R_1, #0
|
||||
+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc}
|
||||
+ENDPROC(__aeabi_uldivmod)
|
||||
+.popsection
|
||||
32
package/boot/uboot-fritz4040/patches/110-portability.patch
Normal file
32
package/boot/uboot-fritz4040/patches/110-portability.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
Index: u-boot-2017-01-29-6946ebba/fritz/fritzcreator.sh
|
||||
===================================================================
|
||||
--- u-boot-2017-01-29-6946ebba.orig/fritz/fritzcreator.sh
|
||||
+++ u-boot-2017-01-29-6946ebba/fritz/fritzcreator.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/sh -xe
|
||||
+#!/bin/bash -xe
|
||||
|
||||
# A helpful
|
||||
#
|
||||
@@ -11,6 +11,7 @@ UBOOT_FRITZ4040="uboot-fritz4040.bin"
|
||||
FRITZ_DTS="fritz/fritz4040.dts"
|
||||
FRITZ_DTB="fritz4040.dtb"
|
||||
UBOOT_LOADADDR=0x841FFFF8
|
||||
+DTC="${DTC:-dtc}"
|
||||
|
||||
rm -f "$UBOOT_FRITZ4040"
|
||||
|
||||
@@ -44,11 +45,11 @@ printf "\x00\x00\x00\xea\xf8\x01\x33\xc4
|
||||
cat "$UBOOT_BIN" >> "$UBOOT_FRITZ4040"
|
||||
|
||||
# Pad file to 1M
|
||||
-dd if="$UBOOT_FRITZ4040" of="$UBOOT_FRITZ4040.new" bs=1M count=1 conv=sync
|
||||
+dd if="$UBOOT_FRITZ4040" of="$UBOOT_FRITZ4040.new" bs=1024k count=1 conv=sync
|
||||
mv "$UBOOT_FRITZ4040.new" "$UBOOT_FRITZ4040"
|
||||
|
||||
# Compile DTS
|
||||
-dtc "$FRITZ_DTS" -o "$FRITZ_DTB" --space 49152
|
||||
+$DTC "$FRITZ_DTS" -o "$FRITZ_DTB" --space 49152
|
||||
|
||||
# Append the compiled DTBs
|
||||
cat "$FRITZ_DTB" "$FRITZ_DTB" "$FRITZ_DTB" "$FRITZ_DTB" >> $UBOOT_FRITZ4040
|
||||
@@ -0,0 +1,137 @@
|
||||
From: Denis Pynkin <denis.pynkin@collabora.com>
|
||||
Date: Fri, 21 Jul 2017 19:28:42 +0300
|
||||
Subject: [PATCH] net: Use packed structures for networking
|
||||
|
||||
PXE boot is broken with GCC 7.1 due option '-fstore-merging' enabled
|
||||
by default for '-O2':
|
||||
|
||||
BOOTP broadcast 1
|
||||
data abort
|
||||
pc : [<8ff8bb30>] lr : [<00004f1f>]
|
||||
reloc pc : [<17832b30>] lr : [<878abf1f>]
|
||||
sp : 8f558bc0 ip : 00000000 fp : 8ffef5a4
|
||||
r10: 8ffed248 r9 : 8f558ee0 r8 : 8ffef594
|
||||
r7 : 0000000e r6 : 8ffed700 r5 : 00000000 r4 : 8ffed74e
|
||||
r3 : 00060101 r2 : 8ffed230 r1 : 8ffed706 r0 : 00000ddd
|
||||
Flags: nzcv IRQs off FIQs off Mode SVC_32
|
||||
Resetting CPU ...
|
||||
|
||||
Core reason is usage of structures for network headers without packed
|
||||
attribute.
|
||||
|
||||
Reviewed-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
|
||||
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
|
||||
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
|
||||
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
|
||||
[backported from u-boot main]
|
||||
---
|
||||
|
||||
--- a/include/net.h
|
||||
+++ b/include/net.h
|
||||
@@ -182,7 +182,7 @@ struct ethernet_hdr {
|
||||
uchar et_dest[6]; /* Destination node */
|
||||
uchar et_src[6]; /* Source node */
|
||||
ushort et_protlen; /* Protocol or length */
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
/* Ethernet header size */
|
||||
#define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr))
|
||||
@@ -198,7 +198,7 @@ struct e802_hdr {
|
||||
uchar et_snap2;
|
||||
uchar et_snap3;
|
||||
ushort et_prot; /* 802 protocol */
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
/* 802 + SNAP + ethernet header size */
|
||||
#define E802_HDR_SIZE (sizeof(struct e802_hdr))
|
||||
@@ -212,7 +212,7 @@ struct vlan_ethernet_hdr {
|
||||
ushort vet_vlan_type; /* PROT_VLAN */
|
||||
ushort vet_tag; /* TAG of VLAN */
|
||||
ushort vet_type; /* protocol type */
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
/* VLAN Ethernet header size */
|
||||
#define VLAN_ETHER_HDR_SIZE (sizeof(struct vlan_ethernet_hdr))
|
||||
@@ -239,7 +239,7 @@ struct ip_hdr {
|
||||
ushort ip_sum; /* checksum */
|
||||
IPaddr_t ip_src; /* Source IP address */
|
||||
IPaddr_t ip_dst; /* Destination IP address */
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
#define IP_OFFS 0x1fff /* ip offset *= 8 */
|
||||
#define IP_FLAGS 0xe000 /* first 3 bits */
|
||||
@@ -267,7 +267,7 @@ struct ip_udp_hdr {
|
||||
ushort udp_dst; /* UDP destination port */
|
||||
ushort udp_len; /* Length of UDP packet */
|
||||
ushort 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)
|
||||
@@ -306,7 +306,7 @@ struct arp_hdr {
|
||||
uchar ar_tha[]; /* Target hardware address */
|
||||
uchar ar_tpa[]; /* Target protocol address */
|
||||
#endif /* 0 */
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
#define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */
|
||||
|
||||
@@ -341,7 +341,7 @@ struct icmp_hdr {
|
||||
} frag;
|
||||
uchar data[0];
|
||||
} un;
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
#define ICMP_HDR_SIZE (sizeof(struct icmp_hdr))
|
||||
#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE)
|
||||
--- a/net/bootp.h
|
||||
+++ b/net/bootp.h
|
||||
@@ -49,7 +49,7 @@ struct Bootp_t {
|
||||
char bp_sname[64]; /* Server host name */
|
||||
char bp_file[128]; /* Boot file name */
|
||||
char bp_vend[OPT_FIELD_SIZE]; /* Vendor information */
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
#define BOOTP_HDR_SIZE sizeof(struct Bootp_t)
|
||||
|
||||
--- a/net/dns.h
|
||||
+++ b/net/dns.h
|
||||
@@ -32,7 +32,7 @@ struct header {
|
||||
uint16_t nauth; /* Authority PRs */
|
||||
uint16_t nother; /* Other PRs */
|
||||
unsigned char data[1]; /* Data, variable length */
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
extern void DnsStart(void); /* Begin DNS */
|
||||
|
||||
--- a/net/nfs.h
|
||||
+++ b/net/nfs.h
|
||||
@@ -71,7 +71,7 @@ struct rpc_t {
|
||||
uint32_t data[19];
|
||||
} reply;
|
||||
} u;
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
extern void NfsStart(void); /* Begin NFS */
|
||||
|
||||
|
||||
--- a/net/sntp.h
|
||||
+++ b/net/sntp.h
|
||||
@@ -54,7 +54,7 @@ struct sntp_pkt_t {
|
||||
unsigned long long originate_timestamp;
|
||||
unsigned long long receive_timestamp;
|
||||
unsigned long long transmit_timestamp;
|
||||
-};
|
||||
+} __attribute__((packed));
|
||||
|
||||
extern void SntpStart(void); /* Begin SNTP */
|
||||
|
||||
Reference in New Issue
Block a user