Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/stand Merge and share boot.c between normal bo...
details: https://anonhg.NetBSD.org/src/rev/b9f036c66197
branches: trunk
changeset: 330355:b9f036c66197
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jul 06 06:28:49 2014 +0000
description:
Merge and share boot.c between normal boot and netboot by dumb #ifdefs.
Tested on XM6i.
diffstat:
sys/arch/x68k/stand/boot/Makefile | 3 +-
sys/arch/x68k/stand/boot/boot.c | 56 +++++++-
sys/arch/x68k/stand/netboot/Makefile | 4 +-
sys/arch/x68k/stand/netboot/boot.c | 258 -----------------------------------
4 files changed, 59 insertions(+), 262 deletions(-)
diffs (truncated from 482 to 300 lines):
diff -r fb02b14163a3 -r b9f036c66197 sys/arch/x68k/stand/boot/Makefile
--- a/sys/arch/x68k/stand/boot/Makefile Sun Jul 06 05:32:30 2014 +0000
+++ b/sys/arch/x68k/stand/boot/Makefile Sun Jul 06 06:28:49 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2012/03/20 12:37:01 minoura Exp $
+# $NetBSD: Makefile,v 1.23 2014/07/06 06:28:49 tsutsui Exp $
NOMAN= # defined
@@ -41,6 +41,7 @@
CPPFLAGS+= -DTEXTADDR="0x${TEXT}"
CPPFLAGS+= -DBOOT=\"${BOOT}\" -DBOOT_VERS=\"${VERSION}\"
CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
+#CPPFLAGS+= -DDEBUG
CFLAGS= -Wno-main -Os -m68020-60
LINKFLAGS= -N -static -T ${.CURDIR}/boot.ldscript
LIBIOCS!= cd $M/stand/libiocs && ${PRINTOBJDIR}
diff -r fb02b14163a3 -r b9f036c66197 sys/arch/x68k/stand/boot/boot.c
--- a/sys/arch/x68k/stand/boot/boot.c Sun Jul 06 05:32:30 2014 +0000
+++ b/sys/arch/x68k/stand/boot/boot.c Sun Jul 06 06:28:49 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.19 2014/07/06 05:31:02 tsutsui Exp $ */
+/* $NetBSD: boot.c,v 1.20 2014/07/06 06:28:49 tsutsui Exp $ */
/*
* Copyright (c) 2001 Minoura Makoto
@@ -32,6 +32,9 @@
#include <lib/libsa/stand.h>
#include <lib/libsa/loadfile.h>
#include <lib/libsa/ufs.h>
+#ifdef NETBOOT
+#include <lib/libsa/dev_net.h>
+#endif
#include <lib/libkern/libkern.h>
#include "libx68k.h"
@@ -46,21 +49,38 @@
#define SRAM_MEMSIZE (*((long*) 0x00ed0008))
char default_kernel[20] =
+#ifndef NETBOOT
"sd0a:netbsd";
+#else
+ "nfs:netbsd";
+#endif
int mpu;
+#ifndef NETBOOT
int hostadaptor;
+#endif
int console_device = -1;
+#ifdef DEBUG
+#ifdef NETBOOT
+int debug = 1;
+#endif
+#endif
+
static void help(void);
+#ifndef NETBOOT
static int get_scsi_host_adapter(void);
+#endif
static void doboot(const char *, int);
static void boot(char *);
+#ifndef NETBOOT
static void cmd_ls(char *);
+#endif
int bootmenu(void);
void bootmain(int);
extern int detectmpu(void);
extern int badbaddr(void *);
+#ifndef NETBOOT
/* from boot_ufs/bootmain.c */
static int
get_scsi_host_adapter(void)
@@ -83,19 +103,25 @@
return ha;
}
-
+#endif
static void
help(void)
{
printf("Usage:\n");
printf("boot [dev:][file] -[flags]\n");
+#ifndef NETBOOT
printf(" dev: sd<ID><PART>, ID=0-7, PART=a-p\n");
printf(" cd<ID>a, ID=0-7\n");
printf(" fd<UNIT>a, UNIT=0-3, format is detected.\n");
+#else
+ printf(" dev: nfs, first probed NE2000 is used.\n");
+#endif
printf(" file: netbsd, netbsd.gz, etc.\n");
printf(" flags: abdqsv\n");
+#ifndef NETBOOT
printf("ls [dev:][directory]\n");
+#endif
printf("halt\nreboot\n");
}
@@ -127,10 +153,16 @@
}
#ifdef DEBUG
+#ifndef NETBOOT
printf("dev = %x, unit = %d, part = %c, name = %s\n",
dev, unit, part + 'a', name);
+#else
+ printf("dev = %x, unit = %d, name = %s\n",
+ dev, unit, name);
+#endif
#endif
+#ifndef NETBOOT
if (dev == 0) { /* SCSI */
dev = X68K_MAKESCSIBOOTDEV(X68K_MAJOR_SD,
hostadaptor >> 4,
@@ -139,14 +171,23 @@
} else {
dev = X68K_MAKEBOOTDEV(X68K_MAJOR_FD, unit & 3, 0);
}
+#else
+ dev = X68K_MAKEBOOTDEV(X68K_MAJOR_NE, unit, 0);
+#endif
#ifdef DEBUG
printf("boot device = %x\n", dev);
+#ifndef NETBOOT
printf("if = %d, unit = %d, id = %d, lun = %d, part = %c\n",
B_X68K_SCSI_IF(dev),
B_X68K_SCSI_IF_UN(dev),
B_X68K_SCSI_ID(dev),
B_X68K_SCSI_LUN(dev),
B_X68K_SCSI_PART(dev) + 'a');
+#else
+ printf("if = %d, unit = %d\n",
+ B_X68K_SCSI_IF(dev),
+ B_X68K_SCSI_IF_UN(dev));
+#endif
#endif
p = ((short*) marks[MARK_ENTRY]) - 1;
@@ -208,6 +249,7 @@
}
}
+#ifndef NETBOOT
static void
cmd_ls(char *arg)
{
@@ -228,6 +270,7 @@
ls(filename);
devopen_open_dir = 0;
}
+#endif
int
bootmenu(void)
@@ -275,8 +318,10 @@
else if (strcmp("halt", p) == 0 ||
strcmp("reboot", p) == 0)
exit(0);
+#ifndef NETBOOT
else if (strcmp("ls", p) == 0)
cmd_ls(options);
+#endif
else
printf("Unknown command %s\n", p);
}
@@ -295,7 +340,12 @@
bootmain(int bootdev)
{
+#ifndef NETBOOT
hostadaptor = get_scsi_host_adapter();
+#else
+ rtc_offset = RTC_OFFSET;
+ try_bootp = 1;
+#endif
mpu = detectmpu();
if (mpu < 3) { /* not tested on 68020 */
@@ -310,6 +360,7 @@
console_device = consio_init(console_device);
setheap(HEAP_START, HEAP_END);
+#ifndef NETBOOT
switch (B_TYPE(bootdev)) {
case X68K_MAJOR_FD:
default_kernel[0] = 'f';
@@ -330,6 +381,7 @@
default:
printf("Warning: unknown boot device: %x\n", bootdev);
}
+#endif
print_title("%s, Revision %s\n", bootprog_name, bootprog_rev);
bootmenu();
}
diff -r fb02b14163a3 -r b9f036c66197 sys/arch/x68k/stand/netboot/Makefile
--- a/sys/arch/x68k/stand/netboot/Makefile Sun Jul 06 05:32:30 2014 +0000
+++ b/sys/arch/x68k/stand/netboot/Makefile Sun Jul 06 06:28:49 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2012/11/01 14:46:26 isaki Exp $
+# $NetBSD: Makefile,v 1.3 2014/07/06 06:28:49 tsutsui Exp $
NOMAN= # defined
@@ -47,9 +47,11 @@
CPPFLAGS+= -D_STANDALONE -DHEAP_VARIABLE
CPPFLAGS+= -DTEXTADDR="0x${TEXT}"
CPPFLAGS+= -DBOOT=\"${BOOT}\" -DBOOT_VERS=\"${VERSION}\"
+CPPFLAGS+= -DNETBOOT
CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
CPPFLAGS+= -DRTC_OFFSET=${RTC_OFFSET}
CPPFLAGS+= -DSUPPORT_BOOTP -DSUPPORT_DHCP
+#CPPFLAGS+= -DDEBUG
CFLAGS= -Wno-main -Os -m68020-60
LINKFLAGS= -N -static -T ${BOOTDIR}/boot.ldscript
LIBIOCS!= cd $M/stand/libiocs && ${PRINTOBJDIR}
diff -r fb02b14163a3 -r b9f036c66197 sys/arch/x68k/stand/netboot/boot.c
--- a/sys/arch/x68k/stand/netboot/boot.c Sun Jul 06 05:32:30 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-/* $NetBSD: boot.c,v 1.3 2014/07/06 05:31:03 tsutsui Exp $ */
-
-/*
- * Copyright (c) 2001 Minoura Makoto
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <machine/bootinfo.h>
-
-#include <lib/libsa/stand.h>
-#include <lib/libsa/loadfile.h>
-#include <lib/libsa/ufs.h>
-#include <lib/libsa/dev_net.h>
-#include <lib/libkern/libkern.h>
-
-#include "libx68k.h"
-#include "iocs.h"
-
-#include "exec_image.h"
-
-
-#define HEAP_START ((void*) 0x00080000)
-#define HEAP_END ((void*) 0x000fffff)
-#define EXSCSI_BDID ((void*) 0x00ea0001)
-#define SRAM_MEMSIZE (*((long*) 0x00ed0008))
-
-char default_kernel[20] =
- "nfs:netbsd";
-int mpu;
-int console_device = -1;
-
-#ifdef DEBUG
-int debug = 1;
-#endif
-
-static void help(void);
-static void doboot(const char *, int);
-static void boot(char *);
-int bootmenu(void);
-void bootmain(int);
-extern int detectmpu(void);
-extern int badbaddr(void *);
-
-static void
-help(void)
-{
- printf("Usage:\n");
- printf("boot [dev:][file] -[flags]\n");
- printf(" dev: nfs, first probed NE2000 is used.\n");
- printf(" file: netbsd, netbsd.gz, etc.\n");
- printf(" flags: abdqsv\n");
- printf("halt\nreboot\n");
-}
-
Home |
Main Index |
Thread Index |
Old Index