CVS commit: [netbsd-9] src/usr.sbin/installboot

2019-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 22 10:20:16 UTC 2019

Modified Files:
src/usr.sbin/installboot [netbsd-9]: evboards.c evboards.h

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #210):

usr.sbin/installboot/evboards.h: revision 1.2
usr.sbin/installboot/evboards.c: revision 1.3

Add support for additional install step directives to enable using
installboot(8) to write u-boot images to SPI NOR and other types of
raw flash devices: input-block-size, input-pad-size, output-size, and
output-block-size.

Add the ability to create aliases for install objects, useful for when
e.g. sdmmc and emmc share the same steps.

Tested on an A20-OLinuXino-LIME2-e16Gs16M by bouyer@.
XXX pullup netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/usr.sbin/installboot/evboards.c
cvs rdiff -u -r1.1 -r1.1.4.1 src/usr.sbin/installboot/evboards.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/installboot/evboards.c
diff -u src/usr.sbin/installboot/evboards.c:1.2 src/usr.sbin/installboot/evboards.c:1.2.4.1
--- src/usr.sbin/installboot/evboards.c:1.2	Sun May 12 13:47:09 2019
+++ src/usr.sbin/installboot/evboards.c	Sun Sep 22 10:20:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: evboards.c,v 1.2 2019/05/12 13:47:09 maya Exp $	*/
+/*	$NetBSD: evboards.c,v 1.2.4.1 2019/09/22 10:20:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -35,10 +35,11 @@
 
 #include 
 #if !defined(__lint)
-__RCSID("$NetBSD: evboards.c,v 1.2 2019/05/12 13:47:09 maya Exp $");
+__RCSID("$NetBSD: evboards.c,v 1.2.4.1 2019/09/22 10:20:16 martin Exp $");
 #endif  /* !__lint */
 
 #include 
+#include 		/* for roundup() */
 #include 
 #include 
 #include 
