Commit Graph

97 Commits

Author SHA1 Message Date
Zhuowei Zhang 1efe288fe2
losetup: support building rootfs images with 4096 byte sector sizes (!1725)
Adds an optional deviceinfo variable, `deviceinfo_rootfs_image_sector_size`,
which specifies the logical sector size of the device's storage.

Some devices made after 2016 with UFS storage uses 4096 byte sectors
instead of the normal 512 bytes. The partition table in our rootfs
must match, otherwise the root filesystem won't mount on the device.

This change passes the sector size to `losetup` when creating the image
if the deviceinfo specifies it, so the image will have the correct
sector size.

If the deviceinfo doesn't specify the new option, the behaviour
is the same as previous versions of pmbootstrap.

Note that the sector size option only works on Linux 4.14 and above,
so pmbootstrap should be run on a >4.14 computer when installing to
devices with non-standard sector size.

To find if a device needs this parameter, run `fdisk -l` on the device.
If the output shows

`Note: sector size is 4096 (not 512)`

then add `deviceinfo_rootfs_image_sector_size="4096"` to the deviceinfo.

This is needed by the Pixel 3 XL (google-crosshatch) port.

See https://gitlab.com/postmarketOS/pmbootstrap/issues/1696.
2018-12-11 09:08:12 +01:00
Oliver Smith 9cb27e5d22
kconfig check: disallow USE_VFB (!1723)
Weston and Plasma Mobile might choose to draw on this virtual frame
buffer, just like it happened for the samsung-jflte. Disabling the
USE_VFB option fixed this, so let's make sure we don't have that option
enabled for any kernel.
2018-12-06 07:42:17 +01:00
Oliver Smith a5a64158e9
allow specifying multiple postmarketOS mirrors (!1718)
Multiple -mp arguments can be used to list multiple mirrors:
$ pmbootstrap -mp=first -mp=second chroot -- cat /etc/apk/repositories

This is needed for the new build infrastructure, so we can have a WIP
repository to which we push packages until all of them are up to date,
and then publish all of them at once. Software like KDE/Plasma Mobile,
which expect a lot of packages to be updated from one version to
another will not end up with a half-way through upgrade that way.
2018-12-06 07:31:43 +01:00
Oliver Smith d7b888907f
bump version to 1.0.4 2018-12-01 02:37:44 +01:00
Oliver Smith dab053e96c
bump version to 1.0.3 2018-11-07 08:08:53 +01:00
Oliver Smith b8dc816af0
bump version to 1.0.2 2018-10-12 09:09:23 +02:00
Oliver Smith 1e495baa3c bump version to 1.0.1
I'll tag a new version, because installing with pip is fixed now.
2018-10-09 04:35:03 +00:00
Oliver Smith 87384aace6 increase min. required pmaports version
After all the GCC6-as-extra-package related changes.
2018-10-08 05:06:59 +00:00
Oliver Smith 8eb3b5d5c6
bump version to 1.0.0
(imagine epic music playing in background)
2018-09-19 09:51:01 +02:00
Oliver Smith 1f8832c4cc install apk keys and binfmt data with setup.py 2018-09-17 10:06:57 +00:00
Oliver Smith cff9185401
Update minimum required apk version to 2.10.1-r0
Max Justicz found a clever way to exploit apk, which is fixed in the
latest version:

<https://justi.cz/security/2018/09/13/alpine-apk-rce.html>
2018-09-14 06:26:46 +02:00
Martijn Braam d88a09e6bd Added write_uboot_spl deviceinfo variable 2018-09-11 07:05:04 +00:00
Oliver Smith 3ce00de710 Move aports into own repository (pmaports) 2018-09-05 05:57:38 +00:00
Oliver Smith 7cb471cb42 aports/kde: test case for framework versions
This commit adds a test case, which makes sure that the KDE framework
and plasma framework version are always the same.

Additional changes:
* APKBUILD parser parses the URL now (that's the best way I found to
  categorize the KDE aports in frameworks and other)
* Changed single quotes to double quotes in KDE APKBUILDs, so the
  parser doesn't include the single quotes in the parsed result
* Added the test case to the gitlab CI config
2018-08-02 20:33:20 +00:00
NotKit e22ba8caea Change default user uid to 10000 2018-08-02 20:10:56 +00:00
Oliver Smith 0d7802d7ef
s/system partition/rootfs: fix remaining mentions
Follow-up to !1373, where `pmbootstrap flasher flash_system` was
replaced with `pmbootstrap flasher flash_rootfs`. We still had used
terms like "system partition" in a lot of places.

