From owner-freebsd-arm@FreeBSD.ORG Thu Dec 25 19:44:00 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2505466D for ; Thu, 25 Dec 2014 19:44:00 +0000 (UTC) Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com [209.85.213.179]) (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 DF2A964998 for ; Thu, 25 Dec 2014 19:43:59 +0000 (UTC) Received: by mail-ig0-f179.google.com with SMTP id r2so8195832igi.0 for ; Thu, 25 Dec 2014 11:43:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=HczVwyQ5n17DbnhLLlIQEROSDJTyOdu//yuMRfuPne8=; b=OMu49Q4I8F3yVO4cwagYGRSZKQhNbJdlXh4pfcgGbLqFn9nEPsZ6C5TLFZKWM2IbOM ZIufqSZXlgabAnUWkTnpwLVA1nn72mv8yIGvaadLMrFadgIk/w+VHct7236DQJnjAJSg NDgKGSBp14q6xSM6mirXhJhZAsTb4hSI2GrKukV8xmmPq9TlIjaGjEsv7Lr060E63JUp 4yoJBfSbap1/E8dVjhzrl5HeA5mhOr+ifURYgSt/2LN93G/aQn4IKry8jLtkz/vTP9ws GcauD0m5XiKH+hdwBrFTWVMRqhFXZsemhZkkjmLJs1KbNbmLq3IfK18DC0LWFKAnvT6I tkAA== X-Gm-Message-State: ALoCoQmUzWYmsqUlZhhOuryQ/PC5O60yenSan2uz0cGb3FJGWO5CwB+S+mG6GpzC8JRG4Xjs8Ff+ X-Received: by 10.107.3.37 with SMTP id 37mr35667459iod.82.1419536632979; Thu, 25 Dec 2014 11:43:52 -0800 (PST) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by mx.google.com with ESMTPSA id 137sm13158822ioo.23.2014.12.25.11.43.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Dec 2014 11:43:52 -0800 (PST) Sender: Warner Losh Subject: Re: building a raspberry pi -head image, the dirty non-root way Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Content-Type: multipart/signed; boundary="Apple-Mail=_B4046EBC-78E5-4718-A408-8115D285B384"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b3 From: Warner Losh In-Reply-To: Date: Thu, 25 Dec 2014 12:43:51 -0700 Message-Id: <6A829B81-BB50-4941-8F63-7F7ED8439EE7@bsdimp.com> References: To: Adrian Chadd X-Mailer: Apple Mail (2.1993) Cc: "freebsd-arm@freebsd.org" 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 19:44:00 -0000 --Apple-Mail=_B4046EBC-78E5-4718-A408-8115D285B384 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 25, 2014, at 11:21 AM, Adrian Chadd wrote: >=20 > Hi, >=20 > 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. >=20 > I was mostly successful. I'll be 100% successful after christmas. :) >=20 > So I don't lose it and so we can all hopefully improve upon it: >=20 >=20 > 1013 4:09 env > MAKEOBJDIRPREFIX=3D/home/adrian/work/freebsd/head-arm/obj make -j4 > buildworld buildkernel > __MAKE_CONF=3D/home/adrian/work/freebsd/head-arm/make.conf > SRCCONF=3D/home/adrian/work/freebsd/head-arm/src.conf KERNCONF=3DRPI-B > INSTALL_AS_USER=3Dyes TARGET_ARCH=3Darmv6 > DESTDIR=3D/home/adrian/work/freebsd/head-arm/root You don=E2=80=99t need INSTALL_AS_USER at all or DESTDIR here, which = simplifies this a lot. You also don=E2=80=99t need both __MAKE_CONF and = SRCCONF since you=E2=80=99re building in tree. > then >=20 > 1013 4:09 env > MAKEOBJDIRPREFIX=3D/home/adrian/work/freebsd/head-arm/obj make -j4 > buildworld buildkernel > __MAKE_CONF=3D/home/adrian/work/freebsd/head-arm/make.conf > SRCCONF=3D/home/adrian/work/freebsd/head-arm/src.conf KERNCONF=3DRPI-B > INSTALL_AS_USER=3Dyes TARGET_ARCH=3Darmv6 > DESTDIR=3D/home/adrian/work/freebsd/head-arm/root You pasted this wrong. There should be a installworld / installkernel = here, without the INSTALL_AS_USER (which is going away, btw), but with = NO_ROOT=3Dyes. Again, you only need one of SRCCONF or __MAKE_CONF. > .. then I end up with a ../root/METALOG file, which I can feed into = makefs: >=20 > 1052 5:25 makefs -t ffs -o version=3D2 -F ../root/METALOG -B le = -m > 1073741824 -M 1073741824 -f 1000000 -x ../rootfs-img ../root/ Yea, usually one should have some extra indoors and such. > 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. Last time I went looking, finding all the bits, except boot, was = trivial. With the u-boot-rpi package, that should be even easier now. We = should maybe add them to the u-boot-rpi package. > So then: msdos partition: >=20 > cd .. >=20 >=20 > 54 dd if=3D/dev/zero of=3Dmsdos.img bs=3D1m count=3D32 > 55 newfs_msdos ./msdos.img >=20 > .. and then populating it, using the "mtools" GNU package: >=20 > 35 for i in `ls rpigoo/`; do echo $i; mcopy -i ./test-img > rpigoo/$i "::$i" ; done >=20 > then to see what's in there: >=20 > 34 mdir -i ./test-img >=20 > Finally, build a complete image using mkimg: >=20 > 49 mkimg -s mbr -p fat32:=3D./test-img -p freebsd:=3D./bsd.img -o = mbr-bsd.img >=20 > I'm not sure if we should be using the FAT32 partition type, but hey, > it actually worked. Either will work... > 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. >=20 > 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. Yea, I have rough drafts of both of those in my tree, waiting for my day = job to calm down a bit. > 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. Good thing the ownership of symbolic links basically doesn=E2=80=99t = matter=E2=80=A6 Warner --Apple-Mail=_B4046EBC-78E5-4718-A408-8115D285B384 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUnGj3AAoJEGwc0Sh9sBEAvU0P/jWeb3meZmO8fsVmo1jCCsu7 SMulvWT5W8UWnmENLmEqKPIMiDlwk4ex9hZ7s2+kZdl7+m+SiaAuCNtYiT35Zra8 4G5UkjhkDena2yTt5Rc2hrB+TKXKKOIVjQ91r+8eKMM8QriQtUPd3FegkNFuFxVQ oc4EmX5Q5zefeLLOOB6iMEjRQgYkqM6p2puKzHeT6kqmwd5UFI9MmwFbgnminf0C xeDqWrEG/G65850IZXO/lNOESsTI3YzQT5k2DNn946qcAY1V86jHZwsmu0UERTGX dY7AjWnIw/msI0Lm5TUTNseKV11vAJtBSN2PUdqkbCW/wRQk78bkp6mSlLSHgxAn f2XgbiY+v5iiXTIV3JVNOx4ieLCXcbYjjYmQJc0mr8TpVhUo7MJMIwU5IcWZ24zh 7+fPebWTl5b6A74JFs+oQlLD3MheK4t7H6mfziJbQS6BPDi8XB7mDHNiESfyaMae +vBQSxGMsoFRpFmSk793qw+Yo9Wiw+z096FgCuUDoc+jEaWIJxKcWm8afXIBdkt8 sz86QzcGzoAVqflv8q+aFN0iF0XkwTObD1IT7xKlYF9Oh1J5NA6U+2PgCNxJNIuq +vEwSTvjBTVnB+RISIZciUBK3qyo+kTnbhEhImq1QzvHm4M1LUVMUw9a4ez768Vo j8q62ezfz8T3mxjaBdPb =rnB0 -----END PGP SIGNATURE----- --Apple-Mail=_B4046EBC-78E5-4718-A408-8115D285B384--