source: src/router/services/sysinit/sysinit-pb42.c @ 9114

Last change on this file since 9114 was 9114, checked in by BrainSlayer, 5 years ago

vdsl support for broadcom vlan switch supported routers too

File size: 3.1 KB
Line 
1/*
2 * sysinit-pb42.c
3 *
4 * Copyright (C) 2006 Sebastian Gottschall <gottschall@dd-wrt.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 *
20 * $Id:
21 */
22#include <stdio.h>
23#include <stdlib.h>
24#include <limits.h>
25#include <time.h>
26#include <unistd.h>
27#include <errno.h>
28#include <syslog.h>
29#include <signal.h>
30#include <string.h>
31#include <termios.h>
32#include <sys/klog.h>
33#include <sys/types.h>
34#include <sys/mount.h>
35#include <sys/reboot.h>
36#include <sys/stat.h>
37#include <sys/sysmacros.h>
38#include <sys/time.h>
39#include <sys/utsname.h>
40#include <sys/wait.h>
41#include <sys/ioctl.h>
42
43#include <bcmnvram.h>
44#include <shutils.h>
45#include <utils.h>
46
47#define SIOCGMIIREG     0x8948  /* Read MII PHY register.       */
48#define SIOCSMIIREG     0x8949  /* Write MII PHY register.      */
49#include <arpa/inet.h>
50#include <sys/socket.h>
51#include <linux/if.h>
52#include <linux/sockios.h>
53#include <linux/mii.h>
54
55
56int
57start_sysinit (void)
58{
59  char buf[PATH_MAX];
60  struct utsname name;
61  struct stat tmp_stat;
62  time_t tm = 0;
63  unlink ("/etc/nvram/.lock");
64  cprintf ("sysinit() proc\n");
65  /* /proc */
66  mount ("proc", "/proc", "proc", MS_MGC_VAL, NULL);
67  mount ("sysfs", "/sys", "sysfs", MS_MGC_VAL, NULL);
68  cprintf ("sysinit() tmp\n");
69
70  /* /tmp */
71  mount ("ramfs", "/tmp", "ramfs", MS_MGC_VAL, NULL);
72  // fix for linux kernel 2.6
73  mount ("devpts", "/dev/pts", "devpts", MS_MGC_VAL, NULL);
74  eval ("mkdir", "/tmp/www");
75  eval ("mknod", "/dev/nvram", "c", "229", "0");
76  eval ("mknod", "/dev/ppp", "c", "108", "0");
77
78  unlink ("/tmp/nvram/.lock");
79  eval ("mkdir", "/tmp/nvram");
80
81
82  /* /var */
83  mkdir ("/tmp/var", 0777);
84  mkdir ("/var/lock", 0777);
85  mkdir ("/var/log", 0777);
86  mkdir ("/var/run", 0777);
87  mkdir ("/var/tmp", 0777);
88  cprintf ("sysinit() setup console\n");
89  eval ("/sbin/watchdog");
90  /* Setup console */
91
92  cprintf ("sysinit() klogctl\n");
93  klogctl (8, NULL, atoi (nvram_safe_get ("console_loglevel")));
94  cprintf ("sysinit() get router\n");
95
96  int brand = getRouterBrand ();
97
98
99  /* Modules */
100  uname (&name);
101
102/* network drivers */
103  eval ("insmod", "ag7100_mod");
104
105//eval ("insmod", "ath_pci", "autocreate=none");
106  eval ("insmod", "ath_mimo_pci");
107
108  eval ("ifconfig", "wifi0", "up");
109
110
111
112  eval ("insmod", "ipv6");
113
114  /* Set a sane date */
115  stime (&tm);
116  nvram_set ("wl0_ifname", "ath0");
117
118  return 0;
119  cprintf ("done\n");
120}
121
122int
123check_cfe_nv (void)
124{
125  nvram_set ("portprio_support", "0");
126  return 0;
127}
128
129int
130check_pmon_nv (void)
131{
132  return 0;
133}
134
135void
136start_overclocking (void)
137{
138}
139void enable_dtag_vlan(int enable)
140{
141
142}
Note: See TracBrowser for help on using the repository browser.