Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • postmarketOS/pmbootstrap
  • fossdd/pmbootstrap
  • Adrian/pmbootstrap
  • JustSoup321/pmbootstrap
  • longnoserob/pmbootstrap
  • sixthkrum/pmbootstrap
  • ollieparanoid/pmbootstrap
  • magdesign/pmbootstrap
  • anjandev/pmbootstrap
  • HenriDellal/pmbootstrap
  • Minecrell/pmbootstrap
  • chipiguay/pmbootstrap
  • ijiki16/pmbootstrap
  • whynothugo/pmbootstrap
  • amessier/pmbootstrap
  • Eisenbahnfan/pmbootstrap
  • user0-07161/pmbootstrap
  • SzczurekYT/pmbootstrap
  • neuschaefer/pmbootstrap
  • knuxify/pmbootstrap
  • Frieder.Hannenheim/pmbootstrap
  • tgirl/pmbootstrap
22 results
Show changes
Commits on Source (6)
......@@ -23,15 +23,17 @@ fi
# Use pytest-cov if it is installed to display code coverage
cov_arg=""
if python -c "import pytest_cov" >/dev/null 2>&1; then
cov_arg="--cov=pmb"
cov_arg="--cov=pmb --cov-report term --cov-report xml:coverage.xml"
fi
echo "Running pytest..."
echo "NOTE: use 'pmbootstrap log' to see the detailed log if running locally."
# shellcheck disable=SC2086
python -m pytest \
--color=yes \
-vv \
-x \
--junitxml=junit.xml \
$cov_arg \
-m "not skip_ci" \
"$@"
......@@ -21,13 +21,12 @@ before_script: &global_before_scripts
- "if grep -q VERSION_ID=3\\.17 /etc/os-release; then apk add py3-tomli; fi"
stages:
- lint
- deploy
- test
- deploy
- integration-test
codespell:
stage: lint
stage: test
script:
- ".ci/codespell.sh"
......@@ -43,10 +42,15 @@ pytest:
- "cp /home/build/.local/var/pmbootstrap/log_testsuite.txt ."
- "cp /home/build/.local/var/pmbootstrap/log.txt ."
artifacts:
when: on_failure
when: always
paths:
- "log_testsuite.txt"
- "log.txt"
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: junit.xml
# Ensure that tests pass on Python 3.10
pytest-python3.10:
......@@ -54,22 +58,22 @@ pytest-python3.10:
image: alpine:3.17
ruff:
stage: lint
stage: test
script:
- ".ci/ruff.sh"
shellcheck:
stage: lint
stage: test
script:
- ".ci/shellcheck.sh"
vermin:
stage: lint
stage: test
script:
- ".ci/vermin.sh"
mr-settings:
stage: lint
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
before_script:
......@@ -80,12 +84,12 @@ mr-settings:
- "python3 ./check_mr_settings.py"
mypy:
stage: lint
stage: test
script:
- ".ci/mypy.sh"
docs:
stage: lint
stage: test
script:
- ".ci/docs.sh"
artifacts:
......
......@@ -254,11 +254,6 @@ Use `-v` on any action to get verbose logging:
$ pmbootstrap -v build hello-world
```
Parse a single deviceinfo and return it as JSON:
```
$ pmbootstrap deviceinfo_parse pine64-pinephone
```
Parse a single APKBUILD and return it as JSON:
```
$ pmbootstrap apkbuild_parse hello-world
......
######
Chroot
######
chroot (short for "change root") is a system call and command that changes the apparent root directory.
This can come in very handy to make some modifications in the generated image file.
Enter the armhf building chroot:
.. code-block:: shell
$ pmbootstrap chroot -b armhf
Run a command inside a chroot:
.. code-block:: shell
$ pmbootstrap chroot -- echo test
Safely delete all chroots:
.. code-block:: shell
$ pmbootstrap zap
Use ``chroot`` to install a specific kernel version from an apk file.
copy your working kernel apk to the chroot dir of pmbootstrap:
.. code-block:: shell
$ sudo cp /path/of/linux-kernel.apk ~/.local/var/pmbootstrap/chroot_rootfs_oneplus-enchilada/
enter chroot
.. code-block:: shell
$ pmbootstrap chroot -r
and install the package:
.. code-block:: shell
$ apk add linux-kernel.apk
#########
Debugging
#########
pmbootstrap writes all log output and each shell command it runs to log.txt inside the work dir.
Use the following command to follow the log in a second terminal:
.. code-block:: shell
$ pmbootstrap log
Use ``-v`` on any action to get verbose logging:
.. code-block:: shell
$ pmbootstrap -v build hello-world
Parse a package from an APKINDEX and return it as JSON:
.. code-block:: shell
$ pmbootstrap apkindex_parse $WORK/cache_apk_x86_64/APKINDEX.8b865e19.tar.gz hello-world
``ccache`` statistics:
.. code-block:: shell
$ pmbootstrap stats --arch=armhf
......@@ -18,6 +18,8 @@ For further information, please check out the `postmarketOS-wiki`_.
installation
usage
chroot
debugging
api/modules
mirrors
......
......@@ -18,6 +18,111 @@ If you already ran this before, run the following to update your local clone of
$ 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()
......
......@@ -19,6 +19,7 @@ from .helpers import frontend
from .helpers import logging
from .helpers import mount
from .helpers import other
from .helpers import status
from .core import Chroot, Config
from .core.context import get_context
from .commands import run_command
......@@ -43,6 +44,8 @@ if version < (3, 10):
def print_log_hint() -> None:
context = get_context(allow_failure=True)
if context and context.details_to_stdout:
return
log = context.log if context else Config().work / "log.txt"
# Hints about the log file (print to stdout only)
log_hint = "Run 'pmbootstrap log' for details."
......@@ -128,10 +131,12 @@ def main() -> int:
except Exception as e:
# Dump log to stdout when args (and therefore logging) init failed
can_print_status = get_context(allow_failure=True) is not None
if "args" not in locals():
import logging as pylogging
pylogging.getLogger().setLevel(logging.DEBUG)
can_print_status = False
logging.info("ERROR: " + str(e))
logging.info("See also: <https://postmarketos.org/troubleshooting>")
......@@ -144,6 +149,8 @@ def main() -> int:
"Find the latest version here: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/tags"
)
print(f"Your version: {__version__}")
if can_print_status:
status.print_status()
return 1
return 0
......
......@@ -554,7 +554,7 @@ def lint(args: PmbArgs) -> None:
def status(args: PmbArgs) -> NoReturn:
pmb.helpers.status.print_status(args)
pmb.helpers.status.print_status()
# Do not print the DONE! line
sys.exit(0)
......
......@@ -65,7 +65,9 @@ def clone(name_repo: str) -> None:
open(fetch_head, "w").close()
def rev_parse(path: Path, revision: str = "HEAD", extra_args: list = []) -> str:
def rev_parse(
path: Path, revision: str = "HEAD", extra_args: list = [], silent: bool = False
) -> str:
"""Run "git rev-parse" in a specific repository dir.
:param path: to the git repository
......@@ -75,7 +77,7 @@ def rev_parse(path: Path, revision: str = "HEAD", extra_args: list = []) -> str:
or (with ``--abbrev-ref``): the branch name, e.g. "master"
"""
command = ["git", "rev-parse"] + extra_args + [revision]
rev = pmb.helpers.run.user_output(command, path)
rev = pmb.helpers.run.user_output(command, path, output="null" if silent else "log")
return rev.rstrip()
......@@ -90,10 +92,10 @@ def can_fast_forward(path: Path, branch_upstream: str, branch: str = "HEAD") ->
raise RuntimeError("Unexpected exit code from git: " + str(ret))
def clean_worktree(path: Path) -> bool:
def clean_worktree(path: Path, silent: bool = False) -> bool:
"""Check if there are not any modified files in the git dir."""
command = ["git", "status", "--porcelain"]
return pmb.helpers.run.user_output(command, path) == ""
return pmb.helpers.run.user_output(command, path, output="null" if silent else "log") == ""
def list_remotes(aports: Path) -> list[str]:
......
......@@ -5,7 +5,6 @@ import pmb.config.other
import pmb.config.workdir
import pmb.helpers.git
from pmb.core import Config
from pmb.types import PmbArgs
from pmb.core.context import get_context
......@@ -23,11 +22,11 @@ def print_channel(config: Config) -> None:
# Get branch name (if on branch) or current commit
path = pmb.helpers.git.get_path("pmaports")
ref = pmb.helpers.git.rev_parse(path, extra_args=["--abbrev-ref"])
ref = pmb.helpers.git.rev_parse(path, extra_args=["--abbrev-ref"], silent=True)
if ref == "HEAD":
ref = pmb.helpers.git.rev_parse(path)[0:8]
ref = pmb.helpers.git.rev_parse(path, silent=True)[0:8]
if not pmb.helpers.git.clean_worktree(path):
if not pmb.helpers.git.clean_worktree(path, silent=True):
ref += ", dirty"
value = f"{channel} (pmaports: {ref})"
......@@ -52,7 +51,7 @@ def print_systemd(config: Config) -> None:
print_status_line("systemd", f"{yesno} ({reason})")
def print_status(args: PmbArgs) -> None:
def print_status() -> None:
""":param details: if True, print each passing check instead of a summary
:returns: True if all checks passed, False otherwise"""
config = get_context().config
......
......@@ -868,6 +868,10 @@ def install_system_image(
pmb.install.partition_cgpt(layout, size_boot, size_reserve)
else:
pmb.install.partition(layout, size_boot, size_reserve)
# Inform kernel about changed partition table in case parted couldn't
pmb.chroot.root(["partprobe", "/dev/install"], check=False)
if not split:
pmb.install.partitions_mount(device, layout, disk)
......