File: usage.rst

package info (click to toggle)
pmbootstrap 3.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,852 kB
  • sloc: python: 17,099; sh: 425; makefile: 17
file content (165 lines) | stat: -rw-r--r-- 3,726 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165

#####
Usage
#####

pmbootstrap offers many options and actions and is normally ran from a shell.


Before pmbootstrap can be used, a number of configuration questions need to be answered. The sections below go into detail for the various questions. 

.. code-block:: shell

  $ pmbootstrap init

If you already ran this before, run the following to update your local clone of pmaports.git instead, before moving straight onto the installation step: 

.. code-block:: shell

   $ pmbootstrap pull


Quick health check and config overview:

.. code-block:: shell

   $ pmbootstrap status


After successfully finishing the ``init`` sequence with answering all questions, its time to build the 
installation:

Devices like the PinePhone, Samsung Galaxy S II, Nokia N900, various laptops etc. can boot from an SD card, USB stick or other external storage. Find the name with lsblk first and make sure it is the right one as you will overwrite everything on it. Use a path without partition number at the end, such as /dev/mmcblk0. If your device is able to boot from SD card without flashing anything (such as the PinePhone), you should then be able to insert SD card into your device and boot it up.

.. code-block:: shell

   $ pmbootstrap install --sdcard=/dev/mmcblk... --fde


For devices where you will flash directly to the internal storage, as mostly all sdm845 devices, you can build the installation as:

.. code-block:: shell

   $ pmbootstrap install


or with full disk encryption:

.. code-block:: shell

   $ pmbootstrap install --fde

and then flash it with the ``pmbootstrap flasher`` while the device is in ``fastboot`` mode:

.. code-block:: shell

   $ pmbootstrap flasher flash_rootfs


and also the kernel:

.. code-block:: shell

   $ pmbootstrap flasher flash_kernel


For getting images on the local machine instead of directly flashing them, execute:

.. code-block:: shell

   $ pmbootstrap export


To extract the generated initramfs: 

.. code-block:: shell

   $ pmbootstrap initfs extract


Build and flash Android recovery zip:

.. code-block:: shell

 $ pmbootstrap install --android-recovery-zip
 $ pmbootstrap flasher --method=adb sideload


Update existing installation on SD card:

.. code-block:: shell

 $ pmbootstrap install --disk=/dev/mmcblk0 --rsync


Run the image in QEMU:

.. code-block:: shell

 $ pmbootstrap qemu --image-size=1G


**Device Porting Assistance**

Analyze Android boot.img files (also works with recovery OS images like TWRP):

.. code-block:: shell

 $ pmbootstrap bootimg_analyze ~/Downloads/twrp-3.2.1-0-fp2.img


Check kernel configs:

.. code-block:: shell

 $ pmbootstrap kconfig check


Edit a kernel config:

.. code-block:: shell
 
 $ pmbootstrap kconfig edit



For further details on the different actions please see below and refer to the wiki-arcticle on `pmbootstrap`_.

.. autoprogram:: pmb.parse:get_parser()
   :prog: pmbootstrap
   :groups:

Requirements
============

pmbootstrap requires the following:

  * Linux distribution on the host system (`x86`, `x86_64`, `aarch64` or `armv7`)
    
    .. note::
       Windows subsystem for `Linux (WSL)`_ does **not** work! Please use `VirtualBox`_ instead.


  * Linux kernel 3.17 or higher (`oldkernel`_)

    .. note::
       Kernel version 5.8 - 6.0 might have issues with loop-devices


  * Python 3.10+
  * For python3 < 3.11: tomli
  * OpenSSL
  * git
  * ps
  * tar
  * sudo or doas
  * POSIX-shell (`ash`,`bash`, `zfs` reported to work)

.. _pmbootstrap: https://wiki.postmarketos.org/wiki/Pmbootstrap#Using_pmbootstrap

.. _Linux (WSL): https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

.. _virtualbox: https://www.virtualbox.org/

.. _oldkernel: https://postmarketos.org/oldkernel