* [U-Boot] Question about bootp structure pack
@ 2017-02-21 19:38 rickou at rickou.net
2017-02-26 6:27 ` [U-Boot] [U-boot] " Eric BOUXIROT
0 siblings, 1 reply; 5+ messages in thread
From: rickou at rickou.net @ 2017-02-21 19:38 UTC (permalink / raw)
To: u-boot
Hi everyone,
I?m using u-boot-2015.07 in one of my project based on vpac270 soc module.
u-boot is well configured and build is fine without error.
Gcc is v3.4.5 and glibc v2.3.6 built by crosstool 0.43 for arm-softfloat-linux-gnu
My problem is when i use DHCP command to retrieve a file from my TFTP server, i can?t get any IP from the DHCP server.
After analysing ethernet frames on server side i found that frame do not arrive at all on server.
After checking debug d?tails on U-boot, it seem bootp frame is not good because of some 0x00 paddings Inside the frame. (at end of header for example)
If i add the attribute packed to the bootp header struct and ethernet header, now all is working fine?!
In net/bootp.h?:
struct bootp_hdr {
u8 bp_op; /* Operation */
# define OP_BOOTREQUEST 1
# define OP_BOOTREPLY 2
u8 bp_htype; /* Hardware type */
# define HWT_ETHER 1
u8 bp_hlen; /* Hardware address length */
# define HWL_ETHER 6
u8 bp_hops; /* Hop count (gateway thing) */
u32 bp_id; /* Transaction ID */
u16 bp_secs; /* Seconds since boot */
u16 bp_spare1; /* Alignment */
struct in_addr bp_ciaddr; /* Client IP address */
struct in_addr bp_yiaddr; /* Your (client) IP address */
struct in_addr bp_siaddr; /* Server IP address */
struct in_addr bp_giaddr; /* Gateway IP address */
u8 bp_chaddr[16]; /* Client hardware address */
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_hdr)
And in include/net.h
struct ethernet_hdr {
u8 et_dest[6]; /* Destination node */
u8 et_src[6]; /* Source node */
u16 et_protlen; /* Protocol or length */
} __attribute__((packed));
I think the uboot src should work as is, because I have checked uboot source modification since 2015.07, but no changes on the struct definition and header_size still made with sizeof(struct).
So i think, the problem come from my side and perhaps from gcc itself.
But?i don?t understand why gcc should pack these structs.. i think normal use is to not pack.. except if makefile include some build option to do that, my gcc toolchain do not understand..
Someone can help me to understand what i made wrong?? and help me to resolve this problem without patching ??
Provenance?: Courrier pour Windows 10
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [U-boot] Question about bootp structure pack
2017-02-21 19:38 [U-Boot] Question about bootp structure pack rickou at rickou.net
@ 2017-02-26 6:27 ` Eric BOUXIROT
2017-02-27 9:07 ` Lukasz Majewski
0 siblings, 1 reply; 5+ messages in thread
From: Eric BOUXIROT @ 2017-02-26 6:27 UTC (permalink / raw)
To: u-boot
Hi everyone,
I?m using u-boot-2015.07 in one of my project based on vpac270 soc module.
u-boot is well configured and build is fine without error.
Gcc is v3.4.5 and glibc v2.3.6 built by crosstool 0.43 for
arm-softfloat-linux-gnu
My problem is when i use DHCP command to retrieve a file from my TFTP
server, i can?t get any IP from the DHCP server.
After analysing ethernet frames on server side i found that frame do not
arrive at all on server.
After checking debug d?tails on U-boot, it seem bootp frame is not good
because of some 0x00 paddings Inside the frame. (at end of header for
example)
If i add the attribute packed to the bootp header struct and ethernet
header, now all is working fine !
In net/bootp.h :
struct bootp_hdr {
u8 bp_op; /*
Operation */
# define OP_BOOTREQUEST 1
# define OP_BOOTREPLY 2
u8 bp_htype; /* Hardware
type */
# define HWT_ETHER 1
u8 bp_hlen; /*
Hardware address length */
# define HWL_ETHER 6
u8 bp_hops; /* Hop
count (gateway thing) */
u32 bp_id; /*
Transaction ID */
u16 bp_secs; /* Seconds
since boot */
u16 bp_spare1; /*
Alignment */
struct in_addr bp_ciaddr; /* Client IP
address */
struct in_addr bp_yiaddr; /* Your (client) IP
address */
struct in_addr bp_siaddr; /* Server IP
address */
struct in_addr bp_giaddr; /* Gateway IP
address */
u8 bp_chaddr[16]; /* Client
hardware address */
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_hdr)
And in include/net.h
struct ethernet_hdr {
u8 et_dest[6]; /*
Destination node */
u8 et_src[6]; /*
Source node */
u16 et_protlen; /* Protocol
or length */
} __attribute__((packed));
I think the uboot src should work as is, because I have checked uboot
source modification since 2015.07, but no changes on the struct definition
and header_size still made with sizeof(struct).
So i think, the problem come from my side and perhaps from gcc itself.
But i don?t understand why gcc should pack these structs.. i think normal
use is to not pack.. except if makefile include some build option to do
that, my gcc toolchain do not understand..
Someone can help me to understand what i made wrong ? and help me to
resolve this problem without patching ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [U-boot] Question about bootp structure pack
2017-02-26 6:27 ` [U-Boot] [U-boot] " Eric BOUXIROT
@ 2017-02-27 9:07 ` Lukasz Majewski
2017-03-03 6:45 ` Eric BOUXIROT
2017-03-07 8:59 ` Eric BOUXIROT
0 siblings, 2 replies; 5+ messages in thread
From: Lukasz Majewski @ 2017-02-27 9:07 UTC (permalink / raw)
To: u-boot
On Sun, 26 Feb 2017 07:27:42 +0100
Eric BOUXIROT <rickou@rickou.net> wrote:
> I?m using u-boot-2015.07 in one of my project based on vpac270 soc
> module.
>
> u-boot is well configured and build is fine without error.
>
> Gcc is v3.4.5 and glibc v2.3.6 built by crosstool 0.43 for
> arm-softfloat-linux-gnu
Could you try to use newer gcc and see if bootp is working as expected?
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [U-boot] Question about bootp structure pack
2017-02-27 9:07 ` Lukasz Majewski
@ 2017-03-03 6:45 ` Eric BOUXIROT
2017-03-07 8:59 ` Eric BOUXIROT
1 sibling, 0 replies; 5+ messages in thread
From: Eric BOUXIROT @ 2017-03-03 6:45 UTC (permalink / raw)
To: u-boot
Hi Lukasz,
>> I’m using u-boot-2015.07 in one of my project based on vpac270 soc
>> module.
>>
>> u-boot is well configured and build is fine without error.
>>
>> Gcc is v3.4.5 and glibc v2.3.6 built by crosstool 0.43 for
>> arm-softfloat-linux-gnu
>
> Could you try to use newer gcc and see if bootp is working as expected?
>
>
ok, i will test this, but i think the "normal" build is to NOT pack
theses structs..
and it would be "normal" to get theses alignment gaps inside frame ...
i haven't found in Makefile any options to pack the structs.
have you an explanation about this?? may i miss something in the build
process of uboot...
will let you know soon about testing with another compiler. (have
gcc4.9-linaro toolchain too)
thank !
Eric BOUXIROT
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [U-boot] Question about bootp structure pack
2017-02-27 9:07 ` Lukasz Majewski
2017-03-03 6:45 ` Eric BOUXIROT
@ 2017-03-07 8:59 ` Eric BOUXIROT
1 sibling, 0 replies; 5+ messages in thread
From: Eric BOUXIROT @ 2017-03-07 8:59 UTC (permalink / raw)
To: u-boot
2017-02-27 10:07 GMT+01:00 Lukasz Majewski <lukma@denx.de>:
> On Sun, 26 Feb 2017 07:27:42 +0100
> Eric BOUXIROT <rickou@rickou.net> wrote:
>
>> I’m using u-boot-2015.07 in one of my project based on vpac270 soc
>> module.
>>
>> u-boot is well configured and build is fine without error.
>>
>> Gcc is v3.4.5 and glibc v2.3.6 built by crosstool 0.43 for
>> arm-softfloat-linux-gnu
>
> Could you try to use newer gcc and see if bootp is working as expected?
>
>
> Best regards,
>
> Lukasz Majewski
>
hi Lukasz,
i have made tests with a newer GCC version (4.9 linaro) and it is
working fine without patching the struct definition.
but i don't understand why now it work??
can you help me to understand ??
best regards.
Eric BOUXIROT
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-07 8:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 19:38 [U-Boot] Question about bootp structure pack rickou at rickou.net
2017-02-26 6:27 ` [U-Boot] [U-boot] " Eric BOUXIROT
2017-02-27 9:07 ` Lukasz Majewski
2017-03-03 6:45 ` Eric BOUXIROT
2017-03-07 8:59 ` Eric BOUXIROT
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.