@@ -11,38 +11,26 @@ be easily adaptable to other Linux distributions.
1111Quick Installation
1212*******************
1313
14- If you're in a hurry, running the following commands and rebooting
14+ .. note :: To avoid conflicts with other packages and to avoid messing up your python environment, we recommend using a virtual environment for ChipWhisperer.
15+ Don't forget to activate the virtual environment before trying to run python or jupyter!
16+
17+ If you're in a hurry and on Ubuntu, running the following commands and rebooting
1518should get you up and running:
1619
1720.. code :: bash
1821
1922 sudo apt update && sudo apt upgrade
2023
21- # python prereqs
22- sudo apt-get install build-essential gdb lcov pkg-config \
23- libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
24- libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
25- lzma lzma-dev tk-dev uuid-dev zlib1g-dev curl
26-
2724 sudo apt install libusb-dev make git avr-libc gcc-avr \
28- gcc-arm-none-eabi libusb-1.0-0-dev usbutils
29-
30- # install pyenv - skip if already done
31- curl https://pyenv.run | bash
32- echo ' export PATH="~/.pyenv/bin:$PATH"' >> ~ /.bashrc
33- echo ' export PATH="~/.pyenv/shims:$PATH"' >> ~ /.bashrc
34- echo ' eval "$(pyenv init -)"' >> ~ /.bashrc
35- echo ' eval "$(pyenv virtualenv-init -)"' >> ~ /.bashrc
36-
37- source ~ /.bashrc
38-
39- pyenv install 3.9.5
40- pyenv virtualenv 3.9.5 cw
41- pyenv activate cw
25+ gcc-arm-none-eabi libusb-1.0-0-dev usbutils python3 python3-venv
4226
4327 cd ~ /
4428 git clone https://github.com/newaetech/chipwhisperer
4529 cd chipwhisperer
30+
31+ python3 -m venv ~ /.cwvenv
32+ source ~ /.cwvenv/bin/activate
33+
4634 sudo cp 50-newae.rules /etc/udev/rules.d/50-newae.rules
4735 sudo udevadm control --reload-rules
4836 sudo groupadd -f chipwhisperer
@@ -52,9 +40,14 @@ should get you up and running:
5240
5341 python -m pip install -e .
5442 python -m pip install -r jupyter/requirements.txt
55- cd jupyter
56- python -m pip install nbstripout
57- nbstripout --install
43+
44+ After installing, you can run:
45+
46+ .. code :: bash
47+
48+ source ~ /.cwvenv/bin/activate
49+ cd ~ /chipwhisperer
50+ jupyter notebook
5851
5952 After running these install instructions, make sure to restart your computer. This is required for the
6053new udev rules to be applied.
@@ -64,6 +57,7 @@ and running:
6457
6558.. code :: bash
6659
60+ source ~ /.cwvenv/bin/activate # if you haven't run this already
6761 jupyter notebook
6862
6963 Which should open a window like the following in your browser:
@@ -86,58 +80,41 @@ Begin by updating all your packages:
8680
8781 sudo apt update && sudo apt upgrade
8882
89- From there, we'll need prerequisites for building Python from pyenv:
90-
91- .. code :: bash
92-
93- sudo apt install build-essential gdb lcov pkg-config \
94- libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
95- libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
96- lzma lzma-dev tk-dev uuid-dev zlib1g-dev curl
9783
98- Next, grab the prerequisites for building firmware for targets:
84+ Next, grab the prerequisites for building firmware for targets, as well as python :
9985
10086.. code :: bash
10187
10288 sudo apt install libusb-dev make git avr-libc gcc-avr \
103- gcc-arm-none-eabi libusb-1.0-0-dev usbutils
89+ gcc-arm-none-eabi libusb-1.0-0-dev usbutils
10490
10591======
10692Python
10793======
10894
109- The recommended way to grab Python is to use pyenv, as it allows
110- you to use multiple copies of Python without having to fiddle with
111- paths. If you've already got pyenv installed, you can skip this step,
112- though you may still want to setup your own copy of Python for ChipWhisperer.
95+ The recommended way to use Python with ChipWhisperer is to install everything in a
96+ virtual environment. Luckily, Python makes this easy!
97+
98+ The first step is to grab python and python-venv packages:
11399
114- The first step is to grab pyenv:
100+ ..
115101
116102.. code :: bash
117103
118- curl https://pyenv.run | bash
104+ sudo apt install python3 python3-venv
119105
120- Next, we need to add the following to our :code: `.bashrc ` file,
121- so that pyenv starts properly with your terminal:
106+ Next, we need to create a virtual environment:
122107
123108.. code :: bash
124109
125- echo ' export PATH="~/.pyenv/bin:$PATH"' >> ~ /.bashrc
126- echo ' export PATH="~/.pyenv/shims:$PATH"' >> ~ /.bashrc
127- echo ' eval "$(pyenv init -)"' >> ~ /.bashrc
128- echo ' eval "$(pyenv virtualenv-init -)"' >> ~ /.bashrc
129-
130- # apply these changes to current terminal
131- source ~ /.bashrc
110+ python3 -m venv ~ /.cwvenv # place this anywhere you like, but don't forget to update path in the next step
132111
133112 With that done, install a version of Python. Anything >= 3.9 should work,
134113so we'll grab 3.9.5 here and make an env called cw:
135114
136115.. code :: bash
137116
138- pyenv install 3.9.5
139- pyenv virtualenv 3.9.5 cw
140- pyenv activate cw
117+ source ~ /.cwvenv/bin/activate # or wherever you installed your venv
141118
142119 .. _linux-install-chipwhisperer :
143120
@@ -173,8 +150,6 @@ you'll need to create that group and add your user to that group:
173150 sudo usermod -aG chipwhisperer $USER
174151 sudo usermod -aG plugdev $USER
175152
176- Make sure you restart your computer after this step.
177-
178153 .. note :: Older install instructions used the plugdev group, which is created by default on some distros
179154 and not on others. These install instructions instead use a dedicated chipwhisperer group,
180155 so if you've installed chipwhisperer before and want to update to a new rules file, make sure
@@ -195,11 +170,14 @@ You may also want to grab `nbstripout`_, which will make git and jupyter interac
195170 pip install nbstripout
196171 nbstripout --install # must be run from the jupyter folder
197172
173+ You'll need to reboot now to get access to the ChipWhisperer USB devices.
174+
198175You can check that the install succeeded by navigating to :code: `chipwhisperer `
199176and running:
200177
201178.. code :: bash
202179
180+ source ~ /.cwvenv/bin/activate
203181 jupyter notebook
204182
205183 Which should open a window like the following in your browser:
0 commit comments