Changeset 13120

Show
Ignore:
Timestamp:
10/21/2009 03:28:40 AM (5 months ago)
Author:
BrainSlayer
Message:

workaround for init deadlock (ar7100 only)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/router/nvram/Makefile

    r11315 r13120  
    2626endif 
    2727#CFLAGS += -g -DDEBUG 
    28 CFLAGS  += -s $(COPTS) -fpic 
     28CFLAGS  += -s $(COPTS) -fPIC 
    2929LDFLAGS += -L. 
    3030ifeq ($(ARCH),powerpc) 
     
    6060CFLAGS += -DHAVE_X86 
    6161endif 
     62ifeq ($(CONFIG_LSX),y) 
     63CFLAGS += -DHAVE_LSX 
     64endif 
    6265ifeq ($(CONFIG_NOWIFI),y) 
    6366CFLAGS += -DHAVE_NOWIFI 
     
    9194libnvram.so: nvram_linux.o nvram_convert.o 
    9295        $(LD) -shared -o $@ $^ 
     96        $(AR) arc -o libnvram.a $^ 
    9397endif 
    9498ifeq ($(ARCH),armeb) 
    9599libnvram.so: nvram_linux.o nvram_convert.o 
    96100        $(LD) -shared -o $@ $^ 
     101        $(AR) arc -o libnvram.a $^ 
    97102endif 
    98103ifeq ($(ARCH),arm) 
    99104libnvram.so: nvram_linux.o nvram_convert.o 
    100105        $(LD) -shared -o $@ $^ 
     106        $(AR) arc -o libnvram.a $^ 
    101107endif 
    102108ifeq ($(ARCH),powerpc) 
    103109libnvram.so: nvram_linux.o nvram_convert.o 
    104110        $(LD) -shared -o $@ $^ 
     111        $(AR) arc -o libnvram.a $^ 
    105112endif 
    106113ifeq ($(ARCH),mips) 
    107114libnvram.so: nvram_linux.o nvram_convert.o 
    108115        $(LD) -shared -o $@ $^ 
     116        $(AR) arc -o libnvram.a $^ 
    109117endif 
    110118ifeq ($(ARCH),mipsel) 
    111119libnvram.so: nvram_linux.o nvram_convert.o 
    112120        $(LD) -shared -o $@ $^ 
     121        $(AR) arc -o libnvram.a $^ 
    113122endif 
    114123convertnvram: convertnvram.o 
  • src/router/nvram/nvram_linux.c

    r12921 r13120  
    6363        while ((in = fopen("/tmp/.nvlock", "rb")) != NULL) { 
    6464                fclose(in); 
    65                 //cprintf ("nvram lock, waiting....\n"); 
     65                fprintf(stderr, "nvram lock, waiting....\n"); 
    6666                lockwait++; 
    6767                if (lockwait == 3) 
     
    226226                exit(1); 
    227227        } 
     228#ifndef HAVE_LSX 
    228229        system("/sbin/ledtool 1"); 
    229 //fprintf(stderr,"nvram_commit \n"); 
     230#endif 
    230231        lock(); 
    231232        int ret; 
    232         //fprintf (stderr, "nvram_commit(): start\n"); 
    233233        if (nvram_fd < 0) { 
    234234                if ((ret = nvram_init(NULL))) { 
     
    244244                perror(PATH_DEV_NVRAM); 
    245245        } 
    246  
    247         fprintf(stderr, "nvram_commit(): end\n"); 
    248246        unlock(); 
    249247        sync(); 
  • src/router/rc/Makefile

    r13110 r13120  
    3131endif 
    3232endif 
     33 
     34cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ 
     35             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) 
     36 
     37 
     38 
     39INITCFLAGS = $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,) 
     40# -fno-guess-branch-probability: prohibit pseudo-random guessing 
     41# of branch probabilities (hopefully makes bloatcheck more stable): 
     42INITCFLAGS += $(call cc-option,-fno-guess-branch-probability,) 
     43INITCFLAGS += $(call cc-option,-funsigned-char -static-libgcc,) 
     44INITCFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,) 
    3345 
    3446#LDFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections 
     
    533545 
    534546clean: 
    535         rm -f *.o *.a rc 
     547        rm -f *.o rc 
    536548        rm -f *.c~ 
    537549 
     
    673685        $(CC) $(CFLAGS) -o process_monitor process_monitor.c ntp.c $(LDFLAGS) 
    674686        $(CC) $(CFLAGS) -o resetbutton resetbutton.c $(LDFLAGS) -lwireless 
    675         $(CC) $(CFLAGS) -o init init.c -L$(TOP)/nvram -I$(LINUXDIR) -L$(INSTALLDIR)/nvram/usr/lib -lnvram -L$(TOP)/libutils -ldl -lutils 
     687ifeq ($(CONFIG_LSX),y) 
     688        $(CC) $(CFLAGS) $(INITCFLAGS) -L$(TOP)/libutils -L$(TOP)/nvram -I$(LINUXDIR) -L$(INSTALLDIR)/nvram/usr/lib -o init init.c $(TOP)/nvram/libnvram.a $(TOP)/libutils/libutils.a 
     689else 
     690        $(CC) $(CFLAGS) $(INITCFLAGS) -L$(TOP)/libutils -L$(TOP)/nvram -I$(LINUXDIR) -L$(INSTALLDIR)/nvram/usr/lib -o init init.c -lnvram -lutils 
     691endif 
    676692        $(CC) $(CFLAGS) -o check_ps check_ps.c $(LDFLAGS) 
    677693        $(CC) $(CFLAGS) -o nvram nvram.c -L../nvram -lnvram 
  • src/router/rc/init.c

    r13109 r13120  
    2929#define _PATH_CONSOLE   "/dev/console" 
    3030 
    31 int sysprintf(const char *fmt, ...) 
    32 { 
    33         char varbuf[256]; 
    34         va_list args; 
    35  
    36         va_start(args, (char *)fmt); 
    37         vsnprintf(varbuf, sizeof(varbuf), fmt, args); 
    38         va_end(args); 
    39         return system(varbuf); 
    40 } 
    4131 
    4232 
     
    583573#endif 
    584574                        cprintf("RESET NVRAM VARS\n"); 
    585                         nvram_set("wl0_lazy_wds", 
    586                                   nvram_safe_get("wl_lazy_wds")); 
     575                        nvram_set("wl0_lazy_wds",nvram_safe_get("wl_lazy_wds")); 
    587576 
    588577                        cprintf("RESTART\n");