@@ -199,6 +200,7 @@ __RCSID("$NetBSD: evboards.c,v 1.2 2019/
  *		  --	"u-boot-install-sdmmc"	(for SD cards)
  *		  --	"u-boot-install-emmc"	(for eMMC modules)
  *		  --	"u-boot-install-usb"	(for USB block storage)
+ *		  --	"u-boot-install-spi"	(for SPI NOR flash)
  *		  --
  *		  -- These installation steps will be selectable using
  *		  -- the "media=..." option to installboot(8).
@@ -324,6 +326,91 @@ __RCSID("$NetBSD: evboards.c,v 1.2 2019/
  *			512
  *		
  *	
+ *
+ * There are some addditional directives for installing on raw flash devices:
+ *
+ *	u-boot-install-spi
+ *	
+ *		
+ *			input-block-size
+ *			2048
+ *
+ *			
+ *			input-pad-size
+ *			2048
+ *
+ *			
+ *			output-size
+ *			2097152
+ *
+ *			<-- Key: "output-block-size"
+ *			 -- Value: an integer specifying the size of
+ *			 --the blocks used to write to the
+ *			 --output device.  If the output device
+ *			 --simulates a disk block storage device,
+ *			 --then this value must be a multiple of
+ *			 --the reported sector size.
+ *			 -- (optional)
+ *			 -->
+ *			output-block-size
+ *			65536
+ *		
+ *	
+ *
+ * For boards that require a media specification to be provided, it
+ * may be the case that two media types have identical steps.  It
+ * could be confusing for users to see a list of media types that does
+ * not include the media type on which they are installing, so there
+ * is an alias capability:
+ *
+ *	u-boot-install-spi
+ *	
+ *		.
+ *		.
+ *		.
+ *	
+ *	u-boot-install-sdmmc
+ *	
+ *		.
+ *		.
+ *		.
+ *	
+ *	<-- Steps for eMMC are identical to SDMMC on this board. -->
+ *	u-boot-install-emmc
+ *	u-boot-install-sdmmc
  */
 
 /*
@@ -466,6 +553,10 @@ static const char step_file_name_key[] =
 static const char step_file_offset_key[] = "file-offset";
 static const char step_file_size_key[] = "file-size";
 static const char step_image_offset_key[] = "image-offset";
+static const char step_input_block_size_key[] = "input-block-size";
+static const char step_input_pad_size_key[] = "input-pad-size";
+static const char step_output_size_key[] = "output-size";
+static const char step_output_block_size_key[] = "output-block-size";
 static const char step_preserve_key[] = "preserve";
 
 static bool
@@ -474,11 +565,15 @@ validate_ubstep_object(evb_ubstep obj)
 	/*
 	 * evb_ubstep is a dictionary with the following keys:
 	 *
-	 *	"file-name"	(string) (required)
-	 *	"file-offset"	(number) (optional)
-	 *	"file-size"	(number) (optional)
-	 *	"image-offset"	(number) (optional)
-	 *	"preserve"	(bool)	 (optional)
+	 *	"file-name" (string) (required)
+	 *	"file-offset"   (number) (optional)
+	 *	"file-size" (number) (optional)
+	 *	"image-offset"  (number) (optional)
+	 *	"input-block-size"  (number) (optional)
+	 *	"input-pad-size"(number) (optional)
+	 *	"output-size"   (number) (optional)
+	 *	"output-block-size" (number) (optional)
+	 *	"preserve"  (bool)   (optional)
 	 */
 	if (prop_object_type(obj) != PROP_TYPE_DICTIONARY)
 		return false;
@@ -505,6 +600,37 @@ validate_ubstep_object(evb_ubstep obj)
 	prop_object_type(v) != PRO

CVS commit: [netbsd-9] src/usr.sbin/installboot

2019-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 22 10:20:16 UTC 2019

Modified Files:
src/usr.sbin/installboot [netbsd-9]: evboards.c evboards.h

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #210):

usr.sbin/installboot/evboards.h: revision 1.2
usr.sbin/installboot/evboards.c: revision 1.3

Add support for additional install step directives to enable using
installboot(8) to write u-boot images to SPI NOR and other types of
raw flash devices: input-block-size, input-pad-size, output-size, and
output-block-size.

Add the ability to create aliases for install objects, useful for when
e.g. sdmmc and emmc share the same steps.

Tested on an A20-OLinuXino-LIME2-e16Gs16M by bouyer@.
XXX pullup netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/usr.sbin/installboot/evboards.c
cvs rdiff -u -r1.1 -r1.1.4.1 src/usr.sbin/installboot/evboards.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-9] src/usr.sbin/installboot

2019-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 21 08:28:53 UTC 2019

Modified Files:
src/usr.sbin/installboot [netbsd-9]: Makefile machines.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #80):
usr.sbin/installboot/Makefile: revision 1.53
usr.sbin/installboot/Makefile: revision 1.54
usr.sbin/installboot/machines.c: revision 1.41
usr.sbin/installboot/machines.c: revision 1.42
Replace black voodo linker magic (sometimes failing) with some
makefile + macro magic to trim the list of available machines on size
restricted install media.
Never trust a compiler that predefines i386 as 1 - do the symbol name
concatenation at the make level instead.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.2.1 src/usr.sbin/installboot/Makefile
cvs rdiff -u -r1.40 -r1.40.2.1 src/usr.sbin/installboot/machines.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/installboot/Makefile
diff -u src/usr.sbin/installboot/Makefile:1.52 src/usr.sbin/installboot/Makefile:1.52.2.1
--- src/usr.sbin/installboot/Makefile:1.52	Tue May  7 05:02:42 2019
+++ src/usr.sbin/installboot/Makefile	Wed Aug 21 08:28:53 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.52 2019/05/07 05:02:42 thorpej Exp $
+#	$NetBSD: Makefile,v 1.52.2.1 2019/08/21 08:28:53 msaitoh Exp $
 #
 
 .include 
@@ -27,6 +27,7 @@ ARCH_FILES?= ${ARCH_XLAT:M${MACHINE}-*:S
 .if empty(ARCH_FILES)
 ARCH_FILES= ${MACHINE}.c
 .endif
+COPTS.machines.c+=	-DSINGLE_ARCH=ib_mach_${MACHINE}
 .endif
 
 SRCS+=${ARCH_FILES}

Index: src/usr.sbin/installboot/machines.c
diff -u src/usr.sbin/installboot/machines.c:1.40 src/usr.sbin/installboot/machines.c:1.40.2.1
--- src/usr.sbin/installboot/machines.c:1.40	Tue May  7 05:02:42 2019
+++ src/usr.sbin/installboot/machines.c	Wed Aug 21 08:28:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machines.c,v 1.40 2019/05/07 05:02:42 thorpej Exp $	*/
+/*	$NetBSD: machines.c,v 1.40.2.1 2019/08/21 08:28:53 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 The NetBSD Foundation, Inc.
@@ -35,41 +35,16 @@
 
 #include 
 #if !defined(__lint)
-__RCSID("$NetBSD: machines.c,v 1.40 2019/05/07 05:02:42 thorpej Exp $");
+__RCSID("$NetBSD: machines.c,v 1.40.2.1 2019/08/21 08:28:53 msaitoh Exp $");
 #endif	/* !__lint */
 
 #include 
 #include "installboot.h"
 
-/*
- * Define these here so they end up as zero-filled bss if installboot
- * isn't built with all the architectures defined.
- * A lot simpler that conditionally including the definitions themselves.
- */
-struct ib_mach
-ib_mach_alpha,
-ib_mach_amd64,
-ib_mach_amiga,
-ib_mach_emips,
-ib_mach_evbarm,
-ib_mach_ews4800mips,
-ib_mach_hp300,
-ib_mach_hppa,
-ib_mach_i386,
-ib_mach_landisk,
-ib_mach_macppc,
-ib_mach_news68k,
-ib_mach_newsmips,
-ib_mach_next68k,
-ib_mach_pmax,
-ib_mach_sparc,
-ib_mach_sparc64,
-ib_mach_sun2,
-ib_mach_sun3,
-ib_mach_vax,
-ib_mach_x68k;
-
 struct ib_mach * const machines[] = {
+#ifdef	SINGLE_ARCH
+&SINGLE_ARCH,
+#else
 &ib_mach_alpha,
 &ib_mach_amd64,
 &ib_mach_amiga,
@@ -91,6 +66,7 @@ struct ib_mach * const machines[] = {
 &ib_mach_sun3,
 &ib_mach_vax,
 &ib_mach_x68k,
+#endif
 NULL
 };
 



CVS commit: [netbsd-9] src/usr.sbin/installboot

2019-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 21 08:28:53 UTC 2019

Modified Files:
src/usr.sbin/installboot [netbsd-9]: Makefile machines.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #80):
usr.sbin/installboot/Makefile: revision 1.53
usr.sbin/installboot/Makefile: revision 1.54
usr.sbin/installboot/machines.c: revision 1.41
usr.sbin/installboot/machines.c: revision 1.42
Replace black voodo linker magic (sometimes failing) with some
makefile + macro magic to trim the list of available machines on size
restricted install media.
Never trust a compiler that predefines i386 as 1 - do the symbol name
concatenation at the make level instead.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.2.1 src/usr.sbin/installboot/Makefile
cvs rdiff -u -r1.40 -r1.40.2.1 src/usr.sbin/installboot/machines.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-9] src/usr.sbin/installboot

2019-08-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 16 19:20:46 UTC 2019

Modified Files:
src/usr.sbin/installboot [netbsd-9]: installboot.h

Log Message:
Pull up following revision(s) (requested by kamil in ticket #67):

usr.sbin/installboot/installboot.h: revision 1.41

Add missing extern declaration of ib_mach_emips in installboot

Change added for the consistency with the existing code.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/usr.sbin/installboot/installboot.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-9] src/usr.sbin/installboot

2019-08-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 16 19:20:46 UTC 2019

Modified Files:
src/usr.sbin/installboot [netbsd-9]: installboot.h

Log Message:
Pull up following revision(s) (requested by kamil in ticket #67):

usr.sbin/installboot/installboot.h: revision 1.41

Add missing extern declaration of ib_mach_emips in installboot

Change added for the consistency with the existing code.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/usr.sbin/installboot/installboot.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/installboot/installboot.h
diff -u src/usr.sbin/installboot/installboot.h:1.40 src/usr.sbin/installboot/installboot.h:1.40.2.1
--- src/usr.sbin/installboot/installboot.h:1.40	Tue May  7 05:02:42 2019
+++ src/usr.sbin/installboot/installboot.h	Fri Aug 16 19:20:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.h,v 1.40 2019/05/07 05:02:42 thorpej Exp $	*/
+/*	$NetBSD: installboot.h,v 1.40.2.1 2019/08/16 19:20:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -184,6 +184,7 @@ int		ext2fs_findstage2(ib_params *, uint
 extern struct ib_mach ib_mach_alpha;
 extern struct ib_mach ib_mach_amd64;
 extern struct ib_mach ib_mach_amiga;
+extern struct ib_mach ib_mach_emips;
 extern struct ib_mach ib_mach_evbarm;
 extern struct ib_mach ib_mach_ews4800mips;
 extern struct ib_mach ib_mach_hp300;