Skip to content

Commit

Permalink
RTKBASE last-realease. Delete cloud-init, add a service firstboot & m…
Browse files Browse the repository at this point in the history
…ake stage_rtkbase. raspbian bookworm release
  • Loading branch information
jancelin committed Jun 21, 2024
1 parent 86f8c83 commit 1883822
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 0 deletions.
79 changes: 79 additions & 0 deletions RUN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Build a RTKbase image for Raspberry Pi

## Installing qemu-user-static

```sudo apt-get install qemu-user-static```

## clone and choose branch

### Last release

```
git clone https://github.com/CentipedeRTK/pi-gen_RTKbase.git
git checkout last-release
```

### Dev Branch

```
git clone https://github.com/CentipedeRTK/pi-gen_RTKbase.git
git checkout dev
```

## make executable .sh

```
cd pi-gen_RTKbase
sudo find ./ -type f -iname "*.sh" -exec chmod +x {} \;
```

## make a raspbery pi RTKbase img

```
docker rm -v pigen_work
sudo PRESERVE_CONTAINER=1 CONTINUE=1 ./build-docker.sh
```

## debug & delete stage before rebuild

```
docker run -it --privileged --volumes-from=pigen_work pi-gen /bin/bash
rm -r /pi-gen/work/RTKBaseGNSS/stage_rtkbase
```


## Lancer la fabrication en tâche de fond sur un serveur:

* sudo apt-get install screen
* lancer ```screen```
* lancer le build ```sudo PRESERVE_CONTAINER=1 CONTINUE=1 ./build-docker.sh```
* Pendant la fabrication appuyez simplement sur ```Ctrl + a``` immédiatement suivi de ```d``` pour se deconnecter de la console
* connectez-vous de nouveau au terminal distant et tapez ```screen -r```

> https://fr.linux-console.net/?p=1143#gsc.tab=0
> http://kmdouglass.github.io/posts/create-a-custom-raspbian-image-with-pi-gen-part-1/

--------------------------------

other cmd:

```
touch ./stage5/SKIP ./stage6/SKIP /stage7/SKIP
touch ./stage5/SKIP_IMAGES ./stage6/SKIP_IMAGES ./stage7/SKIP_IMAGES
docker rm -v pigen_work
.sudo ./build-docker.sh
sudo CONTINUE=1 ./build-docker.sh
sudo PRESERVE_CONTAINER=1 ./build-docker.sh
sudo PRESERVE_CONTAINER=1 CONTINUE=1 ./build-docker.sh
sudo PRESERVE_CONTAINER=1 CONTINUE=1 CLEAN=1 ./build-docker.sh
```
Empty file modified export-noobs/00-release/files/partition_setup.sh
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions stage_rtkbase/00-rtkbase/01-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -e

install -m 644 files/first_run.sh ${ROOTFS_DIR}/home/${FIRST_USER_NAME}/
install -m 644 files/firstboot.service ${ROOTFS_DIR}/lib/systemd/system/
install -m 644 files/firstboot.sh ${ROOTFS_DIR}/boot/

on_chroot << EOF
cd /etc/systemd/system/multi-user.target.wants && ln -s /lib/systemd/system/firstboot.service
cd /home/${FIRST_USER_NAME}
find ./ -type f -iname "*.sh" -exec chmod +x {} \;
./first_run.sh
rm first_run.sh
rm install.sh
chmod +x /boot/firstboot.sh
EOF
20 changes: 20 additions & 0 deletions stage_rtkbase/00-rtkbase/files/first_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

_user="${PWD##*/}"
cd /home/$_user

## install last release
wget https://raw.githubusercontent.com/Stefal/rtkbase/master/tools/install.sh
chmod +x install.sh
sed -i 's/df \"$HOME\"/df \//g' /home/${_user}/install.sh
./install.sh --user ${_user} --dependencies --rtklib --rtkbase-release --gpsd-chrony
find ./ -type f -iname "*.sh" -exec chmod +x {} \;


## install dev branch
#wget https://raw.githubusercontent.com/Stefal/rtkbase/dev/tools/install.sh
#chmod +x install.sh
#sed -i 's/df \"$HOME\"/df \//g' /home/${_user}/install.sh
#./install.sh --user ${_user} --dependencies --rtklib --rtkbase-repo dev --gpsd-chrony
#find ./ -type f -iname "*.sh" -exec chmod +x {} \;

14 changes: 14 additions & 0 deletions stage_rtkbase/00-rtkbase/files/firstboot.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=FirstBoot
After=network.target apt-daily.service apt-daily-upgrade.service
Before=rc-local.service
ConditionFileNotEmpty=/boot/firstboot.sh

[Service]
ExecStart=/boot/firstboot.sh
ExecStartPost=/bin/mv /boot/firstboot.sh /boot/firstboot.sh.done
Type=oneshot
RemainAfterExit=no

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions stage_rtkbase/00-rtkbase/files/firstboot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cd /home/basegnss/rtkbase/tools && \
sudo ./install.sh --user basegnss --unit-files --detect-modem --detect-gnss --configure-gnss --start-services
Empty file added stage_rtkbase/EXPORT_IMAGE
Empty file.
5 changes: 5 additions & 0 deletions stage_rtkbase/prerun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e

if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

0 comments on commit 1883822

Please sign in to comment.