[U-Boot-Users] autoscript?

Hi there,
how can a make an u-boot image that contains a kernel _and_ a script?
How is the syntax within the script?
Thanks,
Steven

Hi Steven,
in message 3DE74228.89AF6ED3@imc-berlin.de you wrote:
how can a make an u-boot image that contains a kernel _and_ a script?
Well, _making_ the image is easy. the mkimage tool will happily combine any files you pass to it into one multifile image (MFI).
But _using_ such a MFI is a different issue. So far, PPCBoot understands only one format of MFIs, which consist of a Linux kernel image as the first part and a ramdisk image as the second part. This is being handled buy the "bootm" command.
So far, there is no other support for MFIs.
How is the syntax within the script?
A script is a text file containing commands. The syntax is the same as on the command line interface. Actually this is what happens: the script will be passed to the command line interpreter, line by line.
Best regards,
Wolfgang Denk

Hi Wolfgang,
thanks for your fast reply.
Well, _making_ the image is easy. the mkimage tool will happily combine any files you pass to it into one multifile image (MFI).
I thought I've seen a command line option for "mkimage" saying something about scripts...
But _using_ such a MFI is a different issue. So far, PPCBoot understands only one format of MFIs, which consist of a Linux kernel image as the first part and a ramdisk image as the second part. This is being handled buy the "bootm" command.
So far, there is no other support for MFIs.
Than how should I understand the following lines from ppcboot/common/cmd_autoscript.c
/* * autoscript allows a remote host to download a command file and, * optionally, binary data for automatically updating the target. For * example, you create a new kernel image and want the user to be * able to simply download the image and the machine does the rest. * The kernel image is postprocessed with mkimage, which creates an * image with a script file prepended. If enabled, autoscript will * verify the script and contents of the download and execute the * script portion. This would be responsible for erasing flash, * copying the new image, and rebooting the machine. */ Is this actually a multi step solution? First download the script, then download the binary data (e.g. kernel image) and then execute the script?
I would like to do something like this: Normally the board boots from flash (in detail: pImage is stored on a JFFS2 partition, which serves as the root fs as well). But in the case that no (valid) pImage is found, I would like ppcboot (sorry, still using this) to automagically download a whole pFlashdisk image and burn that to the flash. So I thougth about using an MFI (containing the data and the update script) that gets downloaded...
Steven

In message 3DE74E8B.B8B12592@imc-berlin.de you wrote:
Well, _making_ the image is easy. the mkimage tool will happily combine any files you pass to it into one multifile image (MFI).
I thought I've seen a command line option for "mkimage" saying something about scripts...
Sure. You can build a script image.
But your original question was how to "make an u-boot image that contains a kernel _and_ a script". That would be a MFI, and there is no script support for MFIs.
Than how should I understand the following lines from ppcboot/common/cmd_autoscript.c
You can run a script image. This is an image that contains ONLY the script.
Is this actually a multi step solution? First download the script, then download the binary data (e.g. kernel image) and then execute the script?
No. But you cannot combine a Linux kernel and a script in a single MFI (yet). Or actually you can, but you canot make any use of such an image ;-)
Normally the board boots from flash (in detail: pImage is stored on a JFFS2 partition, which serves as the root fs as well). But in the case that no (valid) pImage is found, I would like ppcboot (sorry, still using this) to automagically download a whole pFlashdisk image and burn that to the flash. So I thougth about using an MFI (containing the data and the update script) that gets downloaded...
Use the update script to download and install the kernel image, then.
Best regards,
Wolfgang Denk

Wolfgang Denk wrote:
In message 3DE74E8B.B8B12592@imc-berlin.de you wrote:
Well, _making_ the image is easy. the mkimage tool will happily combine any files you pass to it into one multifile image (MFI).
I thought I've seen a command line option for "mkimage" saying something about scripts...
Sure. You can build a script image.
But your original question was how to "make an u-boot image that contains a kernel _and_ a script". That would be a MFI, and there is no script support for MFIs.
Than how should I understand the following lines from ppcboot/common/cmd_autoscript.c
You can run a script image. This is an image that contains ONLY the script.
Oh! I can see clearly now ... :o) Thanks!
Is this actually a multi step solution? First download the script, then download the binary data (e.g. kernel image) and then execute the script?
No. But you cannot combine a Linux kernel and a script in a single MFI (yet). Or actually you can, but you canot make any use of such an image ;-)
Normally the board boots from flash (in detail: pImage is stored on a JFFS2 partition, which serves as the root fs as well). But in the case that no (valid) pImage is found, I would like ppcboot (sorry, still using this) to automagically download a whole pFlashdisk image and burn that to the flash. So I thougth about using an MFI (containing the data and the update script) that gets downloaded...
Use the update script to download and install the kernel image, then.
That's great! Thanks again!
Steven

Wolfgang,
But _using_ such a MFI is a different issue. So far, PPCBoot understands only one format of MFIs, which consist of a Linux kernel image as the first part and a ramdisk image as the second part. This is being handled buy the "bootm" command.
So far, there is no other support for MFIs.
How is the syntax within the script?
A script is a text file containing commands. The syntax is the same as on the command line interface. Actually this is what happens: the script will be passed to the command line interpreter, line by line.
So when I tftpbooted the script to 0x100000 I shouldn't download the data to the same address since this would overwrite the srcipt so ppcboot fails to pass the next line to the command line interpreter!
Is that right?
Steven

Dear Steven,
in message 3DE75C6F.AB6CF6DF@imc-berlin.de you wrote:
So when I tftpbooted the script to 0x100000 I shouldn't download the data to the same address since this would overwrite the srcipt so ppcboot fails to pass the next line to the command line interpreter!
Is that right?
Yes. It has always been an excellent idea NOT to destroy any data you want to access later ;-)
Best regards,
Wolfgang Denk

On Friday 29 November 2002 05:32 am, Steven Scholz wrote:
Hi there,
how can a make an u-boot image that contains a kernel _and_ a script?
Yes. But, you have to run a 2 pass process to fixup addresses within the autoscript output generated from mkimage. For example, this is a simple autoscript that could be used to update a root fs.
setenv stdout serial erase 40040000 400fffff cp 00100134 40040000 24500
The mkimage command would be.
mkimage -T script -n label -C none -d autoscript:rootfs root.auto
When this is combined with the root image with mkimage, the source address (100134) may change, depending on length of autoscript. So, the script has to be updated accordingly and a 2nd and final pass of mkimage must be run. I have bash scripts for doing this automatically for multiple images, if anyone is interested.
HTH, Kyle.
participants (3)
-
Kyle Harris
-
Steven Scholz
-
Wolfgang Denk