Prerequisites
- cmake 3.16 or later (https://vitux.com/how-to-install-cmake-on-ubuntu/)
- Configures a directory for locally installed packages and ensures the executables are easily accessible from the command line
~$ export LOCAL_INSTALL_DIR=$HOME/.local ~$ mkdir -p $LOCAL_INSTALL_DIR ~$ export PATH="$LOCAL_INSTALL_DIR/bin:$PATH"
- Install the basic tools required to build gRPC
~$ sudo apt install -y build-essential autoconf libtool pkg-config
- Clone the grpc repo and its submodules
~$ git clone --recurse-submodules -b v1.66.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc
- Build and locally install gRPC and Protocol Buffers
~$ cd grpc ~/grpc$ mkdir -p cmake/build ~/grpc$ pushd cmake/build ~grpc/cmake/build$ cmake -DgRPC_INSTALL=ON \ -DgRPC_BUILD_TESTS=OFF \ -DCMAKE_INSTALL_PREFIX=$LOCAL_INSTALL_DIR \ ../.. ~grpc/cmake/build$ make -j 4 ~grpc/cmake/build$ make install ~grpc/cmake/build$ popd
- Build the project
in~/grpc/examples/protos/
save .proto file
in~/grpc/examples/cpp/
create new directorymyproject
containing source .cc code and CMakeLists.txt
~/grpc$ cd examples/cpp/myproject ~/grpc/examples/cpp/myproject$ mkdir -p cmake/build ~/grpc/examples/cpp/myproject$ pushd cmake/build ~/grpc/examples/cpp/myproject/cmake/build$ cmake -DCMAKE_PREFIX_PATH=$LOCAL_INSTALL_DIR ../.. ~/grpc/examples/cpp/myproject/cmake/build$ make -j 4
- Run the project from the project
build
directory
~/grpc/examples/cpp/myproject/cmake/build$ ./app
Prerequisites
- Python 3.7 or higher
- pip version 9.0.1 or higher
- Install gRPC
~$ python3 -m pip install grpcio
- Install gRPC tools
~$ python3 -m pip install grpcio-tools
- Build the project
create new directorymyproject
containing .proto file and source .py code - Run the project
from project directorymyproject
in terminal runpython3 app.py
A daemon (or service) is a background process that is designed to run autonomously,with little or not user intervention. Services will start automatically every time the system starts, which eliminates the need to start it manually. Scripts that collect data, represent servers or similar are ideal candidates to be configured as services and not ordinary scripts.
- Write Python script you want to make as service
/path/to/your_script.py
- Make your Python script executable
~$ chmod +x /path/to/your_script.py
- Create systemd service file in directory
/etc/systemd/system/
. Systemd service files need to be in/etc/systemd/system/
DIR!~$ sudo nano /etc/systemd/system/your_script.service
- Add following content to your .service file
[Unit] Description=Python Script Service After=network.target [Service] ExecStart=/usr/bin/python3 /path/to/your_script.py Restart=always User=your_user WorkingDirectory=/path/to/ Environment="PATH=/usr/bin" [Install] WantedBy=multi-user.target
- Reload systemd to recognise new service
your_script.service
sudo systemctl daemon-reload
- Enable new service at system startup
sudo systemctl enable your_script.service
- Run service
sudo systemctl start your_script.service
- Managing the service
- stop service
sudo systemctl stop your_script.service
- restart service
sudo systemctl stop your_script.service
- disable service at system startup
sudo systemctl disable your_script.service
- stop service
Complete quidance on : https://www.raspberrypi.com/documentation/computers/linux_kernel.html#install-directly-onto-the-sd-card.
This guide assumes that your Raspberry Pi runs the latest version of Raspberry Pi OS.
sudo apt install git
git clone --depth=1 https://github.com/raspberrypi/linux
- Install the build dependencies
sudo apt install bc bison flex libssl-dev make
- Build configuration
In this case, Im using RPi3B and for 32bit distribution run following commandscd linux KERNEL=kernel7 make bcm2709_defconfig
- Build the 32-bit kernel (this step will take A LONG TIME -couple of hours)
make -j6 zImage modules dtbs
- Install the kernel modules onto the boot media
sudo make -j6 modules_install
- Create a backup of your current kernel and install the fresh kernel image
sudo cp /boot/firmware/$KERNEL.img /boot/firmware/$KERNEL-backup.img sudo cp arch/arm/boot/zImage /boot/firmware/$KERNEL.img
- For kernels version 6.5 and above
sudo cp arch/arm/boot/dts/broadcom/*.dtb /boot/firmware/
- Copy over the overlays and README
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/firmware/overlays/ sudo cp arch/arm/boot/dts/overlays/README /boot/firmware/overlays/
- Finally, run the following command to reboot your Raspberry Pi and run your freshly-compiled kernel
sudo reboot