[SLOF] [PATCH 1/4] bootmenu: Add framework for a new libbootmenu module
Thomas Huth
thuth at redhat.com
Fri Jun 2 01:25:39 AEST 2017
Adjust the Makefiles and add bootmenu skeleton files.
Signed-off-by: Thomas Huth <thuth at redhat.com>
---
board-qemu/Makefile | 2 +-
board-qemu/slof/Makefile | 9 +++++---
lib/Makefile | 2 +-
lib/libbootmenu/Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++
lib/libbootmenu/bootmenu.c | 21 +++++++++++++++++++
lib/libbootmenu/bootmenu.code | 20 ++++++++++++++++++
lib/libbootmenu/bootmenu.h | 15 +++++++++++++
lib/libbootmenu/bootmenu.in | 15 +++++++++++++
8 files changed, 128 insertions(+), 5 deletions(-)
create mode 100644 lib/libbootmenu/Makefile
create mode 100644 lib/libbootmenu/bootmenu.c
create mode 100644 lib/libbootmenu/bootmenu.code
create mode 100644 lib/libbootmenu/bootmenu.h
create mode 100644 lib/libbootmenu/bootmenu.in
diff --git a/board-qemu/Makefile b/board-qemu/Makefile
index 7208fcc..61a1367 100644
--- a/board-qemu/Makefile
+++ b/board-qemu/Makefile
@@ -15,7 +15,7 @@ BOARD_TARGETS = tools_build romfs_build stage1 subdirs
SUBDIRS = slof
COMMON_LIBS = libc libbootmsg libbases libnvram libelf libhvcall libvirtio \
- libusb libveth libe1k libnet
+ libusb libveth libe1k libnet libbootmenu
all: $(BOARD_TARGETS)
$(MAKE) boot_rom.bin
diff --git a/board-qemu/slof/Makefile b/board-qemu/slof/Makefile
index 02d819b..2263e75 100644
--- a/board-qemu/slof/Makefile
+++ b/board-qemu/slof/Makefile
@@ -21,7 +21,8 @@ all: version.o Makefile.dep OF.ffs paflof $(SLOFCMNDIR)/xvect.bin
CPPFLAGS = -I$(LIBCMNDIR)/libbootmsg -I$(LIBCMNDIR)/libhvcall \
-I$(LIBCMNDIR)/libvirtio -I$(LIBCMNDIR)/libnvram \
-I$(LIBCMNDIR)/libusb -I$(LIBCMNDIR)/libveth \
- -I$(LIBCMNDIR)/libe1k -I$(LIBCMNDIR)/libnet
+ -I$(LIBCMNDIR)/libe1k -I$(LIBCMNDIR)/libnet \
+ -I$(LIBCMNDIR)/libbootmenu
SLOF_LIBS = \
$(LIBCMNDIR)/libbootmsg.a \
$(LIBCMNDIR)/libelf.a \
@@ -31,7 +32,8 @@ SLOF_LIBS = \
$(LIBCMNDIR)/libnvram.a \
$(LIBCMNDIR)/libveth.a \
$(LIBCMNDIR)/libe1k.a \
- $(LIBCMNDIR)/libnet.a
+ $(LIBCMNDIR)/libnet.a \
+ $(LIBCMNDIR)/libbootmenu.a
BOARD_SLOF_IN = \
$(LIBCMNDIR)/libhvcall/hvcall.in \
$(LIBCMNDIR)/libvirtio/virtio.in \
@@ -42,7 +44,8 @@ BOARD_SLOF_IN = \
$(LIBCMNDIR)/libbases/libbases.in \
$(LIBCMNDIR)/libveth/veth.in \
$(LIBCMNDIR)/libe1k/e1k.in \
- $(LIBCMNDIR)/libnet/libnet.in
+ $(LIBCMNDIR)/libnet/libnet.in \
+ $(LIBCMNDIR)/libbootmenu/bootmenu.in
BOARD_SLOF_CODE = $(BOARD_SLOF_IN:%.in=%.code)
include $(SLOFCMNDIR)/Makefile.inc
diff --git a/lib/Makefile b/lib/Makefile
index 6d9db66..a4d4bb2 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -11,7 +11,7 @@
# ****************************************************************************/
SUBDIRS = libc libipmi libbootmsg libbases libnvram libelf libhvcall libvirtio \
- libusb libveth libe1k libbcm libnet
+ libusb libveth libe1k libbcm libnet libbootmenu
all: subdirs
diff --git a/lib/libbootmenu/Makefile b/lib/libbootmenu/Makefile
new file mode 100644
index 0000000..1ea42b7
--- /dev/null
+++ b/lib/libbootmenu/Makefile
@@ -0,0 +1,49 @@
+# *****************************************************************************
+# * Copyright (c) 2004, 2008 IBM Corporation
+# * All rights reserved.
+# * This program and the accompanying materials
+# * are made available under the terms of the BSD License
+# * which accompanies this distribution, and is available at
+# * http://www.opensource.org/licenses/bsd-license.php
+# *
+# * Contributors:
+# * IBM Corporation - initial implementation
+# ****************************************************************************/
+
+ifndef TOP
+ TOP = $(shell while ! test -e make.rules; do cd .. ; done; pwd)
+ export TOP
+endif
+include $(TOP)/make.rules
+
+CFLAGS += -I. -I.. -I../libc/include -I$(TOP)/slof -I$(TOP)/include
+
+SRCS = bootmenu.c
+
+OBJS = $(SRCS:%.c=%.o)
+
+TARGET = ../libbootmenu.a
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(AR) -rc $@ $(OBJS)
+ $(RANLIB) $@
+
+clean:
+ $(RM) $(TARGET) $(OBJS)
+
+distclean: clean
+ $(RM) Makefile.dep
+
+
+# Rules for creating the dependency file:
+depend:
+ $(RM) Makefile.dep
+ $(MAKE) Makefile.dep
+
+Makefile.dep: Makefile
+ $(CC) -M $(CPPFLAGS) $(CFLAGS) $(SRCS) > Makefile.dep
+
+# Include dependency file if available:
+-include Makefile.dep
diff --git a/lib/libbootmenu/bootmenu.c b/lib/libbootmenu/bootmenu.c
new file mode 100644
index 0000000..d8d00cb
--- /dev/null
+++ b/lib/libbootmenu/bootmenu.c
@@ -0,0 +1,21 @@
+/*****************************************************************************
+ * Boot menu: Displays boot devices and waits for user to select one
+ *
+ * Copyright 2017 Red Hat, Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * Thomas Huth, Red Hat Inc. - initial implementation
+ *****************************************************************************/
+
+#include <string.h>
+#include <stdio.h>
+#include "bootmenu.h"
+
+void bootmenu(void)
+{
+}
diff --git a/lib/libbootmenu/bootmenu.code b/lib/libbootmenu/bootmenu.code
new file mode 100644
index 0000000..f51784d
--- /dev/null
+++ b/lib/libbootmenu/bootmenu.code
@@ -0,0 +1,20 @@
+/*****************************************************************************
+ * Boot menu: Glue code to Forth
+ *
+ * Copyright 2017 Red Hat, Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * Thomas Huth, Red Hat Inc. - initial implementation
+ *****************************************************************************/
+
+#include "bootmenu.h"
+
+// ( -- )
+PRIM(boot_X2d_menu)
+ bootmenu();
+MIRP
diff --git a/lib/libbootmenu/bootmenu.h b/lib/libbootmenu/bootmenu.h
new file mode 100644
index 0000000..6cef237
--- /dev/null
+++ b/lib/libbootmenu/bootmenu.h
@@ -0,0 +1,15 @@
+/*****************************************************************************
+ * Boot menu definitions
+ *
+ * Copyright 2017 Red Hat, Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * Thomas Huth, Red Hat Inc. - initial implementation
+ *****************************************************************************/
+
+extern void bootmenu(void);
diff --git a/lib/libbootmenu/bootmenu.in b/lib/libbootmenu/bootmenu.in
new file mode 100644
index 0000000..5cb120e
--- /dev/null
+++ b/lib/libbootmenu/bootmenu.in
@@ -0,0 +1,15 @@
+/*****************************************************************************
+ * Boot menu: Definitions for Forth
+ *
+ * Copyright 2017 Red Hat, Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the BSD License
+ * which accompanies this distribution, and is available at
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * Contributors:
+ * Thomas Huth, Red Hat Inc. - initial implementation
+ *****************************************************************************/
+
+cod(boot-menu)
--
1.8.3.1
More information about the SLOF
mailing list