summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/pcmcia/Makefile22
-rw-r--r--mdk-stage1/pcmcia/cardmgr.c6
-rw-r--r--mdk-stage1/pcmcia/pcmcia_probe.c11
3 files changed, 30 insertions, 9 deletions
diff --git a/mdk-stage1/pcmcia/Makefile b/mdk-stage1/pcmcia/Makefile
index e2e670146..fb93f10b8 100644
--- a/mdk-stage1/pcmcia/Makefile
+++ b/mdk-stage1/pcmcia/Makefile
@@ -18,17 +18,31 @@ top_dir = ..
include $(top_dir)/Makefile.common
-all: libpcmcia.a
+all: libpcmcia.a libpcmcia-DIET.a
clean:
rm -f *.o libpcmcia.a
FLAGS = -Wall -Werror -Os -fomit-frame-pointer -pipe -c -I..
-libpcmcia.a: pcmcia_probe.o cardmgr.o lex_config.o yacc_config.o
+
+OBJS = pcmcia_probe.o cardmgr.o lex_config.o yacc_config.o
+
+OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+
+
+libpcmcia.a: $(OBJS)
ar -cru $@ $^
ranlib $@
-.c.o:
- gcc $(FLAGS) $(GLIBC_INCLUDES) $<
+libpcmcia-DIET.a: $(OBJS-DIET)
+ ar -cru $@ $^
+ ranlib $@
+
+
+$(OBJS): %.o: %.c
+ gcc $(FLAGS) $(GLIBC_INCLUDES) -c $< -o $@
+
+$(OBJS-DIET): %-DIET.o: %.c
+ gcc $(FLAGS) $(DIETLIBC_INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/pcmcia/cardmgr.c b/mdk-stage1/pcmcia/cardmgr.c
index 1899d04b8..f461ed180 100644
--- a/mdk-stage1/pcmcia/cardmgr.c
+++ b/mdk-stage1/pcmcia/cardmgr.c
@@ -133,6 +133,7 @@ static int lookup_dev(char *name)
if (f == NULL)
return -errno;
while (fgets(s, 32, f) != NULL) {
+ bzero(t, 32);
if (sscanf(s, "%d %s", &n, t) == 2)
if (strcmp(name, t) == 0)
break;
@@ -146,10 +147,9 @@ static int lookup_dev(char *name)
static int open_dev(dev_t dev, int mode)
{
- char *fn;
+ char * fn = "/tmp/cardmgr_tmp";
int fd;
- if ((fn = tmpnam(NULL)) == NULL)
- return -1;
+ unlink(fn);
if (mknod(fn, mode, dev) != 0)
return -1;
fd = open(fn, (mode&S_IWRITE) ? O_RDWR : O_RDONLY);
diff --git a/mdk-stage1/pcmcia/pcmcia_probe.c b/mdk-stage1/pcmcia/pcmcia_probe.c
index 4cd88d4eb..0d9dd7462 100644
--- a/mdk-stage1/pcmcia/pcmcia_probe.c
+++ b/mdk-stage1/pcmcia/pcmcia_probe.c
@@ -187,7 +187,10 @@ static int i365_probe(void)
log_message("PCMCIA: probing for Intel PCIC (ISA)..");
sock = done = 0;
- ioperm(i365_base, 4, 1);
+ if (ioperm(i365_base, 4, 1)) {
+ log_perror("PCMCIA: ioperm");
+ return -1;
+ }
ioperm(0x80, 1, 1);
for (; sock < 2; sock++) {
val = i365_get(sock, I365_IDENT);
@@ -344,7 +347,11 @@ static int tcic_probe(void)
log_message("PCMCIA: probing for Databook TCIC-2 (ISA)..");
- ioperm(TCIC_BASE, 16, 1);
+ if (ioperm(TCIC_BASE, 16, 1)) {
+ log_perror("PCMCIA: ioperm");
+ return -1;
+ }
+
ioperm(0x80, 1, 1);
sock = tcic_probe_at(TCIC_BASE);