From owner-freebsd-arm@freebsd.org Thu Dec 29 13:13:01 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34CEFC95E42 for ; Thu, 29 Dec 2016 13:13:01 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3401189 for ; Thu, 29 Dec 2016 13:13:00 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id y21so220835999lfa.1 for ; Thu, 29 Dec 2016 05:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pycqXzXcZwk2NDinQ7iIPlJLG1YWY2fDzx1tQWWb/xg=; b=kki/tzKQH1gMciEgW6TXZ+HPW0Lv8L2pFJKijnhmMEzw6r763djXTp5XmB55nEm1xn LEDOsJ5JZOIDeYngWEvrVbDHZUb9Br5LSj96PVnuA1qsA+ZJ0AK5fbZhgL6UamePAu9R MQamRCp5Iowxd3gvmWcNzpamU6mnoBxYvZf9nV4t2x8zRkYvw0pXKzBJVTK9e9bQ508q YsFavbqo/UdDha78Bj6DlVkg9mNef5zFsGkXmI5EF3c7WzDuNgJQLoHLQxbcZTjuy52j YlRiK7sS3//v8J/laKoQMA6wVPI8U7fsiarmAlZZE8NMlufXPHjvso4QxCiWzHZlH8X0 dZVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pycqXzXcZwk2NDinQ7iIPlJLG1YWY2fDzx1tQWWb/xg=; b=oXKkcmaAmT1GnLak6bhhye9Vv5+5FD4q2SJjwN0pg+WRF60bi/TXuAqyKhfSPNXqDF nWUHemOpYs3LA+dZgGeXfwplszGvIjiFmtNiCLBoKxqsAAiUSLx+mSOYyQUQQzEgUAi1 q7QwDc2caCrvEmzv9qgt+GoNwhEFG3HtxxCW0QiUlkmULDJ3SZN4uUPQqjvGUda424Yn 36SWJSqfffVp8UlOdb79dSG5Y/aEIefAkW+jn4xrxTo5HIDpsHHzK3TRPp0vubLb/pUU FAL6B6wLaiMZ/HcfJ2nQN/uFKB9lmF6dEpGHBYvtbz8Vit9J5VN+K7EXBkAjfAvC9EGh OoZA== X-Gm-Message-State: AIkVDXKbPxpW5lmJA1yNmyMSaH+4Co824v483m/U/jpc9482S6TYBCs8Vrig/9rNBwmQsxuBEKvSXqVJJisUwg== X-Received: by 10.46.72.18 with SMTP id v18mr14566923lja.12.1483017178847; Thu, 29 Dec 2016 05:12:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.0.194 with HTTP; Thu, 29 Dec 2016 05:12:58 -0800 (PST) In-Reply-To: References: From: Jason Harmening Date: Thu, 29 Dec 2016 05:12:58 -0800 Message-ID: Subject: Re: loading 'VIRT' kernel in qemu To: Oleksandr Tymoshenko Cc: freebsd-arm@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 13:13:01 -0000 On Wed, Dec 28, 2016 at 11:25 AM, Oleksandr Tymoshenko wrote: > > On Dec 27, 2016, at 1:48 PM, Jason Harmening > wrote: > > Hi everyone, > > I'm making some tweaks to the armv6 pmap to mirror some recent i386 > changes. I don't have arm hardware readily available, so I thought I'd > give qemu a whirl instead of asking other people to test my changes for > me. Since I need SMP but don't need any specific peripheral hw, the 'VIR= T' > kernel seems like my best bet. > > I've successfully booted mips[64] under qemu, so naively starting out w/ > the same steps I use for mips: > > 1). build armv6 world and VIRT kernel, install world to temp directory > 2). use makefs(8) to build a 4GB (little endian) fs image from temp dir > 3). Run qemu: > qemu-system-arm -M virt -kernel -hda > -nographic -m 1024 > > ...fails immediately: > qemu: fatal: Trying to execute code outside RAM or ROM at 0xc1000100 > > R00=3D00000000 R01=3D00000000 R02=3D00000000 R03=3D00000000 > R04=3D00000000 R05=3D00000000 R06=3D00000000 R07=3D00000000 > R08=3D00000000 R09=3D00000000 R10=3D00000000 R11=3D00000000 > R12=3D00000000 R13=3D00000000 R14=3D00000000 R15=3Dc1000100 > > hmm, looks pretty close to KERNVIRTADDR. > > Most online docs for qemu-system-arm seem to assume a prebuilt linux kern= el > and initrd, the rest are...fragmented-to-nonexistent. I've seen a few > hints that I might need to wrap the kernel image up along w/ u-boot, but > the u-boot images seem to be very SoC-specific. > > Any help would be much appreciated, sorry for the n00b question. > > > Hi Jason, > > It looks like for VIRT kernel is supposed to be used with UEFI. At least > this part of NanoBSD sources hints at it: > http://sources.freebsd.org/HEAD/src/tools/tools/nanobsd/ > embedded/qemu-armv7.cfg > You can probably use NanoBSD-generated image for your experiments > Ah, thanks! That should make things a good deal easier. Using the nanobsd-generated images and the qemu invocation from qemu-armv7.cfg, I get a bit further but end up with a repeating prefetch abort: Prefetch Abort Exception PC at 0xFF176790 CPSR 0x80000113 This is either in UEFI or very early in kernel bootstrap, since the copyright hasn't printed yet...haven't poked at it to figure out where the pc comes from yet. > VERSATILEPB kernel used to work with QEMU but I=E2=80=99ve just tried to = boot > it and it doesn=E2=80=99t seem to work. Will need some time to track down= what=E2=80=99s > wrong > with it. VERSATILEPB kernel needs a wrapper to make it act as a ROM > image. Wrapper and command to run it you can find here: > https://github.com/freebsd/crochet/blob/master/board/VersatilePB/setup.sh > > >