Re: cross-arch building picobsd/nanobsd images ?

2012-01-04 Thread Jacques Fourie
I've posted a diff to -arm about 2 years ago that I used to
cross-build arm picobsd images for a gumstix platform on a i386 host.
I don't know if the diff will apply cleanly anymore but here it is in
anyway.
--- a/release/picobsd/build/Makefile.conf
+++ b/release/picobsd/build/Makefile.conf
@@ -21,7 +21,8 @@ MODULES?=-DNO_MODULES # do not build them as a default
 # If config were smart enough, we could place the config
 # file in some other place than ${SRC}/sys/i386/conf, but
 # at the moment (Oct.2001) this is not possible yet.
-CONF=${SRC}/sys/i386/conf
+#CONF=${SRC}/sys/i386/conf
+CONF=${SRC}/sys/${TARGET_ARCH}/conf
 #CONF=${BUILDDIR}/conf # XXX does not work yet
 CONFFILE=PICOBSD-${name}
 
@@ -39,10 +40,19 @@ ${BUILDDIR}/kernel: ${KERNFILE}
 ${KERNFILE}: ${COMPILE} do_a_make_in_the_kernel_directory_anyways
 
 do_a_make_in_the_kernel_directory_anyways:
+   unset TARGET_CPUTYPE
+   unset TARGET_BIG_ENDIAN
(cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} )
 
+trampoline:
+   unset TARGET_CPUTYPE
+   unset TARGET_BIG_ENDIAN
+   (cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} trampoline )
+
 ${COMPILE}: ${CONF}/${CONFFILE}
-   (cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
+   unset TARGET_CPUTYPE
+   unset TARGET_BIG_ENDIAN
+   (cd ${CONF}; PATH=${TMPPATH} ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} depend )
 
 ${CONF}/${CONFFILE}: PICOBSD
--- /dev/null
+++ b/release/picobsd/build/build.sh
@@ -0,0 +1 @@
+./picobsd --target_arch arm --target_cputype xscale --src 
/home/jacques/gumstix -n -v gumstix 
diff --git a/release/picobsd/build/picobsd b/release/picobsd/build/picobsd
index a3b3cf5..14235ff 100755
--- a/release/picobsd/build/picobsd
+++ b/release/picobsd/build/picobsd
@@ -21,6 +21,7 @@
 #   Makefile.conf  Makefile used to build the kernel
 #   config shell variables, sourced here.
 #   mfs.mtree  mtree config file
+#
 #   floppy.tree/   files which go on the floppy
 #   mfs_tree/  files which go onto the mfs
 #
@@ -28,13 +29,10 @@
 #   PICOBSDkernel config file
 #   config shell variables, sourced here.
 #   crunch.confcrunchgen configuration
-#   mfs.mtree  overrides ${PICO_TREE}/mfs.mtree
 #   floppy.tree.excludefiles from floppy.tree/ which we do not need 
here.
-#   floppy.tree/   local additions to ${PICO_TREE}/mfs_free
+#   floppy.tree/   local additions to the floppy.tree
 #   floppy.tree.${site}/ same as above, site specific.
 #   mfs_tree/  local additions to the mfs_free
-#   buildtree.mk   optional makefile to build an extension for floppy tree
-#  (generated in buildtree/ )
 
 #
 #--- The main entry point is at the end.
