commit 8d56c697fc86ede96f2e31ba5ad4a3a58f822e41
parent c977a585663c21494c76fbe691b177669172793a
Author: Roberto E. Vargas Caballero <roberto@clue.aero>
Date: Mon, 12 Aug 2019 15:38:27 +0200
[dev] Add a rule in hosted mode to create blkfile
This file is needed by the dummy block driver. At this
moment the user had to create this file before executing
the program in the hosted environment, but this new rule
in the Makefile makes this easier.
This patch also improves the format used in dummyblkinit().
Change-Id: Iabf209338a26eda01a2ebed5724551d7ad7a4060
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/dummyblk.c b/drivers/dummyblk.c
@@ -17,14 +17,11 @@ dummyblkinit(Blk *dev, Attr *attr)
{
static char filename[] = "blkfile";
int fd;
- fd = _open(filename, 0x2);
- if (fd < 0) {
- kerror("ERR blkinit");
+
+ if ((fd = _open(filename, 0x2)) < 0)
panic("blkinit");
- }
dev->data = alloc(sizeof(fd));
*(int *)dev->data = fd;
- return;
}
int
diff --git a/target/hosted/Makefile b/target/hosted/Makefile
@@ -21,7 +21,7 @@ RAMOBJS = arch.o \
TARGET = $(BINDIR)/romfw.elf $(BINDIR)/ramfw.elf
-all: $(TARGET)
+all: $(TARGET) $(BINDIR)/blkfile
$(DIRS): FORCE
cd $@ && $(MAKE)
@@ -38,5 +38,8 @@ $(BINDIR)/romfw.elf: $(ROMOBJS) $(LIBDEP)
$(BINDIR)/ramfw.elf: $(RAMOBJS) $(LIBDEP)
$(LD) $(PROJ_LDFLAGS) $(RAMOBJS) $(PROJ_LDLIBS) -o $@
+$(BINDIR)/blkfile:
+ dd bs=512 count=2 if=/dev/zero of=$(BINDIR)/blkfile
+
clean:
- rm -f romtab.c ramtab.c
+ rm -f romtab.c ramtab.c $(BINDIR)/blkfile