1 _ _ _ 2 (_) | |_ _ _ __ ___ ___ ___ ___ _ __ __ _ _ __ _ __ ___ 3 | | | | | | | '_ ` _ \ / _ \/ __| / _ \| '_ \ / _` | '__| '_ ` _ \ 4 | | | | |_| | | | | | | (_) \__ \ | (_) | | | | | (_| | | | | | | | | 5 |_|_|_|\__,_|_| |_| |_|\___/|___/ \___/|_| |_| \__,_|_| |_| |_| |_| 6 7 8 Welcome brave fool. Don't Panic! The writer of this README is an even bigger 9 fool than you could be (even if old Ben wonders if those who follow fools are 10 more foolish). 11 12 So here's where you get started building illumos on ARM. 13 14 Step 1) You need to get a build environment set up. There's the easy way and the 15 fun way. 16 17 Easy way: 18 19 cd $HOME 20 curl -O https://fingolfin.org/illumos/arm/armtc.tar.gz 21 pfexec tar xvzf armtc.tar.gz -C / 22 find /opt/armtc 23 24 Fun way: 25 26 Clone this repository again and do a normal i386 on i386 build. 27 mkdir -p /opt/armtc/lib/amd64 /opt/armtc/usr/bin/amd64 28 cd /opt/armtc/lib/ 29 ln -s amd64 64 30 cd ../usr/bin 31 ln -s amd64 64 32 33 Then from your proto area, install the following: 34 o /usr/bin/ld 35 o /usr/bin/amd64/ld 36 o /lib/libld.so.4 37 o /lib/amd64/libld.so.4 38 o /lib/liblddbg.so.4 39 o /lib/amd64/liblddb.so.4 40 o /lib/libelf.so.1 41 o /lib/amd64/libelf.so.1 42 43 Now that's all set go grab illumos-arm-extra (git clone 44 gitosis@zelgadis.fingolfin.org:illumos-arm-extra.git) and build that. You'll 45 need something like: 46 47 gmake ARCH=arm STRAP=strap LD_ALTEXEC=/opt/armtc/usr/bin/ld install 48 49 Once that's done, you'll need to fix up the rpath there. so from the root of 50 that workspace run: 51 52 ./tools/setrpath proto-arm/usr/ /opt/armtc/usr/lib:/opt/gcc/4.4.4/lib:/lib:/usr/lib 53 54 Finally, you can copy all of that into your arm compiler toolchain directory 55 (use pfexec / sudo as appropriate): 56 57 cp -r proto-arm/usr /opt/armtc/ 58 59 Step 2) Set up illumos.sh 60 61 In a fresh workspace, you're going to want to set up your illumos.sh with the 62 following: 63 64 # Enable GCC 4 default 65 export __GNUC=""; 66 export CW_NO_SHADOW=1 67 export MACH=arm; 68 export NATIVE_MACH=i386; 69 export BUILD64="#" 70 71 # Re-set all this MACH-based crud 72 REF_PROTO_LIST=$PARENT_WS/usr/src/proto_list_${MACH}; export REF_PROTO_LIST 73 ROOT="$CODEMGR_WS/proto/root_${MACH}"; export ROOT 74 PARENT_ROOT=$PARENT_WS/proto/root_$MACH; export PARENT_ROOT 75 PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"; export PKGARCHIVE 76 unset GCC_ROOT GNU_ROOT CW_GCC_DIR 77 export i386_GCC_ROOT=/opt/gcc/4.4.4 78 export arm_GCC_ROOT=/opt/armtc/usr 79 export i386_GNU_ROOT=/usr/sfw 80 export arm_GNU_ROOT=/opt/armtc/usr/gnu 81 82 # 83 # XXX our gcc isn't called ./usr/bin/gcc fix it up via CW env vars for now. 84 # 85 export CW_arm_GCC=/opt/armtc/usr/bin/arm-pc-solaris2.11-gcc-4.6.3 86 87 # 88 # XXX We need to set CPP to our specific cpp, not the generic /usr/ccs/lib/cpp 89 # as that's rather, well, x86. 90 # 91 export CPP=/opt/armtc/usr/lib/cpp 92 export AW_CPP=/opt/armtc/usr/lib/cpp 93 export LD_ALTEXEC=/opt/armtc/usr/bin/ld 94 95 Step 3) Start your build engines 96 97 Once you've done that, you're doing to need to need to use the *new* bldenv to 98 get started building. For the first time you can go ahead and do something like: 99 100 cd usr/src 101 ksh93 ./tools/scripts/bldenv.sh ../../illumos.sh 102 103 This is really just a bit of a bootstrapping weirdness. Once that's done you can 104 go ahead and continue on. 105 106 As a part of this you should see an important two lines: 107 108 Cross-building enabled 109 Targeting arm on i386 110 111 If you don't, stop. illumos.sh is not configured correctly. 112 113 114 Once you have that you can get going. Start off with a resounding: 115 116 dmake setup 117 118 Following this, you can build the kernel as far as we have it for ARM 119 120 cd uts; dmake install 121 122 You now have a lovely unix and boot_archive pair in bcm2835/unix (raspberry 123 pi) and qvpb/unix (qemu versatilepb). These should be booted with a kernel 124 command line mimicing that of the boot_archive (regardless of the path of the 125 unix you actually provide). For example: kernel /platform/bcm2835/kernel/unix 126 -Bconsole=text 127