I was compiling an embedded image using nanobsd when I realised that I was adding packages for the wrong architecture. My development machine was running amd64, but the target requires i386. Cross-compiling to i386 seems to work, but a problem remained with packages. I was using pkg_add to fetch the latest packages, and didn't want to add them manually.
I patched /usr/src/usr.sbin/pkg_install/add/main.c to solve my problem. I added a '-A' or '--architecture' argument which lets pkg_add fetch other architectures.
I would like to submit my patch to the community in case any one else has similar needs. I realise that I probably don't fulfill the style requirements, and I guess my patch file may be fully standard conforming, but hope that my, albeit small, contribution may be accepted.
[CMD=""]-A i386[/CMD][CMD=""]--architecture i386[/CMD]
[The extension diff has been deactivated and can no longer be displayed.]