building a raspberry pi -head image, the dirty non-root way
Warner Losh
imp at bsdimp.com
Thu Dec 25 19:44:00 UTC 2014
> On Dec 25, 2014, at 11:21 AM, Adrian Chadd <adrian at freebsd.org> wrote:
>
> 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
You don’t need INSTALL_AS_USER at all or DESTDIR here, which simplifies this a lot. You also don’t need both __MAKE_CONF and SRCCONF since you’re building in tree.
> 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
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=yes. 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:
>
> 1052 5:25 makefs -t ffs -o version=2 -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:
>
> 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.
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.
>
> 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’t matter…
Warner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20141225/fddd5b8a/attachment.sig>
More information about the freebsd-arm
mailing list