Skip to content

Commit

Permalink
Add setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffany1618 committed Dec 17, 2021
1 parent e996391 commit c36acbe
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
Rapid C&DH repository

## Getting started

Clone the repository:

```
git clone https://github.com/Bruin-Spacecraft-Group/RapidCDH.git
```

If you're starting from scratch, check out the [headless setup guide](docs/rpi-headless-setup.md) and the
[cross-compiling guide](docs/rpi-cross-compile.md) for the Raspberry Pi.
Run the setup script (you only need to do this once):

```
sudo ./setup.sh
```

Otherwise, build the project:
Build the project:

```
./build.sh
Expand All @@ -37,6 +41,11 @@ probably get an error like:
The file './build/RapidCDH' is marked as an executable but could not be run by the operating system.
```

## More guides

- [Headless setup guide](docs/rpi-headless-setup.md)
- [Cross-compiling guide](docs/rpi-cross-compile.md)

## Making a new branch
To make a new branch, run:

Expand Down
42 changes: 42 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Find CMake version
CMAKE_VERSION=""
if cmake --version > /dev/null ; then
CMAKE_VERSION=$(cmake --version | grep -o [0-9].[0-9][-0-9])
echo "Found CMake $CMAKE_VERSION"
else
echo "CMake not found; please install CMake"
exit 1
fi

# Create FindWiringPi.cmake in /usr/share/cmake-<version-number>/Modules
echo -e \
"find_library(WIRINGPI_LIBRARIES NAMES wiringPi)\n"\
"find_path(WIRINGPI_INCLUDE_DIRS NAMES wiringPi.h)\n\n"\
"include(FindPackageHandleStandardArgs)\n"\
"find_package_handle_standard_args(wiringPi DEFAULT_MSG WIRINGPI_LIBRARIES WIRINGPI_INCLUDE_DIRS)"\
> /usr/share/cmake-$CMAKE_VERSION/Modules/FindWiringPi.cmake
echo "Created FindWiringPi.cmake in /usr/share/cmake-$CMAKE_VERSION/Modules"

echo "Getting the RPi toolchain..."
wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz
echo "Done"

echo "Installing the RPi toolchain to /opt/cross-pi-gcc..."
tar xzvf raspi-toolchain.tar.gz --strip-components=1 -C /opt
echo "Done"

# Create directory for rootfs for Raspberry Pi library files
mkdir $HOME/rpi

echo "Getting the RPi library files..."
wget https://github.com/Bruin-Spacecraft-Group/RapidCDH/releases/latest/download/rpi-rootfs.tar.gz
echo "Done"

echo "Installing the RPi library files in $HOME/rpi..."
tar xzvf rpi-rootfs.tar.gz -C $HOME/rpi
ln -s $HOME/rpi/rootfs/usr/lib/ $HOME/rpi/rootfs/
echo "Done"

echo "Setup finished"

0 comments on commit c36acbe

Please sign in to comment.