<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><div>Hello all,</div><div><br></div><div>at NSLS-II, we have several dozen MVME3100 VME crates running RTEMS with EPICS driver for various diagnostics and MRF timing hardware. The entire setup was handily created quite some time ago by combining RTEMS 4.9 with Cexp and GeSys to provide convenient booting and debugging capabilities. As an effort to make the setup more up-to-date, I made an attempt to compose a how-to which would describe how to successfully compile a bootable RTEMS+Cexp+GeSys image. A nice "bonus" would be if that image also worked when being run on a crate.</div><div><br></div><div>It is not my first attempt as I already tried to do a similar thing for RTEMS 4.10. While in both cases I found lots of work being put by the community in helpful toolsets and documentation, the building process was not as straightforward as one would imagine by reading the QuickStart guide. There are many stumbles which, while probably being primitive in most cases, could be annoying to a user who lacks core developer knowledge and perspective. Some things can be mentioned _somewhere_ and can only be found quickly by google-fu and/or luck.</div><div><br></div><div>This time I reached for RTEMS 5 right away. Results which I achieved are very similar to those which I had for RTEMS 4.10 - I can create a bootable image which appears to have working GeSys and Cexp shell, but access to "st.sys" fails along with other suspicious symptoms.</div><div><br></div><div>Below is my "how-to" process which yields a bootable "rtems.ralf" file, and results for our test MVME3100 system boot procedure. Some points highlighted will probably be useful for further users' reference, and some of them come from earlier conversations on the mailing list. My hope is that someone knowledgeable will kindly review my steps and give some hint why the image fails to work as expected. Perhaps it would be great to have a step-by-step how-to as a part of documentation somewhere.</div><div><br></div><div>====================</div><div>RTEMS 5 + Cexp + GeSys How-To</div><div><br></div><div>1. Get RTEMS source builder (rsb). As a part of its configuration, rsb will try to fetch various sources from multiple locations. If rsb is being configured in a protected environment (e.g. http proxy, firewalls, etc.), source locations can be unavailable. Get rsb sources on a machine which can freely download from <a href="http://git.rtems.org" target="_blank">git.rtems.org</a>, <a href="http://github.com" target="_blank">github.com</a> etc. with both http(s) and git protocol:</div><div><br></div><div>$ mkdir --parents ~/src/RTEMS</div><div>$ cd ~/src/RTEMS</div><div>$ git clone <a href="http://github.com/RTEMS/rtems-source-builder.git" target="_blank">http://github.com/RTEMS/rtems-<wbr>source-builder.git</a> rsb</div><div>$ cd rsb/rtems</div><div><br></div><div>Perform dry configuration and only download sources, as suggested here:</div><div><br></div><div><a href="https://lists.rtems.org/pipermail/users/2017-September/031647.html" target="_blank">https://lists.rtems.org/<wbr>pipermail/users/2017-<wbr>September/031647.html</a></div><div><br></div><div>Choose profile as appropriate (rtems-powerpc for MVME3100):</div><div><br></div><div>$ ../source-builder/sb-set-<wbr>builder --dry-run --with-download --without-error-report --without-release-url 5/rtems-powerpc</div><div><br></div><div>2. If firewalls and proxies are not a problem for you, skip this step. Even though sources were pre-downloaded, rsb will try to fetch the rtems-tools repository during the build process (even if --no-download is specified). We need to make sure the repository is accessible or the lengthy build process (~ hour on two cores) will fail. In our environment, git protocol didn't work through http(s) proxy, so git config was modified:</div><div><br></div><div>$ cd ~/src/RTEMS/rsb/rtems</div><div>$ nano sources/git/rtems-tools.git/.<wbr>git/config</div><div><br></div><div>Replace:</div><div>url = git://<a href="http://git.rtems.org/rtems-tools.git" target="_blank">git.rtems.org/rtems-<wbr>tools.git</a></div><div>with:</div><div>url = <a href="https://github.com/RTEMS/rtems-tools.git" target="_blank">https://github.com/RTEMS/<wbr>rtems-tools.git</a></div><div><br></div><div>3. rsb now has sources and patches downloaded. If you will build RTEMS on a different host, move the entire folder to the build machine.</div><div><br></div><div>My build setup:</div><div><br></div><div>$ uname -a</div><div>Linux sandbox8 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 GNU/Linux</div><div>$ cat /etc/debian_version </div><div>8.9</div><div><br></div><div>All further steps are performed on the build machine.</div><div><br></div><div>4. Run sb-check and install necessary packages if the check tool complains:</div><div><br></div><div>$ cd ~/src/RTEMS/rsb</div><div>$ ./source-builder/sb-check</div><div><br></div><div>Alas, sb-check doesn't check for everything. For example, the build process can fail with something like:</div><div><br></div><div>checking for python... /usr/bin/python</div><div>checking for python2.7... no</div><div><br></div><div>This is resolved by being lucky in finding a similar issue discussed on the mailing list. Additional packages may be needed, in the mentioned case it was:</div><div><br></div><div>$ sudo apt-get install python2.7-dev</div><div><br></div><div>5. Build rsb (takes a while, was an hour on my dual-core VM). Since sources were pre-downloaded, specify "--no-download" (however rtems-tools will still be fetched!):</div><div><br></div><div>$ ../source-builder/sb-set-<wbr>builder --no-download --prefix=$HOME/src/RTEMS/5 5/rtems-powerpc</div><div><br></div><div>6. Build rtems. First make sure rsb tools are in path:</div><div><br></div><div>$ export PATH=$HOME/src/RTEMS/5/bin:$<wbr>PATH</div><div><br></div><div>Get RTEMS source:</div><div><br></div><div>$ cd ~/src/RTEMS</div><div>$ mkdir kernel</div><div>$ cd kernel</div><div>$ git clone <a href="https://github.com/RTEMS/rtems.git" target="_blank">https://github.com/RTEMS/<wbr>rtems.git</a></div><div><br></div><div>Run bootstrap scripts to generate files which are missing in cloned repository:</div><div><br></div><div>$ cd rtems</div><div>$ ./bootstrap -c</div><div>$ ./bootstrap -p</div><div>$ ../../rsb/source-builder/sb-<wbr>bootstrap</div><div>$ cd ..</div><div><br></div><div>Configure and build RTEMS for the target:</div><div><br></div><div>$ mkdir build-mvme3100</div><div>$ cd build-mvme3100</div><div>$ ../rtems/configure --enable-networking --enable-cxx --enable-rdbg --enable-posix --prefix=$HOME/src/RTEMS/5 --target=powerpc-rtems5 --enable-rtemsbsp=mvme3100</div><div>$ make -j 8</div><div>$ make install</div><div><br></div><div>7. Build Cexp. Two things which are not straightforward is getting all submodules and running "make prep".</div><div><br></div><div>$ cd ~/src/RTEMS</div><div>$ mkdir cexp</div><div>$ cd cexp</div><div>$ git clone <a href="https://github.com/till-s/cexpsh.git" target="_blank">https://github.com/till-s/<wbr>cexpsh.git</a></div><div>$ cd cexpsh</div><div>$ git submodule update --init --recursive</div><div><br></div><div>As with RTEMS bootstrap, we need to generate some missing files. Stunningly, I didn't find it mentioned in cexpsh/INSTALL:</div><div><br></div><div>$ make prep</div><div><br></div><div>Now the code is ready to be configured and built. Use "--enable-std-rtems-<wbr>installdirs" to perform installation on top of the previously built RTEMS tree:</div><div><br></div><div>$ cd ..</div><div>$ mkdir build-mvme3100</div><div>$ cd build-mvme3100</div><div>$ ../cexpsh/configure --enable-std-rtems-installdirs --with-rtems-top=$HOME/src/<wbr>RTEMS/5 --host=powerpc-rtems5 --enable-rtemsbsp=mvme3100</div><div>$ make -j 8</div><div>$ make install</div><div><br></div><div>8. Build GeSys. Another trickery here - before configuring, it is necessary to build the ldep tool as mentioned in documentation.</div><div><br></div><div>Get all GeSys sources and submodules:</div><div><br></div><div>$ cd ~/src/RTEMS</div><div>$ mkdir gesys</div><div>$ cd gesys</div><div>$ git clone <a href="https://github.com/till-s/rtems-gesys.git" target="_blank">https://github.com/till-s/<wbr>rtems-gesys.git</a></div><div>$ cd rtems-gesys</div><div>$ git submodule update --init --recursive</div><div><br></div><div>As for other parts, generate missing files by running the bootstrap tool:</div><div><br></div><div>$ ./bootstrap</div><div><br></div><div>Another bootstrap is necessary for ldep:</div><div><br></div><div>$ cd ldep</div><div>$ ./bootstrap</div><div>$ mkdir build</div><div>$ cd build</div><div><br></div><div>Configure and install ldep to where all rsb stuff is:</div><div><br></div><div>$ ../configure --prefix=$HOME/src/RTEMS/5</div><div>$ make</div><div>$ make install</div><div><br></div><div>Configure and install GeSys in the same tree where RTEMS and Cexp are by using "--enable-std-rtems-<wbr>installdirs". Note that $HOME/src/RTEMS/5/bin must be in PATH:</div><div><br></div><div>$ cd ~/src/RTEMS/gesys</div><div>$ mkdir build-mvme3100</div><div>$ cd build-mvme3100</div><div>$ ../rtems-gesys/configure --enable-std-rtems-installdirs --with-rtems-top=$HOME/src/<wbr>RTEMS/5 --host=powerpc-rtems5 --enable-rtemsbsp=mvme3100</div><div>$ make -j 8</div><div>$ make install</div><div><br></div><div>9. Behold the build binaries:</div><div><br></div><div>$ cd ~/src/RTEMS/5/powerpc-rtems5/<wbr>bin</div><div>$ ls</div><div>ar ld nm objdump readelf rtems.ralf st.sys</div><div>as ld.bfd objcopy ranlib rtems.exe strip</div><div><br></div><div>rtems.ralf is the thing. It worth mentioning that none of .obj files loaded in the "st.sys" are present (telnetd.obj, monitor.obj etc.)</div><div><br></div><div>====================</div><div>Boot the image</div><div><br></div><div>I put the resulting image in our VME timing test setup which successfully boots and runs RTEMS 4.9. Boot procedure is DHCP with MOTLoad netBoot. "rtems.ralf" was renamed to "rtems.boot" for booting purposes. Boot sequence:</div><div><br></div><div>********************</div><div>Copyright(C)2008-2013,Emerson Network Power-Embedded Computing,Inc.</div><div>All Rights Reserved</div><div>Copyright Motorola Inc. 1999-2007, All Rights Reserved</div><div>MOTLoad RTOS Version 2.0, PAL Version 1.2 RM04</div><div>Wed Nov 6 17:17:43 MST 2013</div><div><br></div><div>MPU-Type =MPC8540</div><div>MPU-Int Clock Speed =666MHz</div><div>MPU-CCB Clock Speed =333MHz</div><div>MPU-DDR Clock Speed =166MHz</div><div>MPU-PCI Clock Speed =66MHz, PCI, 64-bit</div><div>MPU-Int Cache(L2) Enabled, 256KB, L2CTL =A8000300</div><div><br></div><div>Reset/Boot Vector =Flash0</div><div><br></div><div>Local Memory Found =10000000 (&268435456)</div><div>User Download Buffer =0159D000:0179CFFF</div><div><br></div><div>MVME3100> bootmem=malloc 0x500000 </div><div>return = 0193D000 (&26464256)</div><div>errno = 00000000</div><div>MVME3100> netBoot -d/dev/enet0 -v -abootmem -p -h -u</div><div>Network Loading from: /dev/enet0</div><div><br></div><div>Locating BOOTP Server... Found It!</div><div><br></div><div>Client IP Address = 10.0.1.104</div><div>Server IP Address = 10.0.1.1</div><div>Gateway IP Address = 0.0.0.0</div><div>Subnet IP Address Mask = 255.255.255.0</div><div>Boot File Name = rtems-5/rtems.boot</div><div>Load Address = 0193D000</div><div>Buffer Size = ffffffff </div><div><br></div><div>Network Boot File Load Start - Press <ESC> to Bypass, <SPC> to Continue</div><div><br></div><div>Network Boot File Load in Progress - Press <CTRL-C> to Abort[]>>>></div><div>...</div><div>Bytes Received =&4886264, Bytes Loaded =&4886264</div><div>Bytes/Second =&488626, Elapsed Time =10 Second(s)</div><div><br></div><div>Execution Halted on Request</div><div>MV----------------------------<wbr>-------------</div><div>Welcome to rtems-5.0.0 (PowerPC/Generic (no FPU)/mvme3100)</div><div>BSP: mvme3100, CVS Release ($Name$)</div><div>CPU 0x8020 - rev 0x20</div><div>Additionnal boot options are H</div><div>Initial system stack at 14c9980</div><div>Software IRQ stack starts at 14c9a90 with size 16384</div><div>Going to start PCI buses scanning and initialization</div><div>Board Type: MVME3100-1152 (S/N E10EA0D)</div><div>External (=PCI Bus) Clock Freq : 66666666 Hz</div><div>Core Complex Bus (CCB) Clock Freq: 333333330 Hz</div><div>CPU Clock Freq: 133333332 Hz</div><div>Ethernet 0 EC:9E:CD:0E:16:5B</div><div>Ethernet 1 EC:9E:CD:0E:16:5C</div><div>Ethernet 2 EC:9E:CD:0E:16:5D</div><div>Number of PCI buses found is : 2</div><div>BUS:SLOT:FUN VENDOR-DEV_ID: COMMAND STATUS BASE_ADDR0 BASE_ADDR1 IRQ_PIN -> IRQ_LINE</div><div> 0:0x00:0 0x1057-0x0008: 0x0006 0x20b0 0x80000000 0x00000000 0 -> 0 (=0x00)</div><div> 0:0x11:0 0x10e3-0x0148: 0x0146 0x02b0 0x80100004 0x00000000 1 -> 0 (=0x00)</div><div> 0:0x12:0 0x10b5-0x6520: 0x0147 0x02b0 0x00000000 0x00000000 0 -> 0 (=0x00)</div><div> 0:0x14:0 0x1095-0x3124: 0x01c7 0x02b0 0x80300004 0x00000000 1 -> 2 (=0x02)</div><div> 1:0x00:0 0x10b5-0x9030: 0x0142 0x0290 0x80200000 0x00000000 1 -> 4 (=0x04)</div><div>Memory: 268435456 bytes</div><div>Cleared PCI errors: pci_stat was 0x20b0</div><div>OpenPIC Version 1.2 (1 CPUs and 56 IRQ sources) at 0x3775135744</div><div>OpenPIC Vendor 0 (Unknown), Device 0 (Unknown), Stepping 0</div><div>OpenPIC timer frequency is 41666666 Hz</div><div>MSR is 0x00001000, TCR 0x04000000</div><div>------------------------------<wbr>-----------</div><div>Exit from bspstart</div><div>libi2c: Library not initialized</div><div>Registering mpc8540 i2c bus driver :No such file or directory</div><div>Tundra Tsi148 PCI-VME bridge detected at 0x80100000, IRQ 0</div><div>Tsi148 Outbound Ports:</div><div>Port VME-Addr Size PCI-Adrs Mode:</div><div>0: 0x20000000 0x0e000000 0xc0000000 A32, SUP, D32, SCT</div><div>1: 0x00000000 0x00ff0000 0xcf000000 A24, SUP, D32, SCT</div><div>2: 0x00000000 0x00010000 0xcfff0000 A16, SUP, D32, SCT</div><div>7: 0x00000000 0x01000000 0xce000000 CSR, SUP, D32, SCT</div><div>Tsi148 Inbound Ports:</div><div>Port VME-Addr Size PCI-Adrs Mode:</div><div>0: 0xc0000000 0x10000000 0x00000000 A32, PGM, DAT, SUP, USR, MBLT, BLT</div><div>vmeTsi148 IRQ manager: looking for registers on VME...</div><div>Trying to find CSR on VME...</div><div>vmeTsi148 - IRQ manager using VME CSR to flush FIFO</div><div>Registering /dev/console as minor 0 (==/dev/ttyS0)</div><div>Welcome to RTEMS 5.0.0 GeSys</div><div>This system was built on 20171213EST19:00:39</div><div>Installing TIOCGWINSZ line discipline: ok.</div><div>To skip initialization, press a key now...</div><div>bootpc_init: using network interface 'tse1'</div><div>bootpc hw address is ec:9e:cd:e:16:5b</div><div>My ip address is 10 .0 .1 .104 </div><div>Time Server is 10 .0 .1 .1 </div><div>Domain name is cs.nsls2.local</div><div>Boot file is rtems-5/rtems.boot</div><div>Command line is IOCNAME=timing</div><div>Subnet mask is 255 .255 .255 .0 </div><div>Server ip address is 10 .0 .1 .1 </div><div>Gateway ip address is 0 .0 .0 .0 </div><div>Log server ip address is 10 .0 .1 .1 </div><div>bootpc_adjust_interface: add net route, error=114</div><div>Trying to synchronize NTP...OK</div><div>Trying symfile 'BUILTIN', system script 'st.sys'</div><div>'st.sys':</div><div>opening script file: No such file or directory</div><div>Type 'cexpsh.help()' for help (no quotes)</div><div>********************</div><div><br></div><div>There are several suspicious points: PCI buses scanning not reporting anything, i2c library/driver errors, bootpc_adjust_interface error, and of course "st.sys" script not being found. Peculiar enough, I can perform NFS mount and run a script from there. It doesn't work smoothly however and nfsMountsShow output is odd:</div><div><br></div><div>Cexp>nfsInit(0,0)</div><div>RTEMS-NFS, Till Straumann, Stanford/SLAC/SSRL 2002, See LICENSE file for licensing info.</div><div>0x00000000 (0)</div><div>Cexp>nfsMount("10.0.1.1","/<wbr>srv/tftp/rtems-5","/common")</div><div>Trying to mount 10.0.1.1:/srv/tftp/rtems-5 on /common</div><div>RTEMS-RPCIOD, Till Straumann, Stanford/SLAC/SSRL 2002, See LICENSE file for licensing info.</div><div>0x00000000 (0)</div><div>Cexp>nfsMountsShow(0)</div><div>Currently Mounted NFS:</div><div>10.0.1.1:/srv/tftp/rtems-5 on /</div><div>0x00000000 (0)</div><div><br></div><div>====================</div><div>Conclusion</div><div><br></div><div>To conclude that, I'd be happy to hear any suggestions and insights to the procedure described. It might be something as obvious as missing an option somewhere. It would be also great if anyone who has a working RTEMS+Cexp+GeSys setup would share instructions on how to make it work properly.</div><div><br></div><div>Best regards,</div><div>Anton A. Derbenev</div><div>NSLS-II</div><div>Brookhaven National Laboratory</div></div></div>
</div><br></div>