[Qemu-devel] qemu-img qcow and raw format

2007-04-12 Thread Francois Visconte

Hello,

I'm currently developing an OS deployment tool similar to G4U (ghost for 
unix).

This is a very basic tool
 - boot an initrd
 - configure network
 - ssh deployment-server cat image.dd   /dev/sda
 - reboot


I'm using qemu to test my initrd and deployment tool and i would like 
replace my raw image format with qcow images (size/compression and crypto)


 - ssh deployment-server cat image.qcow | qemu-img - -O raw /dev/sda

The problem is qemu-img can't read from stdin, so i tried :

 - mkfifo deploy-in.fifo
 - qemu-img convert deploy-in.fifo -O raw /dev/sda
 - ssh deployment-server cat image.qcow  deploy-in.fifo
   qemu-img: Could not open 'deploy-in.fifo'


Is there any way to achieve this goal ?


Cheers,
François Visconte






Re: [Qemu-devel] qemu-img qcow and raw format

2007-04-12 Thread Gildas

Creating a temp file maybe?

Cheers,
Gildas

2007/4/12, Francois Visconte [EMAIL PROTECTED]:

Hello,

I'm currently developing an OS deployment tool similar to G4U (ghost for
unix).
This is a very basic tool
  - boot an initrd
  - configure network
  - ssh deployment-server cat image.dd   /dev/sda
  - reboot


I'm using qemu to test my initrd and deployment tool and i would like
replace my raw image format with qcow images (size/compression and crypto)

  - ssh deployment-server cat image.qcow | qemu-img - -O raw /dev/sda

The problem is qemu-img can't read from stdin, so i tried :

  - mkfifo deploy-in.fifo
  - qemu-img convert deploy-in.fifo -O raw /dev/sda
  - ssh deployment-server cat image.qcow  deploy-in.fifo
qemu-img: Could not open 'deploy-in.fifo'


Is there any way to achieve this goal ?


Cheers,
François Visconte










Re: [Qemu-devel] qemu-img qcow and raw format

2007-04-12 Thread Francois Visconte

Hello

Creating a temp file maybe?

I'm using qemu-img from an initrd so i can't create big file into a 
temps file.

Creating a temp file may cause deployment to be 2 times longer:
 - ssh ... cat image.dd  temp_file
 - qemu-img convert temp_file -O raw /dev/sda


Cheers,
François




Re: [Qemu-devel] qemu-img qcow and raw format

2007-04-12 Thread Ben Taylor

 Francois Visconte [EMAIL PROTECTED] wrote: 
 Hello,
 
 I'm currently developing an OS deployment tool similar to G4U (ghost for 
 unix).
 This is a very basic tool
   - boot an initrd
   - configure network
   - ssh deployment-server cat image.dd   /dev/sda
   - reboot
 
 
 I'm using qemu to test my initrd and deployment tool and i would like 
 replace my raw image format with qcow images (size/compression and crypto)
 
   - ssh deployment-server cat image.qcow | qemu-img - -O raw /dev/sda
 
 The problem is qemu-img can't read from stdin, so i tried :
 
   - mkfifo deploy-in.fifo
   - qemu-img convert deploy-in.fifo -O raw /dev/sda
   - ssh deployment-server cat image.qcow  deploy-in.fifo
 qemu-img: Could not open 'deploy-in.fifo'

I have not looked at the code in qemu-img (and the associated 
routines).  It appears that qemu-img is probably looking for
a file handle and not a named pipe. Either that, or you need
to shove the ssh command in the background before the 
qemu-img command so qemu-img has a chance to
start processing the data.  It's not clear whether or not
qemu-img is seeing an empty file because there's no
data on the pipe, or it can't read from the pipe.

Ben





Re: Qemu-PPC problems (was [Qemu-devel] Just to add one single point)

2007-04-12 Thread Jason Wessel

J. Mayer wrote:
On Wed, 2007-04-11 at 17:49 -0400, Rob Landley wrote: 
  

qemu-system-ppc -M prep -nographic -kernel zImage-powerpc -append \
  console=/dev/ttyS0



