## Clone repositories 1. Clone InfiniTime: ```bash git clone https://github.com/InfiniTimeOrg/InfiniTime.git cd InfiniTime git submodule update --init ``` 2. Clone InfiniSim: ```bash cd .. #Ignore this line if you already cd'd into the diretory you want it cloned into git clone --recursive https://github.com/InfiniTimeOrg/InfiniSim.git ``` ## Install dependencies ### For building InfiniTime 1. Install Docker 2. Pull docker container (optional, container will be pulled when running the docker container if not pulled now). ```bash sudo docker pull infinitime/infinitime-build ``` ### For building InfiniSim This was the most difficult part for me to get right since the steps on the github page are not entirely complete for my setup. If you encounter errors while building, it's probably because one of the dependencies are missing or have the wrong version installed. If you do have an error while building, check out the issues on github and see if you can find some help there: https://github.com/InfiniTimeOrg/InfiniSim/issues 1. The apt install part. This is almost exactly the same as what is on the github page except for npm. When I added npm in to here, I got an older version that didn't work. We'll install the correct version in step 2. ```bash sudo apt install -y cmake libsdl2-dev g++ libpng-dev ``` 2. Install the correct node version. (At least v14.0.0 is required). Commands from https://github.com/nodesource/distributions First, choose the node version by running one of these lines: ```bash NODE_MAJOR=16 NODE_MAJOR=18 NODE_MAJOR=20 ``` I'm not sure which is the best to use, I went with 16 since that is the closest to the version required by InfiniSim, but I doubt it makes much of a difference. Once you've done that, then install it with these commands: ```bash sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg NODE_MAJOR=20 echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list sudo apt-get update sudo apt-get install nodejs -y ``` 3. Install npm packages ```bash npm install lv_font_conv@1.5.2 -g npm install ts-node@10.9.1 @swc/core@1.3.82 lv_img_conv@0.3.0 -g ``` ## Build InfiniSim ### Building with stock InfiniTime Now to see if we did everything the way our computer wants it. First cd into the directory where InfinSim was cloned (`cd InfiniSim` if you are still in the directory you started in). Now you should be able to build InfiniSim with the InfiniTime version that was included with InfiniSim: ```bash cmake -S . -B build cmake --build build -j4 ``` If that didn't produce any error, now run it! ```bash ./build/infinisim ``` ### Building with your own version of InfiniTime To test your own modifications of InfiniTime: ```bash cmake -S . -B build -DInfiniTime_DIR=../InfiniTime cmake --build build -j4 ``` Assuming that the git clone command was run in the same directory for both InfiniSim and InfiniTime. If not, replace `../InfiniTime` with the path to the directory where InfiniTime was cloned to. And now run it if there were no errors! ```bash ./build/infinisim ``` ## Build InfiniTime Now is the fun part, building your own version of InfiniTime and flashing it to your watch! First, cd into the directory into which InfiniTime cloned (`cd ~/InfiniTime` if you cloned from your home directory). Now run the docker container (for more info on this command, see https://github.com/InfiniTimeOrg/InfiniTime/blob/main/doc/buildWithDocker.md): ```bash docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime/infinitime-build ``` If that doesn't have any errors, it will save the files to build/output/. The file you will want to flash to your watch is `pinetime-mcuboot-app-dfu-x.x.x.zip`. I found a pretty nice program called WatchMate that you can use to flash it from linux, but I think you can also use Gadgetbridge to flash the file. In WatchMate, just scroll down to the "Firmware Version" dropdown and click on "Upload from file" > "Firmware" and select the zip file mentioned above. Once that's done, you may also want to send it the `infinitime-resources-x.x.x.zip` if some features are greyed out on the watch (for me it was a couple watch faces and the navigation app that were greyed out). In WatchMate, you'll want to use the "Resources" option instead of the "Firmware" option to upload this file. ## Celebrate There you go, you've just flashed your own custom os to your watch! If you got all this far without running into any error, you have something to celebrate about as it took me a couple of days to get to this point. If you did have some errors and figured them out, then great, you've got it all figured out now! One final thing, I would recommend making use of git commits and branches so that you can revert if you totally mess something up and don't have to clone the entire repository and dependencies again like I had to do several times before I decided to start doing that.