Skip to contentSkip to conversation

Make autocomplete work with HUSH parser too.

PATCH New Pantelis Antoniou 3 participants 7 messages Nov 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 Make autocomplete work with HUSH parser too.

CHANGELOG entry:

Auto complete did not work when the HUSH parser was selected. Fix this obvious problem.

---

---

 README        |    4 ----
 common/main.c |   25 +++++++++++++++++++++++--
 2 files changed, 23 insertions(+), 6 deletions(-)
README +0 -4
index f78bf50..0aab04c 100644
@@ -1470,10 +1470,6 @@ The following options need to be configured:
 
 		Enable auto completion of commands using TAB.
 
-		Note that this feature has NOT been implemented yet
-		for the "hush" shell.
-
-
 		CFG_HUSH_PARSER
 
 		Define this variable to enable the "hush" shell (from
common/main.c +23 -2
index cc4b50f..a8ae07c 100644
@@ -718,10 +718,11 @@ static void cread_add_str(char *str, int strsize, int insert, unsigned long *num
 	}
 }
 
-static int cread_line(char *buf, unsigned int *len)
+static int cread_line(const char *const prompt, char *buf, unsigned int *len)
 {
 	unsigned long num = 0;
 	unsigned long eol_num = 0;
+	int num2, col;
 	unsigned long rlen;
 	unsigned long wlen;
 	char ichar;
@@ -840,6 +841,7 @@ static int cread_line(char *buf, unsigned int *len)
 			insert = !insert;
 			break;
 		case CTL_CH('x'):
+		case CTL_CH('u'):	/* like that too */
 			BEGINNING_OF_LINE();
 			ERASE_TO_EOL();
 			break;
@@ -889,6 +891,25 @@ static int cread_line(char *buf, unsigned int *len)
 			REFRESH_TO_EOL();
 			continue;
 		}
+#ifdef CONFIG_AUTO_COMPLETE
+		case '\t':
+
+			/* do not autocomplete when in the middle */
+			if (num < eol_num) {
+				getcmd_cbeep();
+				break;
+			}
+
+			buf[num] = '\0';
+			col = strlen(prompt) + eol_num;
+			num2 = num;
+			if (cmd_auto_complete(prompt, buf, &num2, &col)) {
+				col = num2 - num;
+				num += col;
+				eol_num += col;
+			}
+			break;
+#endif
 		default:
 			cread_add_char(ichar, insert, &num, &eol_num, buf, *len);
 			break;
@@ -931,7 +952,7 @@ int readline (const char *const prompt)
 
 	puts (prompt);
 
-	rc = cread_line(p, &len);
+	rc = cread_line(prompt, p, &len);
 	return rc < 0 ? rc : len;
 #else
 	char   *p = console_buffer;
#1 lore raw

PATCH 3/5 Adds support for RedBoot

CHANGELOG entry:

Provide support for RedBoot's FIS & config variables.

For PPC provide also a way to boot a redboot compiled Linux kernel. The bd_t is different in that case.

---

---

 README             |   70 ++++
 common/Makefile    |    1 
 common/cmd_bootm.c |   19 +
 common/redboot.c   |  941 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/redboot.h  |   91 +++++
 5 files changed, 1121 insertions(+), 1 deletions(-)
README +70 -0
index 0aab04c..502f8ec 100644
@@ -2265,6 +2265,76 @@ Low Level (hardware related) configuration options:
 		some other boot loader or by a debugger which
 		performs these intializations itself.
 