You cannot append anything to the command line this way, with the PPC
firmware...
You can append options when using yaboot, not with the -kernel option.
Then, you should use the CONFIG_CMDLINE kernel option to add the option
you absolutely need to boot.
  
If you do not modify the prep loader, then it is impossible to pass 
arguments or load a kernel that expands to  4meg.  With respect to  
using an unmodified prep loader, you have to build the boot arguments 
you want into the kernel itself with the .config file options.
[...] 
  

It also seems that most Linux 2.6 kernels support has been broken. It
used to run too, with some versions having a great problem in
frame-buffer mode (writing black on black is not really usable). Using
the serial console always allowed me to follow the boot until X starts.
  

I'm trying to use serial console.



I tried and the kernel seem to hang before reaching the start_kernel
routine. That why I said there may now be a CPU emulation bug that broke
everything Must do more checks with a debug kernel (with traces,
this time. Using early_printk may help a lot !).

[...]

  
you may try to boot kernels in PREP format as they look like regular boot partitions...

It may help.

  


While I am sure folks have the objective to be able to boot something 
that is not modified, my objective was to modify the kernel to work with 
qemu until that first objective is met.  If you use a 2.6.21rc candidate 
you can use the attached patches to boot.  I provided a .config file as 
well.  The frame buffer is definitely broken, but I had not really 
looked into why because I was more interested in simply using the ppc 
instruction sets.


Note I startup with the following and it works perfectly fine with my 
modified kernels:
qemu-system-ppc -nographic -kernel zImage.prep -s -M prep -append 
console=ttyS0 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/export/ppc rw 
netdev=9,0x300,eth0


