Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IEB5X-0004NE-Iz for qemu-devel@nongnu.org; Thu, 26 Jul 2007 17:41:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IEB5W-0004M3-Rx for qemu-devel@nongnu.org; Thu, 26 Jul 2007 17:41:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IEB5W-0004Lq-NQ for qemu-devel@nongnu.org; Thu, 26 Jul 2007 17:41:38 -0400 Received: from gwyn.kn-bremen.de ([212.63.36.242]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IEB5W-0001p6-0j for qemu-devel@nongnu.org; Thu, 26 Jul 2007 17:41:38 -0400 From: Juergen Lock Date: Thu, 26 Jul 2007 23:37:47 +0200 Subject: Re: [Qemu-devel] qemu-system-arm -M akita/terrier - which roms work? (have first patches now :) Message-ID: <20070726213747.GA23871@saturn.kn-bremen.de> References: <20070724011115.GA44643@saturn.kn-bremen.de> <200707242025.l6OKPSnJ010124@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: andrzej zaborowski Cc: qemu-devel@nongnu.org --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Okay I got a little further now... On Wed, Jul 25, 2007 at 10:13:42PM +0200, andrzej zaborowski wrote: > On 24/07/07, Juergen Lock wrote: >> I was under the impression that -append doesnt work, is this wrong? >> Also /proc/cmdline on the zaurus is >> console=ttyS0 root=/dev/mtdblock2 >> mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home) >> jffs2_orphaned_inodes=delete EQUIPMENT=5 LOGOLANG=1 DEFYEAR=2007 LOGO=1 >> LAUNCH=q >> and even when I do pass that with -append to qemu I still dont get >> anything on the serial console. So maybe the problem is just missing >> kernel commandline... Can -append be fixed? > > No, not in qemu :( zaurus kernels don't accept any parameters from > bootloaders, that's because they use the > arch/arm/boot/compressed/head-sharpsl.S file instead of the generic > arm head.S. Set the parameters in your .config. Actually... at least the sharp kernel does in fact take args as I found out, but it wants them in the old-style struct param_struct as defined in linux/include/asm-arm/setup.h (because of CONFIG_SHARPSL_BOOTLDR_PARAMS e.g. in linux/arch/arm/mach-pxa/corgi.c) I've prepared a patch that adds an -old-param flag to qemu (to be used together with -append), see patch-arm-oldparms (attached). And the reason I got nothing on ttyS0 was simply that the sharp kernel had CONFIG_SERIAL_CONSOLE unset... (as seen e.g. in linux/arch/arm/def-configs/terrier-j) > >> Could be, but can `info jit' also show no change then? (qemu is still >> using all the cpu time it can get.) > > Oh, then maybe it really hangs. I have only tested 2.6 kernels from > different trees (but they were all descendants of linus' tree more > than Sharp's) and OpenBSD (some post 4.0 cvs checkout). It's possible > that Sharp kernels depend on something that is set up by the Sharp > PROM code, which is closed-source (the one that runs the japanese > menu). It should be possible to run it in qemu though. I've managed to build a sharp kernel with a modified config now (sidux live cd to the rescue!) and then saw that its hanging after the sound init. built a cross gdb (which was easier than I thought, luckily qemu's gdbserver listens on the network so I didn't even have to build a qemu snapshot on linux :), and found it hanging in a tight loop waiting for bit 0 (TNF) of SASR0 in corgi_i2s_write in linux/drivers/sound/pxa-i2s_spitz.c . Patched that (not sure its right but it works for me, see patch-pxa-audio), and now I get lots of nand ecc errors and mount failures, I guess the mtdparts= arg isnt right yet and/or the raw2flash.c source needs fixing... > >> > Installing debian however should not >> >depend on what rom you use, afterall debian is supposed to replace the >> >contents. >> >> Well I dont want to replace the contents, I want to run debian in >> addition to the sharp stuff in a chroot :) See e.g. here, >> http://wiki.debian.org/PocketWorkstation >> and under `Installing Debian/PocketWorkstation' here: >> http://www.users.on.net/~hluc/myZaurus/jumbo/xqtjumbo.html >> (these instructions and packages are a bit dated and not directly for >> c3200 which is one of the reasons i'd like to test/prepare things >> using qemu.) > > I still think that debian shouldn't care about what was your original > distribution or what distribution hosts the chroot environment. In an ideal world... At least it interacts with the (old in this case) kernel, and also the xserver (x/qt) that will run outside the chroot. Thanx, Juergen --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-arm-oldparms Index: qemu/hw/arm_boot.c @@ -76,6 +76,76 @@ stl_raw(p++, 0); } +static void set_kernel_args_old(uint32_t ram_size, int initrd_size, + const char *kernel_cmdline, + target_phys_addr_t loader_start) +{ + uint32_t *p; + unsigned char *s; + + /* see linux/include/asm-arm/setup.h */ + p = (uint32_t *)(phys_ram_base + KERNEL_ARGS_ADDR); + /* page_size */ + stl_raw(p++, 4096); + /* nr_pages */ + stl_raw(p++, ram_size / 4096); + /* ramdisk_size */ + stl_raw(p++, 0); +#define FLAG_READONLY 1 +#define FLAG_RDLOAD 4 +#define FLAG_RDPROMPT 8 + /* flags */ + stl_raw(p++, FLAG_READONLY | FLAG_RDLOAD | FLAG_RDPROMPT); + /* rootdev */ + stl_raw(p++, (31 << 8) | 0); /* /dev/mtdblock0 */ + /* video_num_cols */ + stl_raw(p++, 0); + /* video_num_rows */ + stl_raw(p++, 0); + /* video_x */ + stl_raw(p++, 0); + /* video_y */ + stl_raw(p++, 0); + /* memc_control_reg */ + stl_raw(p++, 0); + /* unsigned char sounddefault */ + /* unsigned char adfsdrives */ + /* unsigned char bytes_per_char_h */ + /* unsigned char bytes_per_char_v */ + stl_raw(p++, 0); + /* pages_in_bank[4] */ + stl_raw(p++, 0); + stl_raw(p++, 0); + stl_raw(p++, 0); + stl_raw(p++, 0); + /* pages_in_vram */ + stl_raw(p++, 0); + /* initrd_start */ + if (initrd_size) + stl_raw(p++, loader_start + INITRD_LOAD_ADDR); + else + stl_raw(p++, 0); + /* initrd_size */ + stl_raw(p++, initrd_size); + /* rd_start */ + stl_raw(p++, 0); + /* system_rev */ + stl_raw(p++, 0); + /* system_serial_low */ + stl_raw(p++, 0); + /* system_serial_high */ + stl_raw(p++, 0); + /* mem_fclk_21285 */ + stl_raw(p++, 0); + /* zero unused fields */ + memset(p, 0, 256 + 1024 - (p - ((uint32_t *)(phys_ram_base + KERNEL_ARGS_ADDR)))); + s = phys_ram_base + KERNEL_ARGS_ADDR + 256 + 1024; + if (kernel_cmdline) + strcpy (s, kernel_cmdline); + else + stb_raw(s, 0); +} + void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, int board_id, target_phys_addr_t loader_start) @@ -140,6 +210,9 @@ bootloader[6] = entry; for (n = 0; n < sizeof(bootloader) / 4; n++) stl_raw(phys_ram_base + (n * 4), bootloader[n]); - set_kernel_args(ram_size, initrd_size, kernel_cmdline, loader_start); + if (old_param) + set_kernel_args_old(ram_size, initrd_size, kernel_cmdline, loader_start); + else + set_kernel_args(ram_size, initrd_size, kernel_cmdline, loader_start); } } Index: qemu/vl.c @@ -204,6 +204,7 @@ int nb_option_roms; int semihosting_enabled = 0; int autostart = 1; +int old_param = 0; const char *qemu_name; int alt_grab = 0; #ifdef TARGET_SPARC @@ -6949,6 +6950,7 @@ QEMU_OPTION_semihosting, QEMU_OPTION_name, QEMU_OPTION_prom_env, + QEMU_OPTION_old_param, }; typedef struct QEMUOption { @@ -7050,6 +7052,9 @@ #if defined(TARGET_SPARC) { "prom-env", HAS_ARG, QEMU_OPTION_prom_env }, #endif +#if defined(TARGET_ARM) + { "old-param", 0, QEMU_OPTION_old_param }, +#endif { NULL }, }; @@ -7825,6 +7830,8 @@ nb_prom_envs++; break; #endif + case QEMU_OPTION_old_param: + old_param = 1; } } } Index: qemu/vl.h @@ -170,6 +170,7 @@ extern int no_quit; extern int semihosting_enabled; extern int autostart; +extern int old_param; extern const char *bootp_filename; #define MAX_OPTION_ROMS 16 --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-pxa-audio Index: qemu/hw/pxa2xx.c @@ -1564,7 +1564,12 @@ case SACR1: return s->control[1]; case SASR0: +#if 1 + /* XXX is this right? (TNF) */ + return s->status | (s->fifo_len < 16 || !s->enable); +#else return s->status; +#endif case SAIMR: return s->mask; case SAICR: --h31gzZEtNLTqOjlF--