Bug 612 - dev-env-setup script needed to build trellis and nextpnr-ecp5
Summary: dev-env-setup script needed to build trellis and nextpnr-ecp5
Status: RESOLVED FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Documentation (show other bugs)
Version: unspecified
Hardware: Other Linux
: --- enhancement
Assignee: Veera
URL:
Depends on:
Blocks:
 
Reported: 2021-03-08 04:04 GMT by Luke Kenneth Casson Leighton
Modified: 2021-04-24 16:49 BST (History)
1 user (show)

See Also:
NLnet milestone: NLNet.2019.10.043.Wishbone
total budget (EUR) for completion of task and all subtasks: 150
budget (EUR) for this task, excluding subtasks' budget: 150
parent task for budget allocation: 384
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:
"vklr"={amount=150,paid=2021-03-27}


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kenneth Casson Leighton 2021-03-08 04:04:19 GMT
an automated script in dev-env-setup git repo is needed which gets nextpnr-ecp5 and all build dependencies (includes trellis)

to work under debian 10

recommended to test it under a debootstrap of debian 10 to ensure all dependencies (apt get install) are correctly recorded.

this involves python boost which is known to be an absolute nuisance.

also updating HDL_workflow to include it, on a sub-page.
Comment 1 Veera 2021-03-08 08:16:02 GMT
Acknowledged. I will learn debootstrap and do. Any quick timeline within which to be done.
Comment 2 Luke Kenneth Casson Leighton 2021-03-08 11:25:15 GMT
it's not time-critical.  also really should not take that long although
that depends on capability of machine you have.

start from this:

https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=hdl-tools-yosys;hb=HEAD

line 12-13 could be "mkdir fpga_tools"

i have added you to dev-env-setup.git

debootstrap is pretty damn easy.  2 lines.
https://wiki.debian.org/Debootstrap

main # mkdir /stable-chroot
main # debootstrap stable /stable-chroot http://deb.debian.org/debian/

completing the install with the mount of proc and sysfs is important

also you may find schroot helpful
https://wiki.debian.org/Schroot

you can see how to set up an automated schroot or at least see what
commands to run
https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=coriolis2-chroot;hb=HEAD

... actually i'm going to try creating a chroot-creating script, based
on that.  please do check it.
Comment 3 Veera 2021-03-09 22:30:25 GMT
Setting up new Bootstrap and chroot into it

export MY_CHROOT=/stable-chroot
mkdir $MY_CHROOT

debootstrap stable $MY_CHROOT http://deb.debian.org/debian/

mount -t proc proc $MY_CHROOT/proc
mount -t sysfs sysfs $MY_CHROOT/sys
mount -t devpts devpts $MY_CHROOT/dev/pts/

chroot $MY_CHROOT /bin/bash

Steps to compile Project Trellis

Necessary software to install

apt-get install git

apt-get install python3 python3-dev clang cmake libboost-dev libboost-filesystem-dev libboost-thread-dev libboost-program-options-dev libboost-iostreams-dev openocd


git clone --recursive https://github.com/YosysHQ/prjtrellis

Build Project Trellis

cd prjtrellis
cd libtrellis

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libtrellis .
make
make install

Next I will find out procedure for nextpnr(-ecp5)
Comment 4 Veera 2021-03-09 23:47:41 GMT
Steps to compile Project Nextpnr with ECP5

Necessary software to install

apt-get install libeigen3-dev

git clone --recursive https://github.com/YosysHQ/nextpnr

Build Project nextpnr-ecp5

cd nextpnr

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-ecp5 -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/usr/local/libtrellis .
make
make install

Please adjust the install paths for nextpnr and previous prjtrellis.

Can you suggest a suitable filename for subpage in HDL_workflow.

To be more clear do I have to put schroot steps in it.
Comment 5 Luke Kenneth Casson Leighton 2021-03-10 00:53:15 GMT
(In reply to vklr@vkten.in from comment #4)
> Steps to compile Project Nextpnr with ECP5
> 
> Necessary software to install

excellent.

> 
> Can you suggest a suitable filename for subpage in HDL_workflow.

hmmm... i would say ECP5 but that is taken.

HDL_workflow/nextpnr sound good?


> To be more clear do I have to put schroot steps in it.

no, i simply created the schroot script to make it easier and quicker for you to double-check
Comment 6 Veera 2021-03-10 09:32:16 GMT
Added nextpnr page: https://libre-soc.org/HDL_workflow/nextpnr/

Added nextpnr section to page: https://libre-soc.org/HDL_workflow/

Review and give suggestions.
Comment 7 Luke Kenneth Casson Leighton 2021-03-10 18:22:45 GMT
(In reply to vklr@vkten.in from comment #6)
> Added nextpnr page: https://libre-soc.org/HDL_workflow/nextpnr/
> 
> Added nextpnr section to page: https://libre-soc.org/HDL_workflow/
> 
> Review and give suggestions.

great, i made some minor formatting changes, to use markdown "indentation"
(four spaces) https://libre-soc.org/HDL_workflow/nextpnr/?updated

great, next step:

* git clone gitolite3@git.libre-soc.org:dev-env-setup.git
* run (create) a completely new chroot
* make a "nextpnr-ecp5-install" script
* add all those commands (from the new nextpnr page) to that script
* test it and make sure that you have not missed any dependencies
* git add, commit and push the (tested) nextpnr-ecp5-install script

btw for goodness sake DO NOT blow away the "old" chroot WITHOUT FIRST
UNMOUNTING THE mount-points.

if you do "rm -fr /opt/chroot/whatever" it will try to blow away /tmp, /proc and
other locations so mounted.
Comment 8 Veera 2021-03-12 06:10:04 GMT
Added nextpnr-ecp5-install script to dev-env-setup.git

url: https://git.libre-soc.org/?p=dev-env-setup.git;a=blob_plain;f=nextpnr-ecp5-
install;hb=HEAD

Adjust the installation path of libtrellis and nextpnr if need. e.g. to install them to /usr/local instead.

Also the proc, sysfs and devpts are mounted and unmounted within the script. If not needed comment them out.

Review and give suggestions.
Comment 9 Luke Kenneth Casson Leighton 2021-03-12 10:31:26 GMT
ok looks good, i removed the mount/unmount because this will end up being
run outside of chroot.  also keeping it to under 80 chars.

can you copy the style of hdl-tools-yosys, use "make -j$(nproc)
and do the same preamble as in hdl-dev-repos.

hmmm all these scripts need to be cd /home/$SUDO_USER/src
Comment 10 Luke Kenneth Casson Leighton 2021-03-12 10:38:28 GMT
all of the build scripts are a bit of a mess i've cleaned them up
to build in a consistent location, /home/$SUDO_USER/src
please do git pull
Comment 11 Veera 2021-03-12 11:58:03 GMT
Added make parallelization.

chown and chgrp the downloaded repo's.

Review.
Comment 12 Luke Kenneth Casson Leighton 2021-03-12 16:53:57 GMT
that looks great.  closing as resolved, can you link this on your page... ah!
you already have! :)
https://libre-soc.org/veera/