There is a new regression between Apr 9 and Apr 10 in the QEMU CVS HEAD 
where tcp checksums are failing again.  :-(


If it would help, I can certainly provide some of my zImage files which 
run with several different 2.6.x kernels.


Jason.




dot_config.gz
Description: GNU Zip compressed data
Adjust prep loader to deal with larger kernel images.

signed-off-by: Jason Wessel [EMAIL PROTECTED]

Index: linux-2.6.21-rc3/arch/ppc/boot/simple/misc.c
===
--- linux-2.6.21-rc3.orig/arch/ppc/boot/simple/misc.c
+++ linux-2.6.21-rc3/arch/ppc/boot/simple/misc.c
@@ -17,6 +17,7 @@
 #include linux/types.h
 #include linux/string.h
 
+#include asm/residual.h
 #include asm/page.h
 #include asm/mmu.h
 #include asm/bootinfo.h
@@ -27,6 +28,7 @@
 
 #include nonstdio.h
 
+#define CONFIG_RUNTIME_CMDLINE 0x17ff000
 /* Default cmdline */
 #ifdef CONFIG_CMDLINE
 #define CMDLINE CONFIG_CMDLINE
@@ -53,7 +55,7 @@
 char *avail_ram;
 char *end_avail;
 char *zimage_start;
-char cmd_preset[] = CMDLINE;
+char cmd_preset[256] = CMDLINE;
 char cmd_buf[256];
 char *cmd_line = cmd_buf;
 int keyb_present = HAS_KEYB;
@@ -91,9 +93,11 @@ get_mem_size(void)
 #endif
 
 struct bi_record *
-decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
+decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum
+,RESIDUAL *residual, void *OFW_interface)
 {
 #ifdef INTERACTIVE_CONSOLE
+int do_console = 0;
 	int timer = 0;
 	char ch;
 #endif
@@ -120,9 +124,12 @@ decompress_kernel(unsigned long load_add
 	 * and we must have the correct file linked in here.
 	 */
 	TotalMemory = get_mem_size();
+	puts(TotalMemory: ); puthex(TotalMemory); puts(\n);
+	puts(TotalResid: ); puthex(residual-TotalMemory); puts(\n);
+	puts(Resid at: ); puthex((unsigned int)residual); puts(\n);
 
-	/* assume the chunk below 8M is free */
-	end_avail = (char *)0x0080;
+	/* assume the chunk below 10M is free */
+	end_avail = (char *)0x00A0;
 
 	/*
 	 * Reveal where we were loaded at and where we
@@ -139,6 +146,13 @@ decompress_kernel(unsigned long load_add
 		puts(\n);
 	}
 
+	if (residual) {
+		puts(board data at: ); puthex((unsigned long)residual);
+		puts( );
+		puthex((unsigned long)((unsigned long)residual +
+	sizeof(RESIDUAL)));
+		puts(\n);
+	}
 	/*
 	 * We link ourself to 0x0080.  When we run, we relocate
 	 * ourselves there.  So we just need __image_begin for the
@@ -167,15 +181,21 @@ decompress_kernel(unsigned long load_add
 	}
 
 #ifndef CONFIG_40x /* don't overwrite the 40x image located at 0x0040! */
-	avail_ram = (char *)0x0040;
+	avail_ram = (char *)0x0050;
 #endif
-	end_avail = (char *)0x0080;
+	end_avail = (char *)0x00A0;
 	puts(avail ram: ); puthex((unsigned long)avail_ram); puts( );
 	puthex((unsigned long)end_avail); puts(\n);
 
 	if 

[Qemu-devel] Saving and restoring CPU state

2007-04-12 Thread eady
I'm still looking for any suggestions on how to save and restore the 
target cpu state from within a custom instruction in op.c. I basically 
want a custom instruction to save the cpu state to a data structure and 
then continue on normally, a second custom instruction would then be 
used to restore the cpu state from the saved data structure at a later 
time thereby rolling back the execution of the cpu. I've tried saving 
and restoring env-eip within my custom instructions but this has no effect.


Thanks,
Nuri
---BeginMessage---
I'm experimenting a bit with QEMU and am in need of a way to save and 
restore X86 CPU state including the pc so that the processor state can 
be rolled back to re execute from the previous point. I've found the 
functions cpu_x86_fsave and cpu_restore_state but do not understand 
them well enough to use them. Does anyone have tips on how to store the 
processor state in an auxiliary data structure and then restore it at a 
later point?


Thanks
Nuri


---End Message---


Re: Qemu-PPC problems (was [Qemu-devel] Just to add one single point)

2007-04-12 Thread Jason Wessel

Jason Wessel wrote:


There is a new regression between Apr 9 and Apr 10 in the QEMU CVS 
HEAD where tcp checksums are failing again.  :-(




I stand corrected it not the TCP check sums.  The new PPC pic code does 
not work so as to allow the ethernet device driver to receive packets.  
I guess the question should be is if we would have expected more to work 
than breaks or if different cases actually work now with the new PPC pic 
code, or if they are all broken.


Jason.




Re: [Qemu-devel] qemu-img qcow and raw format

2007-04-12 Thread Daniel Silverstone
On Thu, 2007-04-12 at 10:09 +0200, Francois Visconte wrote:
 qemu-img: Could not open 'deploy-in.fifo'
 Is there any way to achieve this goal ?

It strikes me that it's likely qemu-img assumes it can seek around in
the file it is reading from, so perhaps you'll have to look at modifying
qemu-img to support a stream mode?

D.

(Note this is just a guess)

-- 
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged.Key Id: 2BC8 4016 2068 7895






Re: Qemu-PPC problems (was [Qemu-devel] Just to add one single point)

2007-04-12 Thread J. Mayer
On Thu, 2007-04-12 at 10:49 -0500, Jason Wessel wrote:
 J. Mayer wrote:
  On Wed, 2007-04-11 at 17:49 -0400, Rob Landley wrote: 

  qemu-system-ppc -M prep -nographic -kernel zImage-powerpc -append \
console=/dev/ttyS0
  
 
  You cannot append anything to the command line this way, with the PPC
  firmware...
  You can append options when using yaboot, not with the -kernel option.
  Then, you should use the CONFIG_CMDLINE kernel option to add the option
  you absolutely need to boot.

 If you do not modify the prep loader, then it is impossible to pass 
 arguments 

You can compile the kernel arguments you need into the CONFIG_CMDLINE
kernel option. No need for a patch for this to work.

 or load a kernel that expands to  4meg.  With respect to  
 using an unmodified prep loader, you have to build the boot arguments 
 you want into the kernel itself with the .config file options.

A kernel  4 MB ? Even on my amd64 I usually have kernels smaller than
this. Is there any need to have such a big kernel for anyone ?

  [...] 

  It also seems that most Linux 2.6 kernels support has been broken. It
  used to run too, with some versions having a great problem in
  frame-buffer mode (writing black on black is not really usable). Using
  the serial console always allowed me to follow the boot until X starts.

  I'm trying to use serial console.
  
 
  I tried and the kernel seem to hang before reaching the start_kernel
  routine. That why I said there may now be a CPU emulation bug that broke
  everything Must do more checks with a debug kernel (with traces,
  this time. Using early_printk may help a lot !).
 
  [...]
 

  you may try to boot kernels in PREP format as they look like regular boot 
  partitions...
  It may help.
 

 
 While I am sure folks have the objective to be able to boot something 
 that is not modified, my objective was to modify the kernel to work with 
 qemu until that first objective is met.  If you use a 2.6.21rc candidate 
 you can use the attached patches to boot.  I provided a .config file as 
 well.  The frame buffer is definitely broken, but I had not really 
 looked into why because I was more interested in simply using the ppc 
 instruction sets.

The problem with the frame-buffer is quite simple: it works (well, it
used to work, I did not check with such a recent kernel...) but the
kernel uses a black font on a black background.
Unfortunatelly, the reason of this bug seems not obvious (or I was not
so lucky to find it !).

 Note I startup with the following and it works perfectly fine with my 
 modified kernels:
 qemu-system-ppc -nographic -kernel zImage.prep -s -M prep -append 
 console=ttyS0 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/export/ppc rw 
 netdev=9,0x300,eth0
 
 There is a new regression between Apr 9 and Apr 10 in the QEMU CVS HEAD 
 where tcp checksums are failing again.  :-(

 I stand corrected it not the TCP check sums.  The new PPC pic code
does 
 not work so as to allow the ethernet device driver to receive packets.  
 I guess the question should be is if we would have expected more to work 
 than breaks or if different cases actually work now with the new PPC pic 
 code, or if they are all broken.

Did it really work before this patch ? Because IRQs were broken _before_ the 
IRQ scheme patches, for the PREP platform, which is the reason I cannot test it.
It seem to have been broken in September and the problem seems to be somewhere 
in the PCI bridge code...

[...]

-- 
J. Mayer [EMAIL PROTECTED]
Never organized





[Qemu-devel] qemu vl.h hw/ppc.c target-ppc/cpu.h target-ppc/...

2007-04-12 Thread Jocelyn Mayer
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Jocelyn Mayer j_mayer 07/04/12 21:11:03

Modified files:
.  : vl.h 
hw : ppc.c 
target-ppc : cpu.h op_helper.c 

Log message:
Embedded PowerPC Device Control Registers infrastructure.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/vl.h?cvsroot=qemur1=1.209r2=1.210
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ppc.c?cvsroot=qemur1=1.15r2=1.16
http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/cpu.h?cvsroot=qemur1=1.37r2=1.38
http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper.c?cvsroot=qemur1=1.25r2=1.26




[Qemu-devel] qemu hw/ppc.c hw/ppc_chrp.c hw/ppc_prep.c targe...

2007-04-12 Thread Jocelyn Mayer
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Jocelyn Mayer j_mayer 07/04/12 21:24:29

Modified files:
hw : ppc.c ppc_chrp.c ppc_prep.c 
target-ppc : cpu.h translate_init.c 

Log message:
Add PowerPC 405 input pins (IRQ, resets, ...) model.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ppc.c?cvsroot=qemur1=1.16r2=1.17
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ppc_chrp.c?cvsroot=qemur1=1.32r2=1.33
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ppc_prep.c?cvsroot=qemur1=1.34r2=1.35
http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/cpu.h?cvsroot=qemur1=1.38r2=1.39
http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/translate_init.c?cvsroot=qemur1=1.9r2=1.10