Commit Graph

1554 Commits

Author SHA1 Message Date
Clayton Craft 9f1dd64fa1
install/partition: allow specifying a different boot partition start (!1856)
This adds a new deviceinfo parameter, 'boot_part_start' which accepts an
int and indicates the number of sectors from the start of the drive to
place the boot partition.

The librem5 devkit (and actual phone) u-boot has grown beyond the 2048
sector space previously before the boot partition, so this is necessary in
order to boot pmos on this device.
2020-01-18 19:26:31 +00:00
Minecrell 1fa61aad37 test: parse_depends: Fix hello-world test after pkgrel bump 2020-01-18 11:23:01 +01:00
Oliver Smith 74f76f03f6
crossdirect: support rust (!1850)
Install rust (rustc) in native chroot, if it is in the APKBUILD's
build dependencies. Add a test to verify that crossdirect + rust works
as expected.

Closes: #1861
2020-01-14 02:50:53 +01:00
Oliver Smith 728f304dc7
pmb.config.chroot_home_symlinks: cache rust dirs (!1850)
Rust packaging is new and still a bit weird in Alpine and postmarketOS.
As of writing, we only have one package (squeekboard), and use cargo to
download the source of all dependencies at build time (several git
repositories!) and compile it. Usually, this is a no-go, but at least
until this is resolved properly, let's cache the downloads as suggested
in: https://doc.rust-lang.org/cargo/guide/cargo-home.html

Related: #1861
2020-01-14 02:50:53 +01:00
Oliver Smith b93e83d8b3
pmb.chroot.init: home links: create missing dirs (!1850)
When initializing the building chroots, some symlinks are created to
/mnt/pmbootstrap* dirs. With upcoming rust-related symlinks, they will
point to subdirs in /mnt/pmbootstrap-rust, such as
/mnt/pmbootstrap-rust/registry/cache. Create this directory structure if
it does not exist.
2020-01-14 02:50:53 +01:00
Oliver Smith 02e514f4d3
pmb.helpers.git.clone: use git from host system (!1845)
Do not install git in the native chroot and use it from there. Remove the
chown_to_user argument from pmb.helpers.git.clone(), the resulting dir
is now always owned by the user. While at it, refactor the function and
display the clone URL.

Previously we had cloned aports_upstream (from Alpine) with
chown_to_user=False (legacy) and pmaports with chown_to_user=True.
pmb.helpers.git.rev_parse() would only work after chown_to_user=True.

Check if git is installed in "pmbootstrap init", and remove the same
check from rev_parse(). Add a new work dir version, that checks for git
and changes ownership of already checked out aports_upstream to the
host system's user.

When creating a new work dir, create cache_git instead of cache_http.
cache_http is created on demand already, with proper permissions. But
cache_git must be created, otherwise pmb.helpers.mount.bind will create it
as root.

This is in preparation for the "pmbootstrap pull" feature, as it allows
using the host system's git in all new code paths. We will be able to
handle repositories even if they were cloned outside of the work dir
(which we do in a few CI scripts for example).

Related: #1858
2020-01-12 00:39:47 +01:00
Oliver Smith cba37d5d79
chroot: keep ownership of cache_git (!1845)
Remove /home/pmos/git from pmb.config.chroot_home_symlinks, so
pmb.chroot.init.init() will not change the ownership of the
$WORK/cache_git dir.

The symlink was added two years ago in [1] as compatibility to previous
behavior, because the mountpoint of cache_git was changed from
/home/user/git to /mnt/pmbootstrap-git. Forcing the ownership of that
dir to be the pmos user inside the chroot made sense, because the only
cloned repository (aports_upstream) would also be owned by the pmos
user. With the upcoming change to have all cloned repos owned by the
host-system's user, this is just confusing.

The /home/pmos/git symlink does not seem to be used by anybody, it is
not mentioned in the pmbootstrap code and in the wiki.

[1] b4dd7a89 "Close #709: Improve user creation (#725)"
    https://github.com/postmarketOS/pmbootstrap/pull/725
