1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 03:59:23 +02:00

M1 build process update

- synchronized patch set with
  http://www.milkymist.org/wiki/index.php?title=Pending_RTEMS_PRs

- switched from using RTEMS CVS to git

- commented out patches already applied in git

- updated softusb-input.h update process
This commit is contained in:
Werner Almesberger 2012-02-25 20:35:09 -03:00
parent 91da747d7f
commit fe7a334808
4 changed files with 356 additions and 4 deletions

View File

@ -0,0 +1,188 @@
commit c4fc8e1f7ebc16926a7b2c64cb433bf03408a04f
Author: Sebastien Bourdeauducq <sebastien@milkymist.org>
Date: Fri Feb 24 21:57:21 2012 +0100
BOOTP/DHCP header cleanup
diff --git a/cpukit/libnetworking/nfs/bootp_subr.c b/cpukit/libnetworking/nfs/bootp_subr.c
index 4021bc6..df8b0c5 100644
--- a/cpukit/libnetworking/nfs/bootp_subr.c
+++ b/cpukit/libnetworking/nfs/bootp_subr.c
@@ -71,9 +71,12 @@
#include <fcntl.h>
#include <rtems/mkrootfs.h>
#include <rtems/rtems_bsdnet.h>
+#include <rtems/rtems_bsdnet_internal.h>
#include <rtems/bsdnet/servers.h>
#include <inttypes.h>
+#include "rtems/bootp.h"
+
#define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */
/*
@@ -138,20 +141,6 @@ void bootpboot_p_rtlist(void);
void bootpboot_p_iflist(void);
#endif
-int bootpc_call(struct bootp_packet *call,
- struct bootp_packet *reply,
- struct proc *procp);
-
-int bootpc_fakeup_interface(struct ifreq *ireq,struct socket *so,
- struct proc *procp);
-
-int
-bootpc_adjust_interface(struct ifreq *ireq,struct socket *so,
- struct sockaddr_in *myaddr,
- struct sockaddr_in *netmask,
- struct sockaddr_in *gw,
- struct proc *procp);
-
#ifdef BOOTP_DEBUG
void
bootpboot_p_sa(struct sockaddr *sa, struct sockaddr *ma)
@@ -271,7 +260,7 @@ bootpboot_p_iflist(void)
* - allocate or reallocate dst, so that string fits in
* - copy string from src to dest
*/
-static void *bootp_strdup_realloc(char *dst,const char *src)
+void *bootp_strdup_realloc(char *dst,const char *src)
{
size_t len;
diff --git a/cpukit/libnetworking/rtems/bootp.h b/cpukit/libnetworking/rtems/bootp.h
new file mode 100644
index 0000000..21bdb79
--- /dev/null
+++ b/cpukit/libnetworking/rtems/bootp.h
@@ -0,0 +1,39 @@
+/* Subroutines from c/src/libnetworking/nfs/bootp_subr.c */
+
+#if !defined (__RTEMS_BOOTP_H__)
+#define __RTEMS_BOOTP_H__
+
+#if __cplusplus
+extern "C"
+{
+#endif
+
+struct bootp_packet;
+struct proc;
+struct ifreq;
+struct socket;
+struct sockaddr_in;
+
+bool bootpc_init(bool, bool);
+
+int bootpc_call(
+ struct bootp_packet *call,
+ struct bootp_packet *reply,
+ struct proc *procp);
+int bootpc_fakeup_interface(struct ifreq *ireq,
+ struct socket *so,
+ struct proc *procp);
+int bootpc_adjust_interface(struct ifreq *ireq,
+ struct socket *so,
+ struct sockaddr_in *myaddr,
+ struct sockaddr_in *netmask,
+ struct sockaddr_in *gw,
+ struct proc *procp);
+
+void *bootp_strdup_realloc(char *dst, const char *src);
+
+#if __cplusplus
+}
+#endif
+
+#endif
diff --git a/cpukit/libnetworking/rtems/rtems_bootp.c b/cpukit/libnetworking/rtems/rtems_bootp.c
index caf2faa..6a644a4 100644
--- a/cpukit/libnetworking/rtems/rtems_bootp.c
+++ b/cpukit/libnetworking/rtems/rtems_bootp.c
@@ -12,6 +12,8 @@
#include <rtems/rtems_bsdnet.h>
#include <rtems/rtems_bsdnet_internal.h>
+#include "rtems/bootp.h"
+
/*
* Perform a BOOTP request
*/
diff --git a/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h b/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
index c8bdfd4..9721e1c 100644
--- a/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
+++ b/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
@@ -179,7 +179,6 @@ void domaininit (void *);
void ifinit (void *);
void ipintr (void);
void arpintr (void);
-bool bootpc_init(bool, bool);
int socket (int, int, int);
int ioctl (int, ioctl_command_t, ...);
diff --git a/cpukit/libnetworking/rtems/rtems_dhcp.c b/cpukit/libnetworking/rtems/rtems_dhcp.c
index e01846e..285ce1e 100644
--- a/cpukit/libnetworking/rtems/rtems_dhcp.c
+++ b/cpukit/libnetworking/rtems/rtems_dhcp.c
@@ -99,6 +99,7 @@
#include <rtems/mkrootfs.h>
#include "rtems/dhcp.h"
+#include "rtems/bootp.h"
#ifndef EALEN
#define EALEN 6
@@ -167,25 +168,6 @@ struct dhcp_packet
};
/*
- * External Declarations for Functions found in
- * rtems/c/src/libnetworking/nfs/
- */
-extern int bootpc_call (struct dhcp_packet *call,
- struct dhcp_packet *reply,
- struct proc *procp);
-extern int bootpc_fakeup_interface (struct ifreq *ireq,
- struct socket *so,
- struct proc *procp);
-extern int bootpc_adjust_interface (struct ifreq *ireq,
- struct socket *so,
- struct sockaddr_in *myaddr,
- struct sockaddr_in *netmask,
- struct sockaddr_in *gw,
- struct proc *procp);
-extern void *bootp_strdup_realloc (char *dst,
- const char *src);
-
-/*
* Variables
*/
static int dhcp_option_overload = 0;
@@ -724,7 +706,7 @@ dhcp_task (rtems_task_argument _sdl)
/*
* Send the Request.
*/
- error = bootpc_call (&call, &dhcp_req, procp);
+ error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&dhcp_req, procp);
if (error) {
rtems_bsdnet_semaphore_release ();
printf ("DHCP call failed -- error %d", error);
@@ -918,7 +900,7 @@ dhcp_init (int update_files)
/*
* Send the Discover.
*/
- error = bootpc_call (&call, &reply, procp);
+ error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&reply, procp);
if (error) {
printf ("BOOTP call failed -- %s\n", strerror(error));
soclose (so);
@@ -947,7 +929,7 @@ dhcp_init (int update_files)
*/
dhcp_request_req (&call, &reply, sdl, true);
- error = bootpc_call (&call, &reply, procp);
+ error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&reply, procp);
if (error) {
printf ("BOOTP call failed -- %s\n", strerror(error));
soclose (so);

View File

@ -0,0 +1,73 @@
commit 27f66fa6a8ea83283b05dcdfa4d70c9048adf448
Author: Sebastien Bourdeauducq <sebastien@milkymist.org>
Date: Fri Feb 24 21:58:20 2012 +0100
Export rtems_shell_init_env, rtems_shell_env_free, rtems_shell_main_mv, rtems_shell_main_cp and rtems_shell_main_rm
diff --git a/cpukit/libmisc/shell/main_mv.c b/cpukit/libmisc/shell/main_mv.c
index 7e3db0f..5cfddc9 100644
--- a/cpukit/libmisc/shell/main_mv.c
+++ b/cpukit/libmisc/shell/main_mv.c
@@ -116,7 +116,7 @@ rtems_shell_mv_exit (rtems_shell_mv_globals* globals, int code)
const char *user_from_uid(uid_t uid, int nouser);
char *group_from_gid(gid_t gid, int nogroup);
-static int
+int
rtems_shell_main_mv(int argc, char *argv[])
{
rtems_shell_mv_globals mv_globals;
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 14b609b..9c4b1d5 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -61,7 +61,7 @@ rtems_shell_env_t *rtems_current_shell_env = &rtems_global_shell_env;
/*
* Initialize the shell user/process environment information
*/
-static rtems_shell_env_t *rtems_shell_init_env(
+rtems_shell_env_t *rtems_shell_init_env(
rtems_shell_env_t *shell_env_p
)
{
@@ -83,7 +83,7 @@ static rtems_shell_env_t *rtems_shell_init_env(
/*
* Completely free a shell_env_t and all associated memory
*/
-static void rtems_shell_env_free(
+void rtems_shell_env_free(
void *ptr
)
{
diff --git a/cpukit/libmisc/shell/shell.h b/cpukit/libmisc/shell/shell.h
index f71cadd..a3abd3e 100644
--- a/cpukit/libmisc/shell/shell.h
+++ b/cpukit/libmisc/shell/shell.h
@@ -207,6 +207,13 @@ bool rtems_shell_main_loop(
rtems_shell_env_t *rtems_shell_env
);
+rtems_shell_env_t *rtems_shell_init_env(
+ rtems_shell_env_t *shell_env_p
+);
+void rtems_shell_env_free(
+ void *ptr
+);
+
extern rtems_shell_env_t rtems_global_shell_env;
extern rtems_shell_env_t *rtems_current_shell_env;
@@ -307,6 +314,13 @@ extern rtems_status_code rtems_shell_wait_for_input(
extern int rtems_shell_main_monitor(int argc, char **argv);
+/*
+ * Provide these commands for application use, as their implementation
+ * is tedious.
+ */
+int rtems_shell_main_mv(int argc, char *argv[]);
+int rtems_shell_main_cp(int argc, char *argv[]);
+int rtems_shell_main_rm(int argc, char *argv[]);
#ifdef __cplusplus
}

View File

@ -0,0 +1,87 @@
commit efedf0ad42d7d8989b62ec7c158b0a0a1f3b4197
Author: Sebastien Bourdeauducq <sebastien@milkymist.org>
Date: Fri Feb 24 23:04:56 2012 +0100
Fix incorrect processing of DNS info from DHCP (revised patch)
diff --git a/cpukit/libnetworking/rtems/rtems_dhcp.c b/cpukit/libnetworking/rtems/rtems_dhcp.c
index 285ce1e..4039a48 100644
--- a/cpukit/libnetworking/rtems/rtems_dhcp.c
+++ b/cpukit/libnetworking/rtems/rtems_dhcp.c
@@ -187,6 +187,35 @@ static const char dhcp_request_parameters[5] = { DHCP_SUBNET,
DHCP_DNS,
DHCP_HOST,
DHCP_DOMAIN_NAME };
+#define NUM_NAMESERVERS \
+ (sizeof rtems_bsdnet_config.name_server / sizeof rtems_bsdnet_config.name_server[0])
+static struct in_addr rtems_dhcpd_nameserver[NUM_NAMESERVERS];
+static int rtems_dhcpd_nameserver_count = 0;
+
+/*
+ * Clean any DNS entries add by a DHCP request.
+ */
+static void
+clean_dns_entries (void)
+{
+ int e;
+ for (e = 0; e < rtems_dhcpd_nameserver_count; ++e)
+ {
+ int n;
+ for (n = 0; n < rtems_bsdnet_nameserver_count; ++ n)
+ {
+ if (memcmp (&rtems_dhcpd_nameserver[e], &rtems_bsdnet_nameserver[n], 4) == 0)
+ {
+ if (n < (NUM_NAMESERVERS - 1))
+ memmove (&rtems_bsdnet_nameserver[n],
+ &rtems_bsdnet_nameserver[n + 1],
+ (NUM_NAMESERVERS - n - 1) * 4);
+ --rtems_bsdnet_nameserver_count;
+ }
+ }
+ }
+ rtems_dhcpd_nameserver_count = 0;
+}
/*
* Format an IP address in dotted decimal.
@@ -345,10 +374,12 @@ process_options (unsigned char *optbuf, int optbufSize)
{
int dlen = 0;
while ((dlen < len) &&
- (rtems_bsdnet_nameserver_count <
- sizeof rtems_bsdnet_config.name_server /
- sizeof rtems_bsdnet_config.name_server[0]))
+ (rtems_dhcpd_nameserver_count < NUM_NAMESERVERS) &&
+ (rtems_bsdnet_nameserver_count < NUM_NAMESERVERS))
{
+ memcpy (&rtems_dhcpd_nameserver
+ [rtems_dhcpd_nameserver_count], p + dlen, 4);
+ rtems_dhcpd_nameserver_count++;
memcpy (&rtems_bsdnet_nameserver
[rtems_bsdnet_nameserver_count], p + dlen, 4);
rtems_bsdnet_nameserver_count++;
@@ -725,6 +756,15 @@ dhcp_task (rtems_task_argument _sdl)
continue;
}
+ /*
+ * We have an ack. Clear the DNS entries that have been assigned by a previous
+ * DHCP request.
+ */
+ clean_dns_entries ();
+
+ /*
+ * Process this requests options.
+ */
process_options (&dhcp_req.vend[4], sizeof (dhcp_req.vend) - 4);
if (dhcp_message_type != DHCP_ACK)
@@ -839,6 +879,8 @@ dhcp_init (int update_files)
struct sockaddr_dl *sdl = NULL;
struct proc *procp = NULL;
+ clean_dns_entries();
+
/*
* If we are to update the files create the root
* file structure.

View File

@ -14,8 +14,12 @@
# milkymist-map-sysfreq.patch - applied 2011-11-27
# milkymist-videoformat.patch - applied 2011-11-27
#fix-timer-includes.patch
milkymist-usb-midi.patch
milkymist-midi-opt.patch # - applied 2011-12-06
fix-ftpd-root.patch # - applied 2012-02-02 796bb3f51cc2a1f7789a3371
mem-fixes.patch # - fixed 2012-02-02
milkymist-usb-midi.patch # https://www.rtems.org/bugzilla/show_bug.cgi?id=2028
#milkymist-midi-opt.patch # - applied 2011-12-06
#fix-ftpd-root.patch # - applied 2012-02-02 796bb3f51cc2a1f7789a3371
#mem-fixes.patch # - fixed 2012-02-02
fix-the-vga-vsync-pulses.patch
# https://www.rtems.org/bugzilla/show_bug.cgi?id=2029
fix-dns-in-dhcp.patch # https://www.rtems.org/bugzilla/show_bug.cgi?id=1841
export-shell-fns.patch # https://www.rtems.org/bugzilla/show_bug.cgi?id=2030
bootp-dhcp-cleanup.patch # https://www.rtems.org/bugzilla/show_bug.cgi?id=2031