[Toybox] FreeBSD porting, removing bashisms

Rob Landley rob at landley.net
Thu Apr 21 18:22:08 PDT 2016


On 03/31/2016 11:57 AM, Ed Maste wrote:
> On 31 March 2016 at 03:07, Zack Breckenridge <zbrdge at gmail.com> wrote:
>>> How do I set up a freebsd test build environment, preferably under a VM?
>>
>> The FreeBSD project now distributes VM images for installation/testing. For
>> example you can find some development branch snapshots here (for stable
>> branches just go up a few levels and find 10.x):
>>
>> http://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/11.0-CURRENT/amd64/20160308/
>>
>> Notice there's a qcow2 image there for easy testing with KVM. You might even
>> be able to run a live environment and use pkgng ("pkg" command) to grab
>> gcc/clang etc. and then use "fetch" to pull down toybox.
> 
> The brief instructions I put together for developers of another
> project to test on FreeBSD, on one of the snapshot VMs:
> 
> 1. Log in as root on the console
> 2. Run "ifconfig -l" to list network interfaces The virtual nic will
> likely be em0 or vtnet0 depending on the VM software.
> 3. Add to /etc/rc.conf (assuming vtnet0 interface here):
> 
> ifconfig_vtnet0="DHCP"
> sshd_enable="YES"

Editing this file did not cause the interface to magically configure
itself, but "dhclient em0" worked.

> 4. Run pkg and answer Y to install the package management tool

Hmmm, phone tether's on a data budget and I dunno how much that'll
download, so "shutdown -h now" for now...

Yay, "lock order reversal" right after "All buffers synced." in
vfs_mount.c;1222 and vfs_subr.c:2498, stack trace: witness_debugger,
witness_checkorder, __lockmgr_args, vop_stdlock, VOP_LOCK1_APV,
_vn_lock, vget, devfs_allocv, devfs_root, dounmount, vfs_unmountall,
bufshutdown, kern_reboot, sys_reboot.

> 5. Run pkg install git gcc gmake

You mentioned I could skip gcc, so I just did "pkg install git gmake".
It's downloading perl, python, curl, cvsps, expat, libffi, cvsps,
readline, gettext-runtime... This is _sad_.

> 6. Run adduser to create a user account
> 7. Run shutdown -r now to reboot
> 8. ssh to the VM as your user account

I just logged out and logged back in as my new user, git cloned toybox,
ran gmake allnoconfig, and it died with scripts/genconfig.sh command not
found, which i'm guessing means no bash. There's no sudo, but "su -"
works, to switch to root and install bash...

Bash requires fdescfs mounted on /dev/fd. What? Ok...? Mounting,
adjusting fstab...

There's still no /bin/bash? It's in /usr/local/bin. Sigh. Ok, as root
"ln -s /usr/local/bin/bash /bin/bash"

Hey, gmake allnoconfig finished! Woo! Trying the actual build... Died
telling me to PLEASE submit a bug report to freebsd.org. Well that's
nice. Lemme see if whatever shell this is understands the 2>&1 | tee
syntax to capture the log...

Ah, your sed is horked. Right, lemme see what I can do about that...

Possibly I can take it from here?

> I included gcc in the pkg command above but you can leave it out and
> just use the Clang in the base system. The brief experimentation I've
> done with toybox is on FreeBSD 10, with Clang 3.4.1. If you use a
> FreeBSD 11 snapshot from the link above you'll have Clang 3.8.

People are building it with clang so I know it basically works, and my
own clang test environment would be nice.

Thanks,

Rob



More information about the Toybox mailing list