2020-01-12 00:39:47 +01:00
Oliver Smith c53988b978
git aports_upstream: use gitlab.alpinelinux.org (!1845)
Use Alpine's primary mirror instead of the mirrored version at github
for new clones. A follow up commit will display the clone URL.
2020-01-12 00:39:47 +01:00
Oliver Smith a38026f98e
pmbootstrap init: migrate work dir if necessary (!1845)
This should have already happened, but probably broke when splitting
pmaports into a separate git repository.
2020-01-12 00:39:47 +01:00
Oliver Smith b1cb662645
pmbootstrap init: check for required programs (!1845)
Prepare to require "git" in a follow-up patch.
2020-01-12 00:39:41 +01:00
Daniele Debernardi 3f2a064993
pmb.aportgen: add Contributor/Maintainer to APKBUILD templates (!1852) 2020-01-07 01:46:38 +01:00
Oliver Smith 948e3f931f
Change copyright to 2020 2020-01-06 02:43:00 +01:00
Oliver Smith 680ee1bf97
Prepare 1.13.0 release 2020-01-03 05:28:24 +01:00
Oliver Smith ae1b3fc38c
pmb/helpers/pmaports: ignore provides without ver (!1851)
The APKBUILD reference for "provides" [1] is not worded clearly; but
after reading it over and over again, my understanding is:

* package with provides='foo=1.2' will be automatically installed if
  user requests installing "foo"
* package with provides='foo' (without version) will NOT get
  automatically installed if user requests installing "foo"

For pmbootstrap, this means, that we must not attempt to build a package
where the pkgname mentioned in provides matches what we are currently
resolving, unless there is an equals sign in the provides entry.

Fixes: #1862, pmaports#404

[1] https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#provides says:

"List of package names (and optionally version info) this package
provides.

If package with a version is provided (provides='foo=1.2') apk will
consider it as an alternate name and it will automatically consider the
package for installation by the alternate name, and conflict with other
packages having the same name, or provides.

If version is not provided (provides='foo'), apk will consider it as
virtual package name. Several package with same non-versioned provides
can be installed simultaneously. However, none of them will be installed
by default when requested by the virtual name - instead, error message
is given and user is asked to choose which package providing the virtual
name should be installed."
2020-01-02 17:16:05 +01:00
Oliver Smith 5076069209
pmb/aportgen/gcc.py: add LANG_D=false (!1849)
Alpine's APKBUILD for gcc supports a new language that we don't need, so
disable it just like the irrelevant ones.

Related: https://gitlab.com/postmarketOS/pmaports/merge_requests/839
2019-12-30 12:04:12 +01:00
Daniele Debernardi d145f88276
pmb/qemu/run.py: add audio support (!1840)
Changes:
  * Added the ALSA_PLUGIN_DIRS environment variable otherwise it tries
    to load the plugins of the host pc and they fails.
  * Added the /usr/lib/pulseaudio path to the library-path argument
  * Added the audiodev and soundhw parameters to the qemu command
  * Added the required packages necessary to be installed in the chroot
2019-12-28 01:42:40 +01:00
Minecrell d45e88505d
envkernel.sh: Avoid changing local version based on Git repository state (!1844)
When git is installed, the Linux kernel build system appends suffixes
to the Linux kernel version based on the local repository state.
This means that we get different kernel versions when building the
package normally or with envkernel.sh.

This causes problems with Alpine's "installkernel" script,
which detects the kernel flavor based on the kernel version.
e.g. when building linux-postmarketos-qcom-msm8916 with git installed
the kernel image is installed to /boot/vmlinuz-g556e2c21dbac-dirty
where pmbootstrap (and anything else) cannot find it.

Two changes are necessary to prevent the kernel build system from
appending Git version information:

  1. Set LOCALVERSION= - this is done by this commit.
  2. Unset CONFIG_LOCALVERSION_AUTO
     - this needs to be done in each kernel config (when needed)
2019-12-23 21:11:51 +01:00
Oliver Smith a790900e31
pmb.parse.bootimg: fix kernel detection (!1846)
Adjust to new text that "file" outputs for ARM linux kernels:
	"ARM OpenFirmware FORTH Dictionary..."

Make test_bootimg_kernel pass again, which was failing with:
	AssertionError: assert 'heimdall-isorec' in 'File is not an Android ...