This commit replaces it everywhere, so it's clear that we're talking
about the pmOS rootfs (which may or may not be installed to Android's
system partition).
2018-07-15 23:41:31 +02:00
Oliver Smith f121dce59b pmb: bump version to 0.8.0 2018-07-14 01:16:04 +00:00
Oliver Smith 0854aa1dc4
Remove github.com references
* Travis and Coveralls badges
* aports: instead of <https://github.com/postmarketOS>, use
  <https://postmarketos.org>
* References to full URLs to issues and pull requests replaced with
  a hash and the number
* grsec check: simplify error message, remove link to github issue
  (nobody is using that anymore anyway)
2018-06-30 09:00:48 +02:00
Bhushan Shah 26808e4d6a
pmb: Add user to plugdev group and create it
This allows the user to talk to networkmanager to manage the system
connections. As it is mentioned in networkmanager pre-install.

```
Executing networkmanager-1.10.6-r0.pre-install
  *
  * To setup system connections, regular users must be member of 'plugdev' group.
```

The plugdev group gets created in the post-install hook of
networkmanager. Not all UIs depend on networkmanager, which means that
the group may not exist at installation time when we try to add the
user to the group in the python code. Therefore we create the group
first.
2018-06-25 22:53:29 +02:00
Oliver Smith cd181c541a
Allow DEVTMPFS_MOUNT in kernel config (#1548)
It is important, that we have DEVTMPFS enabled in the kernel config. But
it  does not hurt to have DEVTMPFS_MOUNT enabled as well, and some of
Alpine's kernel configs have that by default. This commit removes the
check that forbids the option in kernel configs, so we can fork the
raspberry pi kernel package from Alpine without changing unrelated
options.
2018-06-10 13:20:27 +00:00
George Hopkins 5edabd4d17 pmbootstrap: handle checkdepends (#1533) 2018-06-04 19:07:52 +00:00
Daniele Debernardi dfde37c132 Add Raspberry Pi device (#1501) 2018-05-29 19:33:40 +00:00
Oliver Smith 4e665a2190
Recreate device nodes in chroot after shutdown (#1447)
Device nodes in the chroots get created in a tmpfs, so they can be
created even if the filesystem where the chroot resides does not
support device nodes (#1317). In "pmbootstrap shutdown" we umount the
`dev` folder, which means all device nodes that were created inside
this folder are gone. This commit changes the code to actually recreate
the device nodes when using the chroot again.

Details:
* move `pmb.chroot.init.create_device_nodes` to
  `pmb.chroot.mount.crete_device_nodes`
* don't call it in `pmb.chroot.init()` anymore, but in
  `pmb.chroot.mount_dev_tmpfs()`
* Create the `null` device as well (`apk --initdb` also creates it on
  `init`, but we don't call it after `shutdown`)
2018-04-29 22:17:57 +00:00
Oliver Smith d6391791f7
Set all of user's groups in "pmbootstrap install" (#1432)
The postmarketos-base package used to make the user part of the "video"
and "audio" groups. However, this did not work reliably, and we were
adding the "wheel" group in "pmbootstrap install" anyway.

Now all groups get added in "pmbootstrap install", and the names of the
groups have been moved to `pmb.config.install_user_groups`.
2018-04-23 20:52:03 +00:00
Daniele Debernardi 400562a753 Ask to copy SSH public keys during init (#1394) 2018-04-08 14:12:01 +00:00
Oliver Smith b66b5dcc34
pmbootstrap init: kernel selection / remove linux-pmos-lts (#1363)
* As discussed in IRC/matrix, we're removing `linux-postmarketos-lts`
  for now. The kernel isn't used right now, and we save lots of
  maintenance effort with not updating it every week or so.
* new config option `"kernel"` with possible values:
  `"downstream", "mainline", "stable"` (downstream is always
  `linux-$devicename`)
* ask for the kernel during `pmbootstrap init` if the device package
  has kernel subpackages and install it in `_install.py`
* postmarketos-mkinitfs: display note instead of exit with error when
  the `deviceinfo_dtb` file is missing (because we expect it to be
  missing for downstream kernels)
* device-sony-amami:
  * add kernel subpackages for downstream, mainline
  * set `deviceinfo_dtb`
* device-qemu-amd64: add kernel subpackages for stable, lts, mainline
* test cases and test data for new functions
* test case that checks all aports for right usage of the feature:
  * don't mix specifying kernels in depends *and* subpackages
  * 1 kernel in depends is maximum
  * kernel subpackages must have a valid name
  * Test if devices packages reference at least one kernel
* Remove `_build_device_depends_note()` which informs the user that
  `--ignore-depends` can be used with device packages to avoid building
  the kernel. The idea was to make the transition easier after a change
  we did months ago, and now the kernel doesn't always get built before
  building the device package so it's not relevant anymore.
* pmb/chroot/other.py:
  * Add autoinstall=True to kernel_flavors_installed(). When the flag
    is set, the function makes sure that at least one kernel for the
    device is installed.
  * Remove kernel_flavor_autodetect() function, wherever it was used,
    it has been replaced with kernel_flavors_installed()[0].
* pmb.helpers.frontend.py: remove code to install at least one kernel,
  kernel_flavors_installed() takes care of that now.
2018-04-03 23:50:09 +00:00
Oliver Smith 4d8afc4aa5
Fix: /var/cache/distfiles writable by everyone (#1329)
As noted in commit 255c715624
`/var/cache/distfiles` is writable by everyone. It is supposed to be
writable only by `root` and by the `abuild` group (in which we put the
`pmos` user already for building packages).

Changes:
* `pmb.build.init()`: make `/var/cache/distfiles` writable only by
  members of the `abuild` group (and root)
* Increase workfolder version to 2
* Add migration code that fixes the permissions for existing work
  folders
* Refactor the migration code a bit to make this possible
2018-03-30 21:46:31 +00:00
Oliver Smith 6bb8444fef
"...flasher flash_rootfs" instead of "..._system" (#1373)
* Change `pmbootstrap flasher flash_system` command to
  `pmbootstrap flasher flash_rootfs`
* The old command still works, but all references have been changed to
  the new command
* Remove obsolete `pmbootstrap flasher export` (that was changed to
  `pmbootstrap export` a few months ago)
* Update `README.md` and ZSH auto completion
* Change the description of the generated rootfs image (not talking
  about a system image anymore, mention that it has subpartitions)
* Better description of `pmbootstrap flasher flash_rootfs --partition`
2018-03-30 01:11:20 +00:00
Daniele Debernardi 147082ec58 pmbootstrap init: Ask for hostname, default: device name (#1327)
* Save "" (empty string) in the user's config as hostname if the user
  let it default to the name of the device. That way, when the device
  gets changed, the user won't get the old device's name as hostname
  by accident.
* Add a test case
2018-03-17 18:41:41 +00:00
Oliver Smith 5ea00e0862
pmbootstrap newapkbuild: Properly parse arguments (#1320)
* pmbootstrap newapkbuild: Properly parse arguments

The `pmbootstrap newapkbuild` action wraps Alpine's `newapkbuild`. We
used to directly pass all arguments to `newapkbuild` without verifying
in Python whether they make sense or not. However, as `newpakbuild`
doesn't do strict sanity checks on the arguments, it is easy to end up
with unexpected behavior when using the command for the first time.

For example, `newapkbuild` allows either specifying a PKGNAME or SRCURL
as last parameter, and also allows setting a PKGNAME with the `-n`
parameter. It only makes sense to use that option when passing a
SRCURL.

With this commit, we duplicate the optins that should be passed through
to `newapkbuild` and use argparse to fully sanitize the options and
display a help page (`pmbootstrap newapkbuild -h`) that is consistent
with the other help pages.

Details:
* The `-f` (force) flag does not get passed through anymore. Instead we
  use it in Python to skip asking if an existing aport should be
  overwritten (the aports are outside of the chroot, so `newapkbuild`
  can't handle it in a way that makes sense for pmbootstrap).
* Output of `newapkbuild` gets redirected to the log file now, as we
  don't need it to display a help page.
* Don't verify the pkgver while creating the new APKBUILD. When passing
  a SRCURL, the pkgver gets extracted from the end of the URL and may
  not have a valid format yet (but we want the APKBUILD anyway).
* Stored options passed through in `pmb/config/__init__.py` and use it
  in both `pmb/parse/arguments.py` and `pmb/helpers/frontend.py`.
* Only allow `-n` with SRCURL
* The postmarketOS aports folder gets specified with `--folder` now.
  That way the generated help page is much closer to the original one
  from `newapkbuild`. The default is `main`.
* Made the package type flags (CMake, autotools, ...) exclusive so only
  one of them can be specified
2018-03-15 21:42:34 +00:00
Oliver Smith 3510a4868f
Fix building packages by provides name (#1303)
Use case: `mkbootimg` provides the `unpackbootimg` package. When
running `pmb.chroot.apk.install(args,"unpackbootimg")`, it was not
able to properly build the package.

Reproducing the error:
```
sudo rm ~/.local/var/pmbootstrap/packages/x86_64/mkbootimg*
pmbootstrap index
pmbootstrap --mirror-pmOS="" chroot --add=unpackbootimg
```

Or alternatively (simpler but less illustrative):
```
pmbootstrap build unpackbootimg --force
```
2018-03-08 21:30:55 +00:00
Daniele Debernardi 94306b51ee deviceinfo: remove external_disk_install and external_disk, use external_storage instead (#1301)
* deviceinfo: remove external_disk_install and external_disk, use external_storage instead
* Complain when external_disk* is used
2018-03-07 22:35:02 +00:00
Oliver Smith ad5a0d4294
Make proprietary drivers optional (1/2): pmbootstrap changes (#1254)
Here are the changes necessary in pmbootstrap to make proprietary
software installed onto the device (firmware and userspace drivers)
optional (#756). To full close the issue, we need to apply this concept
to all device packages we already have in a follow-up PR.

Changes:
* New config file options nonfree_firmware and nonfree_userland, which
  we ask for during "pmbootstrap init" if there are non-free components
  for the selected device.
* We find that out by checking the APKBUILD's subpakages: The non-free
  packages are called $pkgname-nonfree-firmware and
  $pkgname-nonfree-userland.
* During "pmbootstrap init" we also show the pkgdesc of these
  subpackages. Parsing that is implemented in
  pmb.parse._apkbuild.subpkgdesc(). It was not implemented as part of
  the regular APKBUILD parsing, as this would need a change in the
  output format, and it is a lot *less* code if done like in this
  commit.
* pmb/parse/apkbuild.py was renamed to _apkbuild.py, and
  pmb/install/install.py to _install.py: needed to call the function in
  the usual way (e.g. pmb.parse.apkbuild()) but still being able to
  test the individual functions from these files in the test suite.
  We did the same thing for pmb/build/_package.py already.
* Install: New function get_nonfree_packages() returns the non-free
  packages that will be installed, based on the user's choice in
  "pmbootstrap init" and on the subpackages the device has.
* Added test cases and test data (APKBUILDs) for all new code,
  refactored test/test_questions.py to have multiple functions for
  testing the various questions / question types from
  "pmbootstrap init" instead of having it all in one big function.
  This allows to use another aport folder for testing the new
  non-free related questions in init.
2018-02-24 21:49:10 +00:00
Oliver Smith 2a9c1da46c
Bump version to 0.7.0 (previous one got tagged) 2018-02-20 19:53:50 +00:00
Alexander 3d35b45835 Check kernel config options based on the architecture (#1233)
The 'necessary_kconfig_options' dictionary in pmb/config/__init__.py
now has the different architectures (space separated) as the keys and
the dictionary, which matches kernel config options and their
expected value, as its value.
For that purpose, the 'check' function in pmb/parse/kconfig.py was
modified, so that it takes the architecture from the kconfig filename
and uses it to find the needed kernel config options.
Closes #1218.
2018-02-17 13:37:35 +00:00
Oliver Smith 57afbda3b9
Bump version to 0.6.0 2018-02-11 12:36:47 +01:00
Oliver Smith 77701ac484
mkinitfs: Fail on missing depends / better usability in general (#1133)
* Fail if mkbootimg/uboot-tools are not installed, but creating a
  boot.img file / u-boot legacy image was requested via deviceinfo
  (fixes #312)
* Fail if /boot/dt.img is missing, but we have a qcdt device
* Fail if the dtb file specified in deviceinfo does not exist
* Fail if mkbootimg etc. exit with error code
* Don't try to add the ext4 module into the initramfs. We always
  compile it into the kernel. Instead, kconfig_check makes sure it
  is enabled now. (fixes #1037)
* Add a note that modprobe warnings can be ignored mostly
2018-01-31 19:39:09 +00:00
Oliver Smith 3c59126bc1
Remove timestamp based rebuilds (#1174)
If you want to build a package without changing the version number,
please use `--force` from now on. For example:

    pmbootstrap build --force hello-world

Prior to this commit, changes were detected automatically (timestamp
based rebuilds). However, that feature does not work as expected with
the binary package repository we have now, and depending on how you use
git, it has never worked. Close #1167, close #1156, close #1023 and
close #985. This commit also mentions --force when a package is up to date,
but the user requested to build it.
2018-01-28 23:27:33 +00:00
Oliver Smith cd7280e1ee
Bump version (last version has been tagged) 2018-01-27 18:53:27 +01:00
Daniele Debernardi 8ec9eec080 Allow to build musl/binutils/gcc for x86 architecture (#1150) 2018-01-23 00:26:33 +00:00
Daniele Debernardi 0bc60138f3 Add musl/binutils/gcc for cross-compiling to x86_64 (#1130) 2018-01-18 21:48:04 +00:00
Mayeul Cantan 00aa65f2d0 pmbootstrap: add qcdt generation to the linux aportgen APKBUILDs (#1125)
* pmbootstrap: __config_.py - update the deviceinfo_attributes table

Add missing attributes:
 * "screen_width"
 * "screen_height"
 * "dev_touchscreen"
 * "dev_touchscreen_calibration"
 * "dev_keyboard"
 * "bootimg_qcdt"

Reorder the list to correspond to pmb/aportgen/device.py

Add a comment in the aforementioned file to avoid forgetting to update
this list.

Signed-off-by: Mayeul Cantan <mayeul.cantan@gmail.com>

* pmbootstrap: add qcdt generation to the linux aportgen APKBUILDs

This checks the next box in #688
When the device has bootimg_qcdt set to true, the following is done to
the linux APKBUILD:

 * Add dtbtool to makedepends
 * Call dtbTool during build() to generate dt.img
 * Add the generated dt.img in the package's boot/dt.img

Signed-off-by: Mayeul Cantan <mayeul.cantan@gmail.com>
2018-01-17 17:53:58 +00:00
Oliver Smith 12340fe5f6
Fix qemu-vexpress and qemu-aarch64 (#1029)
* Don't ask for the mesa driver when the Qemu arch is not the
  native arch and always use swrast in that case
* qemu-vexpress: use LTS kernel
* qemu-aarch64: use drm-backend for weston
2018-01-08 15:18:37 +00:00
Oliver Smith 7750c1dd40
Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
Oliver Smith 3198d51854
Update min. apk-tools-static to 2.9.0-r0
If pmbootstrap says your apk is outdated, just run...
	pmbootstrap zap -hc
...as it advises, to clear your http cache which contains the old
apk-tools-static.
2018-01-04 04:49:39 +01:00
Alex Roth 36a8971426 Add Teclast X80 Pro (EFI/x86_64 tablet) (#1050) 2017-12-29 02:02:29 +00:00
Oliver Smith f87a21a8a7
Fix broken UI and timezone selection
One comma was missing after the last `git rebase` I did before merging code.
2017-12-22 16:46:09 +00:00
Attila Szöllősi c6eb56c200 Rename deviceinfo variable flash_methods to flash_method (#1030)
* Rename deviceinfo variable flash_methods to flash_method
* Update pmb.config.deviceinfo_attributes / add sanity check
* Add test case that parses all deviceinfo files
2017-12-21 22:12:51 +00:00
Oliver Smith 567ac64e26
ccache: Fix for distcc cross-compiling / various improvements (#1026)
* ccache: Fix for distcc cross-compiling / various improvements

* Make ccache work when cross-compiling with distcc (fix #716)
* Allow to configure the ccache size in "pmbootstrap init"
* Moved ccache stats code from pmb/build/other.py to
  pmb/helpers/frontend.py
* Grouped job count, ccache size and timestamp based rebuilds
  together to "build options" and allow to skip them
* Sorted config options that had to be modified anyway
  alphabetically

* Improve comment in arch-bin-masquerade APKBUILD
2017-12-21 16:42:29 +00:00
Bart Ribbers fbb4704bdb Add qt5-qtbase with OpenGL ES2 enabled (#996)
Add qt5-qtbase with OpenGL ES2 enabled and adjust the
upstream compatibility test case.
* Test case: don't get the qt5-qtbase version from any APKINDEX, but
  only from Alpine's community APKINDEX
* Test case: If the pkgver is 9999, look at _pkgver
2017-12-11 20:24:30 +00:00