From owner-freebsd-arm@FreeBSD.ORG Thu Dec 25 18:21:14 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8DA1A55B for ; Thu, 25 Dec 2014 18:21:14 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (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 2230F101A for ; Thu, 25 Dec 2014 18:21:14 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id ex7so15875806wid.0 for ; Thu, 25 Dec 2014 10:21:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=m9K3kSFztzUiqwGKRzCkE+SAR/by5F0bYhlbs+vwbz0=; b=akFZS1MpsbvvBc8gQ1VXH7UeptoZ8aW6WjQNjsDZZgfdwmtoHL6ofHRDU8zBfYH1en nnYeEfSf9Ubeek5oTO/HMHnkVLn1IhbC1IoIoopJorV+yKpnhVijPJaE8LPMWIVEMbxv cDj5kO7Ipqav4yVZvpHgn0kLN7vPKSIUJYAcJu2gQiolhx8YCDAea2qgHD2zhXEnNnjQ VEqbloQ9wMvG04esNejvboTm5syL6hOm7B8WIJhD7nAlmkPmakgZdarG2wxQPR5sMtVO pnVoNgrhJwn26x1KVtFMxqH/JwH4z7VV+UTI3LJCIk+vVqNuQCFVcgC8tiplGDbL23li oagg== MIME-Version: 1.0 X-Received: by 10.180.80.163 with SMTP id s3mr61191768wix.59.1419531672062; Thu, 25 Dec 2014 10:21:12 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.106.195 with HTTP; Thu, 25 Dec 2014 10:21:11 -0800 (PST) Date: Thu, 25 Dec 2014 10:21:11 -0800 X-Google-Sender-Auth: T9KjfKQE8CA4T9ZFbFAQy8XBfoU Message-ID: Subject: building a raspberry pi -head image, the dirty non-root way From: Adrian Chadd To: "freebsd-arm@freebsd.org" Content-Type: text/plain; charset=UTF-8 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: Thu, 25 Dec 2014 18:21:14 -0000 Hi, In frustration, I decided to take a crack at building a raspberry pi image from -HEAD without using crochet and trying to use the non-root build things we have in the tree. I was mostly successful. I'll be 100% successful after christmas. :) So I don't lose it and so we can all hopefully improve upon it: 1013 4:09 env MAKEOBJDIRPREFIX=/home/adrian/work/freebsd/head-arm/obj make -j4 buildworld buildkernel __MAKE_CONF=/home/adrian/work/freebsd/head-arm/make.conf SRCCONF=/home/adrian/work/freebsd/head-arm/src.conf KERNCONF=RPI-B INSTALL_AS_USER=yes TARGET_ARCH=armv6 DESTDIR=/home/adrian/work/freebsd/head-arm/root then 1013 4:09 env MAKEOBJDIRPREFIX=/home/adrian/work/freebsd/head-arm/obj make -j4 buildworld buildkernel __MAKE_CONF=/home/adrian/work/freebsd/head-arm/make.conf SRCCONF=/home/adrian/work/freebsd/head-arm/src.conf KERNCONF=RPI-B INSTALL_AS_USER=yes TARGET_ARCH=armv6 DESTDIR=/home/adrian/work/freebsd/head-arm/root .. then I end up with a ../root/METALOG file, which I can feed into makefs: 1052 5:25 makefs -t ffs -o version=2 -F ../root/METALOG -B le -m 1073741824 -M 1073741824 -f 1000000 -x ../rootfs-img ../root/ Then we need to build a FAT partition with all the boot bits. Ian gave me a tarball of his; it turned out it included his netboot uboot environment so I didn't finish booting. However, that shouldn't be hard to fix. So then: msdos partition: cd .. 54 dd if=/dev/zero of=msdos.img bs=1m count=32 55 newfs_msdos ./msdos.img .. and then populating it, using the "mtools" GNU package: 35 for i in `ls rpigoo/`; do echo $i; mcopy -i ./test-img rpigoo/$i "::$i" ; done then to see what's in there: 34 mdir -i ./test-img Finally, build a complete image using mkimg: 49 mkimg -s mbr -p fat32:=./test-img -p freebsd:=./bsd.img -o mbr-bsd.img I'm not sure if we should be using the FAT32 partition type, but hey, it actually worked. So uboot booted, and then it tried netbooting. I'll redo this tonight without Ian's custom environment and see if it boots to a login prompt. Now, I don't think I'm going to turn this into a public script - what I am hoping we can do is teach nanobsd about these steps so it stops being x86 and "build as root" centric. The only gotcha so far? When using metalog to make an image with makefs, the symlinks show up as owned by adrian, not by root. I'll go set a bug for that soon. -adrian