2019-12-23 20:24:05 +01:00
Oliver Smith efdfc33dec
Prepare 1.12.0 release 2019-12-14 03:33:53 +01:00
Drew DeVault 87389fbad3
pmbootstrap install: add --no-base option (!1843) 2019-12-14 02:38:56 +01:00
Oliver Smith b63b021c21
envkernel.sh: install findutils (!1838)
The kernel build system tries to use find -printf when
CONFIG_INITRAMFS_SOURCE is chosen, but busybox find doesn't support
that.

Fixes: #1849
2019-12-14 01:50:57 +01:00
Luca Weiss b3a9080398
helpers/envkernel.fish: add gcc4 support (!1842) 2019-12-14 00:18:21 +01:00
Bart Ribbers 1fbf7356c6
Use default amount of inodes for block device (!1841)
This fixes #1845 without breaking #1717 (closed). The amount of inodes
only needs to be explicitly set when we don't know the size of the
filesystem before hand, for example when using fastboot or Heimdall. In
all other cases it's actually better to let it figure out automatically
how many inodes is set.

On my 16GB sdcard the amount of available inodes got increased by 10
times (from ~100K to ~1M).
2019-12-13 23:23:35 +01:00
Danct12 956d746feb
pmb.config.install_user_groups: add netdev (!1839)
Add default user to netdev group. Together with MR [1] in pmaports.git,
this fixes the permissions to use nmtui and nm-applet from the user.

[1] https://gitlab.com/postmarketOS/pmaports/merge_requests/777
Signed-off-by: Danct12 <danct12@disroot.org>
2019-12-05 22:45:28 +01:00
Antoine Fontaine 144a58b558
helpers/envkernel.sh: add gcc4 support (!1836) 2019-11-30 15:29:02 +01:00
Oliver Smith 5438085e62
pmb/parse/_apkbuild: fix parsing commented lines (!1837)
Properly ignore comments at the end of lines, instead of assuming that
all lines below belong to the attribute:
	subpackages="$pkgname-dev" # $pkgname-lang

Fixes build.postmarketos.org#61, where pmbootstrap would assume that a
random package provides "make", just because the word "make" is written
somewhere below subpackages=" in the APKBUILD and it is parsed
incorrectly.

While at it, also support the ' character for quotations and detect if
a quotation for a value was started, but there is no end quotation sign
in the rest of the file.

I've added tests, and manually checked that this did not introduce any
parsing bugs for all the APKBUILDs in pmaports.git, by running
'pmbootstrap apkbuild_parse' with the old and new code, and diffing the
result.
2019-11-30 12:44:06 +01:00
Oliver Smith 3587812539
replace_aports_packages_with_path: better error (!1837)
Because of an APKINDEX subpkg parsing bug, pmbootstrap currently assumes
that "ktp-common-internals" provides "make". It fails with a cryptic
error when trying to build a package without an existing postmarketOS
binary packages mirror (like done in the build.postmarketos.org
testsuite):

  File "/home/user/code/pmbootstrap/pmb/chroot/apk.py", line 174, in replace_aports_packages_with_path
    package + "-" + data_repo["version"] + ".apk")
TypeError: 'NoneType' object is not subscriptable

Replace this error with a more meaningful message, that points to the
issue analyzing this bug.

Related: https://gitlab.com/postmarketOS/build.postmarketos.org/issues/61
2019-11-30 12:43:10 +01:00
Oliver Smith 84abedd536
pmb.config.build_packages: add git (!1832)
Always install git when building packages, so abuild won't behave
slightly different if it is (not) installed. As nice side-effect, we
will always get the pmaports.git commit saved in the resulting .apk file
from now on (in .PKGINFO).
2019-11-24 20:39:36 +01:00
Oliver Smith c6fd40a07d
Prepare 1.11.0 release 2019-11-22 00:09:36 +01:00
Alexey Min 64aa7443e5
pmb.deviceinfo: fix sanity check when "device-" is present in codename (!1834)
Fixes #1842
2019-11-22 00:01:38 +01:00
Oliver Smith 8806a464b2
pmb/data/keys/pmos-5a03a13a.rsa.pub: remove (!1835)
Delete the old binary package repository key from pmbootstrap.
2019-11-21 23:52:25 +01:00
Oliver Smith e1286c38a5
config: switch to new binary package repository (!1835)
This change has been in the works for about a year now. We have a new
binary repository, that is completely automated and always online.
Powered by builds.sr.ht and our very own build.postmarketos.org code.
The days of yours truly manually triggering to build and upload the
binary package repository at home are finally over! Also this will pave
the way to have multiple branches, and to base on Alpine stable.