+- CONFIG_REDBOOT
+		Add support for read-only parsing of the FIS & config areas.
+		For PPC also add an option to boot a kernel compiled for RedBoot.
+
+		The redboot command is also enabled conditional on CFG_CMD_FLASH.
+
+		- Select a different FIS
+                  > redboot fis select ([bank] [sector] | reset)
+
+		- Display FIS
+                  > redboot fis list
+
+		- Set an environment variable from a member variable of a FIS entry
+
+                  > redboot fis setenv var type name
+
+	          Where type: flash_base, mem_base, size, entry_point, data_length.
+
+		  An example given a FIS entry of
+
+		  Name              FLASH addr  Mem addr    Datalen     Length      Entry point   
+		  Linux             0xF0470000  0x00100000  0x000FA000  0x00100000  0x00100000    
+
+		  > redboot fis setenv linux_base flash_base Linux
+
+		  Would set the environment variable linux_base to 0xf0470000
+
+		- Print either all the RedBoot config variables or a specific one
+
+                  > redboot config printenv [config-var] [member]
+
+		  member is one of value, type, enable-sense, enable-key with value
+		  being the default one.
+
+		- Set an environment variable from a RedBoot config variable
+
+                  > redboot config setenv var config-var [member]
+
+		  For example when given a config variable of 
+
+		  tsec1_esa=00:08:e5:11:32:33                                                     
+		          type=esa enable-sense=true        
+
+		  > redboot config setenv ethaddr tsec1_esa
+
+		  would set the ethaddr environment variable to 00:08:e5:11:32:33
+
+		- Boot a RedBoot kernel [PPC specific]
+
+	        > redboot exec address	
+
+		The PPC bd_t differs for kernels compiled for redboot; this command
+		lets you boot such a kernel.
+
+		RedBoot config defaults (can be overriden on board config):
+
+		- Sector containing the FIS area (negative values for counting from the end)
+		  CONFIG_REDBOOT_FIS_DIRECTORY_BLOCK	-1
+
+		- FIS directory entry size
+		  CONFIG_REDBOOT_DIRECTORY_ENTRY_SIZE	0x100
+
+		- Size of the config area
+		  CONFIG_REDBOOT_FLASH_CONFIG_SIZE	4096
+
+		- Size of the script config variables
+		  CONFIG_REDBOOT_FLASH_SCRIPT_SIZE 	256
+
+		- Size of the string config variables
+		  CONFIG_REDBOOT_FLASH_STRING_SIZE	128
 
 Building the Software:
 ======================
common/Makefile +1 -0
index 8baeab3..b6db7f4 100644
@@ -49,6 +49,7 @@ COBJS	= main.o ACEX1K.o altera.o bedbug.o circbuf.o \
 	  flash.o fpga.o ft_build.o \
  	  hush.o kgdb.o lattice.o lattice_ivm_core.o lcd.o lists.o lynxkdi.o \
 	  memsize.o miiphybb.o miiphyutil.o \
+	  redboot.o \
 	  s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
 	  usb.o usb_kbd.o usb_storage.o \
 	  virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o
common/cmd_bootm.c +18 -1
index 7aae8a6..fd02257 100644
@@ -146,6 +146,12 @@ extern void lynxkdi_boot( image_header_t * );
 #define CFG_BOOTM_LEN	0x800000	/* use 8MByte as default max gunzip size */
 #endif
 
+#ifdef CONFIG_REDBOOT_BD_T_SIZE
+extern void board_redboot_bd_t_adapt(void *kbd,
+		ulong cmd_start, ulong cmd_end,
+		ulong initrd_start, ulong initrd_end);
+#endif
+
 image_header_t header;
 
 ulong load_addr = CFG_LOAD_ADDR;		/* Default Load Address */
@@ -533,6 +539,11 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 	char	*of_flat_tree = NULL;
 	ulong	of_data = 0;
 #endif
+#ifdef CONFIG_REDBOOT_BD_T_SIZE
+#define BD_T_SIZE max(sizeof(bd_t), CONFIG_REDBOOT_BD_T_SIZE)
+#else
+#define BD_T_SIZE sizeof(bd_t)
+#endif
 
 	if ((s = getenv ("initrd_high")) != NULL) {
 		/* a value of "no" or a similar string will act like 0,
@@ -575,7 +586,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 	debug ("=> set upper limit to 0x%08lX\n", sp);
 
 	cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF);
-	kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF);
+	kbd = (bd_t *)(((ulong)cmdline - BD_T_SIZE) & ~0xF);
 
 	if ((s = getenv("bootargs")) == NULL)
 		s = "";
@@ -904,6 +915,12 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 		initrd_end = 0;
 	}
 
+	/* redboot bd_t modify */
+#ifdef CONFIG_REDBOOT_BD_T_SIZE
+	if ((s = getenv ("redboot_bd_t")) != NULL)
+		board_redboot_bd_t_adapt(kbd, cmd_start, cmd_end, initrd_start, initrd_end);
+#endif
+
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);
 
common/redboot.c new file +941 -0

941 lines not on this page · raw message

include/redboot.h new file +91 -0

91 lines not on this page · raw message

#2 lore raw

PATCH 3/5 Adds support for RedBoot

Dear Pantelis,

Quoted 10 lines · in message <[email protected]> you wrote:
README +9 -0
+		- Print either all the RedBoot config variables or a specific one
+
+                  > redboot config printenv [config-var] [member]
+
+		  member is one of value, type, enable-sense, enable-key with value
+		  being the default one.
+
+		- Set an environment variable from a RedBoot config variable
+

