From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUHEX-0004ar-1Q for qemu-devel@nongnu.org; Tue, 03 Feb 2009 04:06:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUHET-0004ZX-5Z for qemu-devel@nongnu.org; Tue, 03 Feb 2009 04:06:16 -0500 Received: from [199.232.76.173] (port=45770 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUHES-0004ZS-TL for qemu-devel@nongnu.org; Tue, 03 Feb 2009 04:06:12 -0500 Received: from mr01.hansenet.de ([213.191.74.10]:40009) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUHES-0003Lf-Di for qemu-devel@nongnu.org; Tue, 03 Feb 2009 04:06:12 -0500 Received: from exactcode.de (85.183.32.143) by mr01.hansenet.de (7.3.132) id 4967D255002A149A for qemu-devel@nongnu.org; Tue, 3 Feb 2009 10:06:11 +0100 Received: from [192.168.2.173] (helo=[192.168.2.173]) by exactcode.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.54) id 1LUHER-0003AI-3f for qemu-devel@nongnu.org; Tue, 03 Feb 2009 09:06:11 +0000 Message-ID: <49880902.20700@exactcode.de> Date: Tue, 03 Feb 2009 10:06:10 +0100 From: =?ISO-8859-1?Q?Ren=E9_Rebe?= MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] fix loading tiny kernels References: <49880773.5000203@exactcode.de> In-Reply-To: <49880773.5000203@exactcode.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: Quoted-Printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I babbled: > Further testing / polishing the multi-boot kernel loading support I fou= nd > the existing code fails to load unusual small kernels, less than 8192=20 > bytes - > for example the example multi-boot kernel shipped within GRUB that > compiles to just 7121 bytes on my system. > > Signed-off-by: Ren=E9 Rebe > > --- hw/pc.c (revision 6501) > +++ hw/pc.c (working copy) > @@ -554,7 +989,7 @@ > /* load the kernel header */ > f =3D fopen(kernel_filename, "rb"); > if (!f || !(kernel_size =3D get_file_size(f)) || > - fread(header, 1, 1024, f) !=3D 1024) { > + fread(header, 1, MIN(8192, kernel_size), f) !=3D MIN(8192,=20 > kernel_size)) { > fprintf(stderr, "qemu: could not load kernel '%s'\n", > kernel_filename); > exit(1); > Ah, sorry - mix in the series. This only applies to the multi-boot serie= s which increases the header read to 8192 bytes. Sorry, will include that in the updated multi-boot patch. --=20 Ren=E9 Rebe - ExactCODE GmbH - Europe, Germany, Berlin http://exactcode.de | http://t2-project.org | http://rene.rebe.name