Related: https://postmarketos.org/blog/2019/01/16/600-days-of-postmarketOS/#new-srht-based-binary-repository
Related: https://postmarketos.org/blog/2019/06/23/two-years/#sourcehut-srht
Related: https://gitlab.com/postmarketOS/build.postmarketos.org
2019-11-21 23:52:25 +01:00
Daniele Debernardi 8326025c27
install: setup xorg keymap (!1833)
With the nokia N900 the user can choose between different keyboard
layouts and during the install the setup-keymap installs the choosen
layout.

This only changes the keyboard layout of the console, while installing
a UI using xorg, the layout was hardcoded to "us".

With a simple check for the existence of an xorg config containing
XkbLayout, this will run sed to replace the default with the layout
chosen by the user.

Tested with a clean install of the nokia N900 with the xfce4 UI.
2019-11-20 21:57:58 +01:00
Oliver Smith 228ca1f127
Prepare 1.10.0 release 2019-11-10 13:46:23 +01:00
lambdadroid 1893703a78
pmb: config: Require CONFIG_CGROUPS=y kconfig option (!1830)
elogind requires cgroup support in the kernel.
It does not start without it, resulting into errors like:

    elogind-daemon[1654]: Failed to mount tmpfs at /sys/fs/cgroup: No such file or directory
    elogind-daemon[1654]: Failed to mount cgroup at /sys/fs/cgroup/elogind: No such file or directory
    elogind-daemon[1654]: Failed to allocate manager object: No such file or directory

    dbus-daemon[1437]: [system] Activating service name='org.freedesktop.login1' requested by ':1.1' (uid=0 pid=1642 comm="/usr/bin/lightdm ") (using servicehelper)
    dbus-daemon[1437]: [system] Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)

Most of the supported desktop environments (e.g. Weston) do not
start without elogind, so we should require CONFIG_CGROUPS=y in
all kernels to avoid this problem.
2019-11-10 12:45:58 +01:00
Oliver Smith 16166874a5
pmb/build/_package.py: create .git symlink (!1831)
Make /home/pmos/build/.git point to the .git dir from pmaports.git, with
a symlink so abuild does not fail.

abuild expects the current working directory to be a subdirectory of a
cloned git repository (e.g. main/openrc from aports.git). If git is
installed, it will try to get the last git commit from that repository,
and place it in the resulting apk (.PKGINFO) as well as use the date
from that commit as SOURCE_DATE_EPOCH (for reproducible builds).

With that symlink, we actually make it use the last git commit from
pmaports.git for SOURCE_DATE_EPOCH and have that in the resulting apk's
.PKGINFO.

Fixes: #1841
2019-11-10 12:29:55 +01:00
Oliver Smith 46a65e1bb9
pmb.build._package.build_depends: update APKINDEX
When 'pmbootstrap build' is started with '--no-depends', we make sure
that binary packages of all dependencies exist before proceeding with a
build. Make sure that we have downloaded the APKINDEX for the given arch
first, otherwise this may complain that a binary package is missing
although it does exist.

This happened when using the "native" cross compile method, e.g. when
building kernels for different architectures. It would complain that
there is no binary package for "bash" (which is in Alpine obviously):
https://builds.sr.ht/~postmarketos/job/103882
2019-11-04 20:02:18 +01:00
Oliver Smith dcb89a62e0
pmb.config.init: fix python 3.5 compat
Don't use f-strings, as they result in invalid syntax errors for python
3.5. This was making the build.postmarketos.org CI tests fail.
2019-11-03 15:35:57 +01:00
Alexey Min cd2180d178
pmb.config.init: 2-step device selection (!1825)
When running pmbootstrap init, first select device vendor, then device
codename. Also fixed tests for new behavior and added some new ones for
new scenarios.
2019-10-30 22:51:33 +01:00
Oliver Smith a0a3a591da
keys: add build.postmarketos.org.rsa.pub (!1829)
The public key for the new binary repository. Once we can build all
packages with that (for all arches), we'll switch to it.

See also: https://gitlab.com/postmarketOS/build.postmarketos.org/
2019-10-30 21:45:33 +01:00
lambdadroid 67b080b158
Detect if DTB is placed in second area of Android boot image (!1828)
postmarketOS/pmaports!700 adds a new "deviceinfo_bootimg_dtb_second"
option that places the DTB in the "second" area of the Android boot
image.