README Low Level (hardware related) configuration options: · line 2313

Quoted 10 lines
README +10 -0
+                  > redboot config setenv var config-var [member]
+
+		  For example when given a config variable of 
+
+		  tsec1_esa=00:08:e5:11:32:33                                                     
+		          type=esa enable-sense=true        
+
+		  > redboot config setenv ethaddr tsec1_esa
+
+		  would set the ethaddr environment variable to 00:08:e5:11:32:33

Can you please explain why you need a separate implementation of printenv / setenv commands? Why do you make a difference between "RedBoot config variables" and normal (U-Boot) environment variables?

README Low Level (hardware related) configuration options: · line 2320

Quoted 4 lines
README +4 -0
+	        > redboot exec address	
+
+		The PPC bd_t differs for kernels compiled for redboot; this command
+		lets you boot such a kernel.

I have to admit that I don't like this. I'd rathwer see you using the standard bootm command, and have the necessary adaption done there based on the image type (which should indicate that thgis is a RB image). You have a lot of #ifdef's there anyway.

Also, please cleanup your code (indentation by TABs, trailing white space, C++ comments, line length).

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If all the Chinese simultaneously jumped into the Pacific  off  a  10
foot platform erected 10 feet off their coast, it would cause a tidal
wave that would destroy everything in this country west of Nebraska.
#3 lore raw

PATCH 3/5 Adds support for RedBoot

On 29 ??? 2006, at 11:21 ??, Wolfgang Denk wrote:

Hi Wolfgang,

Quoted 21 lines

Dear Pantelis,

in message <[email protected]> you

Quoted 17 lines · wrote:
README +5 -0
+		- Print either all the RedBoot config variables or a specific one
+
+                  > redboot config printenv [config-var] [member]
+
+		  member is one of value, type, enable-sense, enable-key with  

value

README +10 -0
+		  being the default one.
+
+		- Set an environment variable from a RedBoot config variable
+
+                  > redboot config setenv var config-var [member]
+
+		  For example when given a config variable of
+
+		  tsec1_esa=00:08:e5:11:32:33
+		          type=esa enable-sense=true
Quoted 9 lines

README Low Level (hardware related) configuration options: · line 2313

Quoted 4 lines
README +4 -0
+
+		  > redboot config setenv ethaddr tsec1_esa
+
+		  would set the ethaddr environment variable to 00:08:e5:11:32:33

Can you please explain why you need a separate implementation of printenv / setenv commands? Why do you make a difference between "RedBoot config variables" and normal (U-Boot) environment variables?

This is not the u-boot environment - it is the RedBoot environment. I am using the RedBoot environment (which is Read-Only) for copying environment
variables. Some very important variables are stored there like the ethernet MAC
addresses & the ip address.

What this command does is copy the RedBoot config variable to the u- boot ethaddr.

Quoted 12 lines

README Low Level (hardware related) configuration options: · line 2320

Quoted 5 lines
README +3 -0
+	        > redboot exec address	
+
+		The PPC bd_t differs for kernels compiled for redboot; this  

command

README +1 -0
+		lets you boot such a kernel.

I have to admit that I don't like this. I'd rathwer see you using the standard bootm command, and have the necessary adaption done there based on the image type (which should indicate that thgis is a RB image). You have a lot of #ifdef's there anyway.

Tried it, didn't work. The amount of defines was getting obscene. As an added bonus the registers used to pass control to the kernel are different,
plus you really need to disable the MMU & the caches the way that RedBot does it.

So in conclusion, yes, it is ugly, hacking bootm to make it work is even uglier.

Quoted 3 lines

Also, please cleanup your code (indentation by TABs, trailing white space, C++ comments, line length).

Some files were copied verbatim from RedBoot sources, so they are bound to be like this.
I've been told that Lattice modifies the FPGA loader regurally, so I tried to keep
the original formatting.

Anyway will do.

Quoted 10 lines

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If all the Chinese simultaneously jumped into the Pacific  off  a  10
foot platform erected 10 feet off their coast, it would cause a tidal
wave that would destroy everything in this country west of Nebraska.

Regards

Pantelis

P.S. Two patches were discarded due to limit size - 40K is pretty small, when there's
a single file being 80K. Yes, the FPGA loader file.

#4 lore raw

PATCH 3/5 Adds support for RedBoot

Quoted 10 lines · In message <[email protected]> you wrote:

This is not the u-boot environment - it is the RedBoot environment. I am using the RedBoot environment (which is Read-Only) for copying environment
variables. Some very important variables are stored there like the ethernet MAC
addresses & the ip address.

What this command does is copy the RedBoot config variable to the u- boot ethaddr.

Maybe you could perform a single read and create corresponding entries in the U-Boot environment?

Quoted 10 lines
Quoted 4 lines

I have to admit that I don't like this. I'd rathwer see you using the standard bootm command, and have the necessary adaption done there based on the image type (which should indicate that thgis is a RB image). You have a lot of #ifdef's there anyway.

Tried it, didn't work. The amount of defines was getting obscene. As an added bonus the registers used to pass control to the kernel are different,
plus you really need to disable the MMU & the caches the way that RedBot does it.

Well, maybe you can branch to a different function to handle this?

Quoted 8 lines
Quoted 2 lines

Also, please cleanup your code (indentation by TABs, trailing white space, C++ comments, line length).

Some files were copied verbatim from RedBoot sources, so they are bound to be like this.
I've been told that Lattice modifies the FPGA loader regurally, so I tried to keep
the original formatting.

I expected something like this.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Immortality consists largely of boredom.
	-- Zefrem Cochrane, "Metamorphosis", stardate 3219.8
#5 lore raw

PATCH 3/5 Adds support for RedBoot

Quoted 10 lines · Wolfgang Denk

In message <[email protected]>

Quoted 8 lines · you

This is not the u-boot environment - it is the RedBoot environment. I am using the RedBoot environment (which is Read-Only) for copying environment
variables. Some very important variables are stored there like the ethernet MAC
addresses & the ip address.

Quoted 6 lines
Quoted 2 lines

What this command does is copy the RedBoot config variable to the u- boot ethaddr.

Maybe you could perform a single read and create corresponding entries in the U-Boot environment?

It would be more complicated really. Each board will need to do it's own thing differently. You would end with a single function doing it with a number of defines for each different board.

Just to make things clear, this is not supposed to be used normally in u-boot; it is targetted for specific boards that need to migrate smoothly
to u-boot. There is no cost for other boards.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

I have to admit that I don't like this. I'd rathwer see you using the
standard bootm command, and have the necessary adaption done there
based on the image type (which should indicate that thgis is a RB
image). You have a lot of #ifdef's there anyway.

Quoted 8 lines
Quoted 5 lines

Tried it, didn't work. The amount of defines was getting obscene. As an added bonus the registers used to pass control to the kernel are different,
plus you really need to disable the MMU & the caches the way that RedBot does it.

Well, maybe you can branch to a different function to handle this?

Isn't this exactly the same? How would I do that in bootm? I'd use an environment variable to call the different function.

End up with almost the same function & crapping all over bootm.

If anything should be cleaned up is bootm to be split in different functions for the normal & OF case.

IMHO of-course.

Quoted 11 lines
Quoted 8 lines
Quoted 2 lines

Also, please cleanup your code (indentation by TABs, trailing white space, C++ comments, line length).

Some files were copied verbatim from RedBoot sources, so they are bound to be like this.
I've been told that Lattice modifies the FPGA loader regurally, so I tried to keep
the original formatting.

I expected something like this.

Vendor code = ahem, interesting code :(

Quoted 9 lines

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Immortality consists largely of boredom.
	-- Zefrem Cochrane, "Metamorphosis", stardate 3219.8

Regards

Pantelis

#6 lore raw

PATCH 5/5 Pantelis Antoniou MAINTAINER update.

In reply to Pantelis Antoniou

Update with my new email address, add as a maintainer of ASP8347DB. Also move NETVIA to unmaintained section.

---

---

 MAINTAINERS |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
MAINTAINERS +3 -2
index d453967..c1219ee 100644
@@ -21,9 +21,9 @@ Greg Allen <[email protected]>
 
 	UTX8245			MPC8245
 
-Pantelis Antoniou <[email protected]>
+Pantelis Antoniou <[email protected]>
 
-	NETVIA			MPC8xx
+	ASP8347DB		MPC834x
 
 Reinhard Arlt <[email protected]>
 
@@ -352,6 +352,7 @@ Unknown / orphaned boards:
 	IAD210			MPC8xx
 	MBX			MPC8xx
 	MBX860T			MPC8xx
+	NETVIA			MPC8xx
 	NX823			MPC8xx
 	RPXClassic		MPC8xx
 	RPXlite			MPC8xx