[U-Boot] [PATCH] net/bootp: add CONFIG_BOOTP_BOOTFILE

In some cases the TFTP server provides a bootfile name, which does not expects our requirements. Make it possible to not store the TFTP provided bootfile in the environment.
Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com --- README | 4 ++++ net/bootp.c | 2 ++ 2 files changed, 6 insertions(+)
diff --git a/README b/README index aea82be..dc5c153 100644 --- a/README +++ b/README @@ -1921,6 +1921,10 @@ CBFS (Coreboot Filesystem) support CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip environment variable, not the BOOTP server.
+ CONFIG_BOOTP_BOOTFILE - TFTP bootfile will be the bootfile + environment variable, not the filename provided by + BOOTP server. + CONFIG_BOOTP_MAY_FAIL - If the DHCP server is not found after the configured retry count, the call will fail instead of starting over. This can be used to fail over diff --git a/net/bootp.c b/net/bootp.c index 4300f1c..5e76827 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -106,6 +106,7 @@ static void BootpCopyNetParams(struct Bootp_t *bp) memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6); #endif NetCopyIP(&NetOurIP, &bp->bp_yiaddr); +#if !defined(CONFIG_BOOTP_BOOTFILE) if (strlen(bp->bp_file) > 0) copy_filename(BootFile, bp->bp_file, sizeof(BootFile));
@@ -117,6 +118,7 @@ static void BootpCopyNetParams(struct Bootp_t *bp) */ if (*BootFile) setenv("bootfile", BootFile); +#endif }
static int truncate_sz(const char *name, int maxlen, int curlen)

Dear Christian Gmeiner,
In message 1389688171-31688-1-git-send-email-christian.gmeiner@gmail.com you wrote:
In some cases the TFTP server provides a bootfile name, which does not expects our requirements. Make it possible to not store the TFTP provided bootfile in the environment.
There is no need to change the code for that. If you don't like the settings provided by your BOOTP (or rather DHCP?) server, then just don't use them. Otherwise we would have to add new options for all data fields the DHCP server could send, and this would grow into a terrible mess.
In your case, just do the following:
=> setenv autostart no => dhcp => tftp $addr $your_file_name
It is much more efficient to handle such special cases by scripting than adding specialized code for each and every corner case.
Best regards,
Wolfgang Denk

2014-01-15 Wolfgang Denk wd@denx.de:
Dear Christian Gmeiner,
In message 1389688171-31688-1-git-send-email-christian.gmeiner@gmail.com you wrote:
In some cases the TFTP server provides a bootfile name, which does not expects our requirements. Make it possible to not store the TFTP provided bootfile in the environment.
There is no need to change the code for that. If you don't like the settings provided by your BOOTP (or rather DHCP?) server, then just don't use them. Otherwise we would have to add new options for all data fields the DHCP server could send, and this would grow into a terrible mess.
In your case, just do the following:
=> setenv autostart no => dhcp => tftp $addr $your_file_name
It is much more efficient to handle such special cases by scripting than adding specialized code for each and every corner case.
I finally found time to incorporate your feedback and everything works as expected.
thanks for your hint -- Christian Gmeiner, MSc
participants (2)
-
Christian Gmeiner
-
Wolfgang Denk