Attempt to detect this automatically by checking the extracted
second binary for the FDT magic (0xd00dfeed).
2019-10-25 17:36:22 +02:00
Oliver Smith cf9d648ac9
pmaports.guess_main: new assumption for -dev pkgs (!1827)
Packages ending in -dev: just assume that the originating aport has the
same pkgname, except for the -dev at the end. Otherwise we may end up
with the wrong package.

For example, if something depends on plasma-framework-dev, and
plasma-framework is in Alpine, but plasma is in pmaports, then the
regular guess_main() algorithm below would pick plasma instead of
plasma-framework.

Fixes: build.postmarketos.org#52
2019-10-20 20:03:56 +02:00
Luca Weiss 8a5c8fcc3e
Fix detection of qcdt boot images (!1826)
mkbootimg from osm0sis changed the filename of the dtb section in [1]
which breaks the detection of qcdt in pmbootstrap.

Fix this by adjusting the filename pmbootstrap checks to match the
unpackbootimg behavior.

[1] https://github.com/osm0sis/mkbootimg/commit/d8222a4d
2019-10-18 21:35:44 +02:00
lambdadroid 8881b0489f
build: envkernel: install makedepends (!1824)
Currently, building with envkernel.sh entirely ignores the
makedepends listed in the kernel APKBUILD. Common dependencies
needed by most kernels are hardcoded in envkernel.sh.
However, some kernels may need extra dependencies either during
the build process or when the kernel is packaged.

Installing the makedepends when the build environment is initialized
is difficult because "source helpers/envkernel.sh" is not aware
of the exact kernel package that is going to be built later.

However, we can easily modify the packaging step
(i.e. pmbootstrap build --envkernel linux-...)
to install the required makedepends.

This fixes building "linux-postmarketos-qcom-msm8916" using envkernel,
since it requires "dtbTool" and "installkernel" to be installed when
the APKBUILD package() function is executed.
2019-10-13 21:27:43 +02:00
lambdadroid 9ed179594e
install: format: support FAT32 as boot fs (!1823) 2019-10-09 23:57:19 +02:00
Oliver Smith 2bc9652231
Prepare 1.9.0 release 2019-10-07 22:58:02 +02:00
lambdadroid 23ebb71b27
Install "android-tools" instead of "libsparse" for img2simg (!1821)
The sparse image tools (simg2img, img2simg, append2simg) are now
part of Alpine's android-tools where they are continously updated.
(See https://github.com/nmeum/android-tools/pull/8)

Therefore, "libsparse" now conflicts with "android-tools", which
causes the fastboot flasher to fail if "libsparse" is already
installed.

Install "android-tools" instead of "libsparse" before generating
a sparse image to avoid this problem.
2019-10-07 22:43:27 +02:00
Oliver Smith a6704fa09d
aportgen: print note after generating pmaport (!1817)
Make it more obvious that we are generating packages during
'pmbootstrap init', when using the new device wizard:

[22:32:32] *** pmaport generated: /home/user/.local/var/pmbootstrap/cache_git/pmaports/device/device-openphoenux-neo900
[22:32:32] *** pmaport generated: /home/user/.local/var/pmbootstrap/cache_git/pmaports/device/linux-openphoenux-neo900
2019-10-07 22:26:46 +02:00
Martijn Braam 68aa37637a
index: add DESCRIPTION file to APKINDEX.tar.gz (!1822)
This file is used by the package browser frontend build by the alpine
developers. It uses the contents of the DESCRIPTION file to validate the
cache in the database.
2019-10-06 14:45:32 +02:00
Oliver Smith 925c56febe
repo_missing: don't check arch recursively (!1820)
Remove the recursive check, as it caused an infinite loop. It took a
very long time to complete anyway, even when it worked. The reasoning
for having the recursive check in the first place was, that we would
have device packages with arch=noarch set in the APKBUILD, but which
could only be built for a certain architecture (the device
architecture). Nowadays using arch=noarch in device packages is
forbidden, and we enforce that rule [1]. So the recursive arch check
isn't necessary anymore.

[1] ac6c0a2997
2019-10-01 10:46:21 +02:00