README.md 3.76 KB
Newer Older
Luxferre's avatar
Luxferre committed
1
2
# Pris System

Luxferre's avatar
Luxferre committed
3
Main system, boot and splash partition images of Project Pris (GerdaOS)
4

Luxferre's avatar
Luxferre committed
5
6
7
## Supported builds as of now

- `boot`
8
- `system`
9
- `splash`
Luxferre's avatar
Luxferre committed
10
- `installer`
11
12
13
14
15

## Dependency requirements

### Overall

Luxferre's avatar
Luxferre committed
16
- ADB
17
- Bash 3+
18
- Make
19
- JRE8
20
21
22

### For building the boot image

Luxferre's avatar
Luxferre committed
23
- Make, GCC
24
25
26

### For building the system image

27
- `make_ext4fs` (compiled during the build process)
28
29
30
31

### For building the splash image

- FFmpeg
Luxferre's avatar
Luxferre committed
32
33

## System image structure
34
35
36
37
38
39

_TODO_

## Building the images

```
40
make build
41
42
43
44
```

Files called `boot.new.img`, `system.new.img` and `splash.new.img` will be created in the project directory.

45
46
You can also individually run `make build-boot`, `make build-system` and `make build-splash` to build only the parts you need right now.

Luxferre's avatar
Luxferre committed
47
48
49
50
51
52
53
54
55
56
## Backing up existing partitions

```
make backup
```

Files called `boot.$RANDOMID.img`, `system.$RANDOMID.img` and `splash.$RANDOMID.img` will be created in the `works/backups/` directory.
The RANDOMID value will be consistent across all backup images.

You can also individually run `make backup-boot`, `make backup-system` and `make backup-splash` to backup only the parts you need right now.
57

58
59
## Deploying the images to the device

60
You must have Pris Recovery (aka Gerda Recovery) installed on your device for deployment to succeed.
61
62
63
64

Boot the phone into Pris Recovery and then run:

```
65
make deploy
66
67
```

68
You can also individually run `make deploy-boot`, `make deploy-system` and `make deploy-splash` to flash only the parts you need right now.
69
70


71
## Building the update package for recovery
72

73
Alternatively, you can also build a ready-made update.zip for the HMD firmware v12 or for Pris Recovery (highly recommended) over any stock system version.
74

Luxferre's avatar
Luxferre committed
75
76
77
78
79
80
```
make build-installer
```

or

81
```
82
make VERSION=${ver} build-installer
83
84
```

Luxferre's avatar
Luxferre committed
85
If the `VERSION` variable is omitted, short hash of the recent commit will be used instead. Same thing goes for GitLab CI automated build. 
86

Luxferre's avatar
Luxferre committed
87
A file called `gerda-install-${ver}.zip` will be created in the project directory.
88

Luxferre's avatar
Luxferre committed
89
Note that this file will not install Gerda Recovery! And if Gerda Recovery isn't installed, the update can run only from stock v12 and lower recoveries.
Luxferre's avatar
Luxferre committed
90

Luxferre's avatar
Luxferre committed
91
To install the image, run `adb reboot recovery`, select "Wipe data/factory reset" and then "Install update from ADB", afterwards run:
92
93
94
95
96
97
98

```
adb sideload gerda-install-${ver}.zip
```

And wait until the process completes. Afterwards, reboot the phone to see your newly installed OS.

Luxferre's avatar
Luxferre committed
99
100
101
102
103

## Changing boot splash image

Note: this guide only focuses on the splash partition image (which is "Powered by KaiOS" by default). The system one ("Nokia") is stored in `system` partition.

Luxferre's avatar
Luxferre committed
104
Prerequisites: `imagemagick` and/or `ffmpeg` package installed. Currently `ffmpeg` is required.
Luxferre's avatar
Luxferre committed
105
106
107
108
109
110
111
112

### Boot splash format description

- First 8 bytes (0 to 7): `SPLASH!!` (or `53 50 4C 41 53 48 21 21` in hex)
- Bytes 8 to 11: 32-bit width, little-endian (for 8110: `f0 00 00 00`, equals to 240)
- Bytes 12 to 15: 32-bit height, little-endian (for 8110: `40 01 00 00`, equals to 320)
- Bytes 16 to 19: 32-bit image type, little-endian (for 8110: `00 00 00 00`)
- Bytes 20 to 23: 32-bit 512-block count, little endian (for 8110: `2c 01 00 00`, equals to 240x320x2/512 = 300)
Luxferre's avatar
Luxferre committed
113
114
- Next 488 bytes: zero-filled
- Bytes from 512: raw 16-bit image data in BGR565LE format, length must be 153600 bytes
Luxferre's avatar
Luxferre committed
115
116
117

The header suitable for 8110 is stored in the `src/splash/logohdr.bin` file.

Luxferre's avatar
Luxferre committed
118
119
120
121
122
123
124
125
126
127
128
129
### Manual steps to build the splash image

1. Place your PNG with the logo to `src/splash/logo.png`.
2. Run:

```
ffmpeg -vcodec png -i src/splash/logo.png -vcodec rawvideo -f rawvideo -pix_fmt bgr565 -s 240x320 -y tmp.bin`
cat src/splash/logohdr.bin tmp.bin > splash.new.img
rm tmp.bin
```

### Automatic building
Luxferre's avatar
Luxferre committed
130

131
The splash image is built among others when running `make build`. To build a new one, place a 240x320 PNG file into `src/splash/logo.png`.