NanoBSD config script for RPI2

Karl Denninger karl at denninger.net
Sat Feb 4 19:39:35 UTC 2017


On 2/4/2017 12:56, Karl Denninger wrote:
> On 2/4/2017 10:38, Warner Losh wrote:
>> On Sat, Feb 4, 2017 at 5:55 AM, Karl Denninger <karl at denninger.net> wrote:
>>> It fails here during image create....
>>>
>>> Populating `/pics/CrossBuild/embedded/rpi2/_.s2'
>>> Image `/pics/CrossBuild/embedded/rpi2/_.s2' complete
>>> + [ -n s1 ]
>>> + eval 's1=fat16b'
>>> + s1=fat16b
>>> + out=/pics/CrossBuild/embedded/images/_.disk.image.HD-MCP
>>> + mkimg -a 3 -s mbr -p 'fat16b:=/pics/CrossBuild/embedded/rpi2/_.s1' -p
>>> 'freebsd
>>> :=/pics/CrossBuild/embedded/rpi2/_.s2' -p
>>> 'freebsd:=/pics/CrossBuild/embedded/rp
>>> i2/_.s3' -o /pics/CrossBuild/embedded/images/_.disk.image.HD-MCP
>>> mkimg: invalid option -- a
>>> mkimg: error: unknown option
>>>
>>> usage: mkimg <options>
>>>     options:
>>>         --formats       -  list image formats
>>>         --schemes       -  list partition schemes
>>>         --version       -  show version information
>>>
>>>         -b <file>       -  file containing boot code
>>>         -c <num>        -  capacity (in bytes) of the disk
>>>         -f <format>
>>>         -o <file>       -  file to write image into
>>>         -p <partition>
>>>         -s <scheme>
>>>         -v              -  increase verbosity
>>>         -y              -  [developers] enable unit test
>>>         -H <num>        -  number of heads to simulate
>>>         -P <num>        -  physical sector size
>>>         -S <num>        -  logical sector size
>>>         -T <num>        -  number of tracks to simulate
>>>
>>>     formats:
>>>         qcow    -  QEMU Copy-On-Write, version 1
>>>         qcow2   -  QEMU Copy-On-Write, version 2
>>>         raw     -  Raw Disk
>>>         vhd     -  Virtual Hard Disk
>>>         vhdf    -  Fixed Virtual Hard Disk
>>>         vmdk    -  Virtual Machine Disk
>>>
>>>     schemes:
>>>         apm     -  Apple Partition Map
>>>         bsd     -  BSD disk label
>>>         ebr     -  Extended Boot Record
>>>         gpt     -  GUID Partition Table
>>>         mbr     -  Master Boot Record
>>>         pc98    -  PC-9800 disk partitions
>>>         vtoc8   -  SMI VTOC8 disk labels
>>>
>>> Is the "-a" flag attempting to set the active partition?  It appears
>>> there's no option to do that in mkimg...
>> Install a newer mkimg:
>>
>> Revision 307550 - (view) (download) (annotate) - [select for diffs]
>> Modified Tue Oct 18 05:43:12 2016 UTC (3 months, 2 weeks ago) by imp
>> File length: 3730 byte(s)
>> Diff to previous 307544
>>
>> Add a new flag to mkimg (-a num) to specify the active partition for
>> those partitioning schemes that have this concept. Implement it as an
>> override for mbr's setting 0x80 in the flags for the first partition
>> when we have boot code.
>>
>> Differential Revision: https://reviews.freebsd.org/D4403
>>
>> Though maybe I should try to add it to the bootstrap tools so I can
>> use a new one after the build.
>>
>> Warner
>>
> root at NewFS:/disk/karl # uname -v
> FreeBSD 11.0-STABLE #15 r312669M: Mon Jan 23 14:01:03 CST 2017    
> karl at NewFS.denninger.net:/usr/obj/usr/src/sys/KSD-SMP
> root at NewFS:/disk/karl # which mkimg
> /usr/bin/mkimg
> root at NewFS:/disk/karl # pkg install mkimg
> Updating FreeBSD repository catalogue...
> FreeBSD repository is up-to-date.
> All repositories are up-to-date.
> pkg: No packages available to install matching 'mkimg' have been found
> in the repositories
> root at NewFS:/disk/karl #
>
> So.... it's part of base and there is no obvious package (a check for
> ports in */*mkimg* fails too); my system is current as of Jan 23....
>
> (As an aside I think if I remove the -a it may work on the Pi, since the
> Pi will try to boot the first partition which happens to be DOS -- I
> think.  I'll try it.)
>
There's another (potentially large) problem: If you need to add packages
to the distribution, and the target of the build is not the same as the
machine you're building on then the pkg add command in the handbook fails.

root at NewFS:/pics/CrossBuild/embedded/rpi2 # more _.cust.install_packages
+ install_packages
+ mkdir -p /pics/CrossBuild/embedded/rpi2/_.w/packages
+ cp
/pics/CrossBuild/src/tools/tools/nanobsd/packages/dhcpd-5.8.20151202.txz
/pics/CrossBuild/src/tools/tools/nanobsd/packages/net-snmp-5.7.3_11.txz
/pics/CrossBuild/src/tools/tools/nanobsd/packages/ntimed-0.0.2015.01.30.txz
/pics/CrossBuild/embedded/rpi2/_.w/packages
+ chroot /pics/CrossBuild/embedded/rpi2/_.w sh -c 'cd packages; pkg_add
-v *;cd ..;'
chroot: sh: Exec format error

You chroot into there and the image you're attempting to "pkg_add" with
it an arm executable, which of course my nice Amd64 processor cannot
grok..... Fixing that might get kinda messy (are the databases even
compatible across architectures?)

-- 
Karl Denninger
karl at denninger.net <mailto:karl at denninger.net>
/The Market Ticker/
/[S/MIME encrypted email preferred]/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2993 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20170204/002abf09/attachment.bin>


More information about the freebsd-arm mailing list