From owner-freebsd-arm@FreeBSD.ORG Mon Aug 18 15:16:38 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85C28156; Mon, 18 Aug 2014 15:16:38 +0000 (UTC) Received: from mail-wi0-x229.google.com (mail-wi0-x229.google.com [IPv6:2a00:1450:400c:c05::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE5B93335; Mon, 18 Aug 2014 15:16:37 +0000 (UTC) Received: by mail-wi0-f169.google.com with SMTP id n3so3845221wiv.0 for ; Mon, 18 Aug 2014 08:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=El/lM4rpKik+e8SOBVEm32i6STq3PEwzZSlhG3eRRL4=; b=lRR5smH6tf7pouG1/G7UefyndWJjiLop00lkYCTPSM31vT7Ik4AdRXbrRSKPu3b/Ga PTiR0lGxl2BRbpS3ls0mAdgTI1VXnamhfWu8UAHnDGXuoR9JZ97ACVL4zajgMQg0xT5H hqYc+OdOZnVXUyW0XU1+0tNmUPGUwl7jszC89/3LyJOx8bgUeQA3wsNOS8vXjuvJGJcY Dc6Lq3+ixKL/iFVkz1fJ870KetEcz9myHP8+u7dqMrFsqIRqRK/Ijw1P3QrxfFbCSvBs 6QjHbQB/hphwjNSJ3GDS3DCtxujkrVqknb4pz4aUC2frloxCxORn7VjV3aTNiAKv/ogd p2DA== MIME-Version: 1.0 X-Received: by 10.180.91.111 with SMTP id cd15mr74306736wib.69.1408374995958; Mon, 18 Aug 2014 08:16:35 -0700 (PDT) Received: by 10.180.87.228 with HTTP; Mon, 18 Aug 2014 08:16:35 -0700 (PDT) Date: Mon, 18 Aug 2014 19:16:35 +0400 Message-ID: Subject: GSoC final status: porting FreeBSD to Android Emulator From: Alexander Tarasikov To: Gavin Atkinson , "freebsd-arm@freebsd.org" , soc-status@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Aug 2014 15:16:38 -0000 Hi FreeBSD/ARM hackers! I am reporting my status on the project. At the start of the project in spring I have written the device drivers for the IRQ chip, timer and framebuffer, but I was unable to verify they work because I needed a working rootfs. I started by using an MD_ROOT ramdisk for debugging init. I have spent most of the summer debugging the random memory corruption which prevented the kernel from booting on Android Emulator. I have tried various methods, like emulating TLS/PCPU with a memory page, but none of them helped. By trying to build a kernel for VERSATILEPB and running in QEMU I have verified it's not the problem in sources/compiler. By porting board code from Android Emulator to QEMU and observing it booting I came to the conclusion that the problem was caused by something in Android Emulator which is based on a very old version of QEMU. Ultimately I decided to try a "nightly" build of emulator, and that has resolved the problem. Unfortunately, I was unable to figure out the precise difference between Linux and FreeBSD MMU management that prevented FreeBSD from booting on regular builds of the emulator, but I have decided to focus on getting device drivers working first. Today I have finished implementing the MMC driver which has allowed to boot into the userland. I have also fixed the timer driver by adding the call to cpu_initclocks_bsp initcall and fixing the timer resolution. I have verified the virtual ethernet driver is also working. I have configured a custom MAC address in qemu and verified the kernel sees it. I have currently pushed the changes against FreeBSD-10 to my git repository. Later this week I plan to clean up the drivers a bit and format the code to look like other FreeBSD driver, rebase it and then push to the GSoC SVN repository. https://github.com/astarasikov/freebsd/commits/android_goldfish_arm_10.0.0?author=astarasikov I used the SD card image for Raspberry Pi which I have obtained from http://ftp4.us.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/10.0/FreeBSD-10.0-STABLE-arm-armv6-RPI-B-20140729-r269271.img.bz2 Here is the boot log of the first successful boot into userland: http://pastebin.com/ZzReDjDH It is very verbose but in the last lines we can see that it has started init, initialized loopback device and showed and getty prompt. You can obtain the prebuilt kernel image from the following link. I have also updated the wiki page with this information. https://drive.google.com/file/d/0B7wcN-tOkdeRN0lRUDJKa2pWM0U/edit?usp=sharing Please note that the nightly builds of Android Emulator are 64-bit and work on Linux and Mac OS X. To get them working on FreeBSD it would be necessary to compile a 32-bit build. If you are interested in just running Android Emulator on FreeBSD, it works just fine once you install linux_base-f10 or some other linux library set. I will provide the emulator binary later. If anyone wants to make a port, please note that you have to use GCC, because QEMU's TCG is broken when compiled with clang :( Due to wasting a lot of time on MMU issues and debugging the MMC driver, I was unable to write the "events" driver for keyboard input. I plan to do it this week. I will also verify that framebuffer driver is working correctly. I have noticed that a new interface is being developed instead of SYSCONS, so maybe I will migrate the driver to it. My overall impression is positive. Although I have spend time debugging MMU, I have learnt about the UMA memory allocator in the process. I want to resolve the remaining issues in the next two weeks and then I plan to add the support for the OMAP5 System-on-Chip to FreeBSD because I have such board and I want to try out Xen DOMU. -- Regards, Alexander