@@ -100,7 +98,7 @@ set_defaults() {
 EDITOR=${EDITOR:-vi}
 fd_size=${fd_size:-1440}
 
-o_use_loader=yes # use /boot/loader
+o_target_arch=i386
 o_all_in_mfs=yes # put all files in mfs so you can boot and run
# the image via diskless boot.
 o_clean= # do not clean
@@ -109,7 +107,7 @@ set_defaults() {
 o_tarv=  # tar verbose flag,  or v
 o_init_src=  # non  if we need to init libs and includes.
 o_makeopts=${MAKEOPTS:--s} # make options, be silent by default
-o_no_devfs=yes # we do not want devfs
+o_no_devfs=  # we do not want devfs
 o_do_modules=# do not build modules
 
 SRC=/usr/src # default location for sources
@@ -130,7 +128,6 @@ set_defaults() {
# mountpoint used to build memory filesystems
 c_fs=fs.PICOBSD# filename used for the memory filesystem
 c_img=picobsd.bin  # filename used for the picobsd image
-generate_iso=NO  # don't generate the iso image
 
 # select the right memory disk name
 case `uname -r` in
@@ -150,7 +147,6 @@ set_defaults() {
 trap fail 15
 }
 
-# use the new build infrastructure
 create_includes_and_libraries2() {
 local no
 log create_includes_and_libraries2() for ${SRC}
@@ -163,7 +159,7 @@ create_includes_and_libraries2() {
 export MAKEOBJDIRPREFIX
 ( cd ${SRC};
 # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld
-make _+_= $no toolchain _includes _libraries
+make _+_= $no toolchain
 )
 }
 
@@ -212,7 +208,7 @@ create_includes_and_libraries() {
 
 # set_type type looks in user or system directories for the floppy type
 # specified as first argument, and sets variables according to the config.
-# file. Also sets MY_TREE and BUILDDIR and SITE
+# file. Sets THETYPE, SITE, name, MY_TREE and BUILDDIR
 
 set_type() {
 local a i
@@ -260,13 +256,6 @@ set_msgs() {   # OK
 \t3.  Site-info: ${SITE}\n\t4.  Full-path: ${MY_TREE}\n
 }
 
-# build the iso image
-build_iso_image() 

Re: cross-arch building picobsd/nanobsd images ?

2012-01-04 Thread Adrian Chadd
On 4 January 2012 20:53, Jacques Fourie jacques.fou...@gmail.com wrote:
 I've posted a diff to -arm about 2 years ago that I used to
 cross-build arm picobsd images for a gumstix platform on a i386 host.
 I don't know if the diff will apply cleanly anymore but here it is in
 anyway.

Hi,

I've figured out all the right flags to pass to a cross-build
environment. Namely:

env CROSS_BUILD_TESTING=YES
MAKEOBJDIRPREFIX=${X_MAKEOBJDIRPREFIX}  \
make ${BUILD_FLAGS} TARGET=${TARGET}
TARGET_ARCH=${TARGET_ARCH} \
${X_TARGET_CPUTYPE} KERNCONF=${KERNCONF}
DESTDIR=${X_DESTDIR}   \
KODIR=/boot/kernel.${KERNCONF}/
 \
KMODDIR=/boot/kernel.${KERNCONF}/
 \
__MAKE_CONF=/dev/null SRCCONF=/dev/null
 \
LOCAL_DIRS=${LOCAL_DIRS}
 \
LOCAL_TOOL_DIRS=${LOCAL_TOOL_DIRS} $1
 \

.. ignore LOCAL_TOOL_DIRS, I haven't committed that yet to -HEAD.

If someone would like to update picobsd to make this work, I'll
happily test out patches and commit it to -HEAD.

Building -8 and previous needed some extra hacks (eg
TARGET_BIG_ENDIAN) which have been removed from -HEAD/-9.

Good luck!



Adrian
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: cross-arch building picobsd/nanobsd images ?

2012-01-04 Thread Garrett Cooper
On Wed, Jan 4, 2012 at 9:50 PM, Adrian Chadd adr...@freebsd.org wrote:
 On 4 January 2012 20:53, Jacques Fourie jacques.fou...@gmail.com wrote:
 I've posted a diff to -arm about 2 years ago that I used to
 cross-build arm picobsd images for a gumstix platform on a i386 host.
 I don't know if the diff will apply cleanly anymore but here it is in
 anyway.

 Hi,

 I've figured out all the right flags to pass to a cross-build
 environment. Namely:

...

 .. ignore LOCAL_TOOL_DIRS, I haven't committed that yet to -HEAD.

 If someone would like to update picobsd to make this work, I'll
 happily test out patches and commit it to -HEAD.

 Building -8 and previous needed some extra hacks (eg
 TARGET_BIG_ENDIAN) which have been removed from -HEAD/-9.

Here's the FreeNAS project/iXsystems' contribution to nanobsd
which was contributed back to Warner, but hasn't been reviewed /
committed to CURRENT since I missed my pre-Christmas window of
opportunity :(. There are some potentially helpful gems that could be
added to picobsd (and vice versa I'm sure) -- look for NANO_ARCH for
instance; it doesn't resolve the TARGET_BIG_ENDIAN issue noted
previously, but that's probably part of the reason why NANO_PMAKE is a
separate variable...
Thanks!
-Garrett


nanobsd-omnibus-01.04.2012.patch
Description: Binary data
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

Re: cross-arch building picobsd/nanobsd images ?

2011-12-24 Thread Ganbold
On 12/20/11 18:19, Olivier Cochard-Labbé wrote:
 On Mon, Dec 19, 2011 at 11:45 PM, Luigi Rizzo ri...@iet.unipi.it wrote:
 On a related topic, does anyone have experience on cross-building
 nanobsd images ?
 Hi Luigi,

 I using little cross-building nanobsd images (i386 on amd64 and vice versa).
 All my patchs for nanobsd are available on BSD Router Project
 (http://bsdrp.net) including a patch for compiling ports from nanobsd
 too.

 Right now I'm working on adding cross-build mips (RouterStation Pro)
 nanobsd patch but without the compiling ports feature, because I can
 only cross-compile word/kernel and I didn't know how to cross-compile
 ports.

I have done some nanobsd related changes (without ports) locally for RS
PRO 6 months ago, not sure how it is useful now.
But it could be easier to modify.

http://people.freebsd.org/~ganbold/nanobsd_rspro.tar.gz

Ganbold

 Regards,

 Olivier
 ___
 freebsd-current@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-current
 To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: cross-arch building picobsd/nanobsd images ?

2011-12-20 Thread Olivier Cochard-Labbé
On Mon, Dec 19, 2011 at 11:45 PM, Luigi Rizzo ri...@iet.unipi.it wrote:

 On a related topic, does anyone have experience on cross-building
 nanobsd images ?

Hi Luigi,

I using little cross-building nanobsd images (i386 on amd64 and vice versa).
All my patchs for nanobsd are available on BSD Router Project
(http://bsdrp.net) including a patch for compiling ports from nanobsd
too.

Right now I'm working on adding cross-build mips (RouterStation Pro)
nanobsd patch but without the compiling ports feature, because I can
only cross-compile word/kernel and I didn't know how to cross-compile
ports.

Regards,

Olivier
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: cross-arch building picobsd/nanobsd images ?

2011-12-20 Thread Garrett Cooper
2011/12/20 Olivier Cochard-Labbé oliv...@cochard.me:
 On Mon, Dec 19, 2011 at 11:45 PM, Luigi Rizzo ri...@iet.unipi.it wrote:

 On a related topic, does anyone have experience on cross-building
 nanobsd images ?

Hello Mr. Olivier!

 I using little cross-building nanobsd images (i386 on amd64 and vice versa).
 All my patchs for nanobsd are available on BSD Router Project
 (http://bsdrp.net) including a patch for compiling ports from nanobsd
 too.

Yeah, FreeNAS 8.x employs a similar semi-hacky way of doing a
full-blown chroot with a clean environment setup [that you might want
to steal ;)..[1]]

 Right now I'm working on adding cross-build mips (RouterStation Pro)
 nanobsd patch but without the compiling ports feature, because I can
 only cross-compile word/kernel and I didn't know how to cross-compile
 ports.

Let's work together on this. It's a non-trivial project that I'd like
to see come true for FreeNAS to build an ARM platform on x86 hardware
(someday..).

Also, I'd pick up some of the recent changes we made to nanobsd [2] --
it might help your cause.

Cheers,
-Garrett

1. http://freenas.svn.sourceforge.net/viewvc/freenas/trunk/nanobsd/common
(look for the CR function; follow the history back for credits to the
original inspiration).
2. http://freenas.svn.sourceforge.net/viewvc/freenas/trunk/build/nanobsd/
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: cross-arch building picobsd/nanobsd images ?

2011-12-20 Thread Michael Reifenberger

Hi,
I used to build a few ARM images (on amd64 host) using
/usr/src/tools/tools/nanobsd/gateworks/
and regularly i386 images (on amd64 host too) using
/usr/src/tools/tools/nanobsd/pcengines/

Bye/2
---
Michael Reifenberger
mich...@reifenberger.com
http://www.Reifenberger.com

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


cross-arch building picobsd/nanobsd images ?

2011-12-19 Thread Luigi Rizzo
Hi,
recently I have tried to build picobsd image for a different
architecture than the current one, with only partial success.

In particular, three weeks ago i committed some changes to the
picobsd script so now i can build working amd64 images on amd64.
However when i try a cross build (e.g. i386 image on an amd64 host)
the kernel stops right after trying to mount the root partition.
The error message is the following:

...
Timecounter TSC frequency 1858691100 Hz quality 800
Trying to mount root from ufs:/dev/md0 []...
panic: mutex Giant owned at .../sys/kern/kern_exit.c:128
cpuid = 0
KDB: enter: panic
[ thread pid 1 tid 11 ]
Stopped at  kdb_enter+0x3b: movl$0,kdb_why
db

The backtrace indicates the following (i omit the numbers, as
i am manually copying the text)

kdb_enter
panic
_mtx_assert
exit1
kern_execve
sys_execve
exec_shell_imgact
fork_exit
fork_trampoline
--- trap 0, eip = 0, esp = 0xc3708d60, ebp = 0 ---

any idea on what could be going wrong ?

On a related topic, does anyone have experience on cross-building
nanobsd images ?

thanks
luigi
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org