Commit Graph

147 Commits

Author SHA1 Message Date
Oliver Smith 216b3ef267
pmb.aportgen.device: modernize defaults
Change the defaults in the new device port wizard:

* arch: armv7 -> aarch64
  New devices are more likely to be aarch64.

* flash method: 0xffff -> none
  The only device that uses 0xffff is the N900, it's extremely unlikely
  that it will get used for a new port. Use the neutral "none" instead.

Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Clayton Craft <clayton@craftyguy.net>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230802172542.4861-2-ollieparanoid@postmarketos.org%3E
2023-08-06 20:05:45 +02:00
Pablo Correa Gómez 0489f7f40c
aportgen: device: rename modules to modules-initfs
The extra verbosity can be useful here.

See https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4169#note_1489955273
for more details

Fixes ad85c7bc17

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230728113116.31529-1-pabloyoyoista@postmarketos.org%3E
2023-07-30 19:10:51 +02:00
Pablo Correa Gómez ad85c7bc17
aportgen: replace deviceinfo_modules_initfs for modules file
So deviceinfo_modules_initfs is going to be phased out in pmaports!4169 as
a preparation for pmaports#1836. The implementation for the alternative of
using a modules file has already been merged in pmaports!4193, so stop
promoting the soon-to-be-phased-out deviceinfo variable, and instead use
the new and already-supported alternative.

Related: https://gitlab.com/postmarketOS/pmaports/-/issues/1836
Related: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4169
Related: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4193
Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230720164706.18936-1-pabloyoyoista@postmarketos.org%3E
2023-07-21 08:54:10 +02:00
Oliver Smith 099238525a
aportgen: use pmb.build.init_abuild_minimal
Use init_abuild_minimal instead of init to avoid installing gcc etc.
when generating checksums. This function has been added previously in
c6bcb0da ("Speed up 'pmbootstrap checksum'").

Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230613151807.568708-1-ollieparanoid@postmarketos.org%3E
2023-06-15 08:30:54 +02:00
Luca Weiss b8d5b9e4e5
treewide: rename _system to _rootfs in various places
A long time ago we renamed the flash_system action into flash_rootfs.
Since we still kept some variables around, it's finally time to clean
that up.

Keep backwards compatibility for now since we cannot update pmaports at
the same time since the new deviceinfo names won't be supported in older
pmbootstrap versions.

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230605220329.14328-3-luca@z3ntu.xyz%3E
2023-06-12 08:46:22 +02:00
Oliver Smith 0c81679677
aportgen/binutils: set pmOS bugurl
Alpine recently set the bugurl to the Alpine Linux issue tracker. When
rewriting the APKBUILD for cross compiling in postmarketOS, change it
to https://postmarketos.org/issues.

Related: fe73f3a28c
Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230522065220.2841-4-ollieparanoid@postmarketos.org%3E
2023-05-25 09:45:07 +02:00
Oliver Smith 6276b2dc68
aportgen/binutils: add more makedepends_host
Adjust to Alpine's APKBUILD where jansson-dev and zstd-dev are only set
if $BOOTSTRAP is empty. The APKBUILD parser in pmbootstrap doesn't
recognize this, and therefore doesn't install the depends unless we
replace makedepends_host= outside of the condition.

Related: fe73f3a28c
Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230522065220.2841-3-ollieparanoid@postmarketos.org%3E
2023-05-25 09:45:07 +02:00
Oliver Smith 84c1460e75
aportgen/binutils: order fields alphabetically
Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230522065220.2841-2-ollieparanoid@postmarketos.org%3E
2023-05-25 09:45:02 +02:00
Luca Weiss 7125412f07
pmb.aportgen.device: fix flash method autocomplete
In order to provide tab completion to the "Flash method" question we
need to provide pmb.helpers.cli.ask with the possible options. Do that.

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230403163311.927063-1-luca@z3ntu.xyz%3E
2023-04-04 09:13:04 +02:00
Jami Kettunen 90ae7f3a79
pmb.aportgen.linux: Depend on findutils
Without this on newer kernels the following is emitted during kernel
build (though it still appears to build a package fine):

  find: unrecognized: -printf
  BusyBox v1.36.0 (2023-03-03 16:36:18 UTC) multi-call binary.
  ...

See also: https://gitlab.com/postmarketOS/pmaports/-/issues/910

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C167855488981.11771.14125941910883500913-0@git.sr.ht%3E
2023-03-12 17:20:55 +01:00
Oliver Smith 9975d373b0
Bump copyright to 2023 2023-01-22 19:18:06 +01:00
Oliver Smith e8b0b4ba78
aportgen: don't fail if binary ver < APKBUILD ver
The typical workflow for upgrading cross/gcc-* is:

$ cd pmaports/cross
$ pmbootstrap aportgen gcc-*

Currently this is failing because the APKBUILD has been updated in
Alpine for gcc, but gcc has not been built for all arches yet. This
shouldn't prevent us from generating the proper updated APKBUILDs in
pmaports so just print a note and don't fail here.

I'm committing this directly to master as this currently breaks
test/test_aportgen.py::test_aportgen.
2022-11-02 21:09:28 +01:00
Oliver Smith 35784a5fd7
pmb.aportgen.device: no depend on mesa-dri-gallium (MR 2210)
Device packages shouldn't depend on it anymore, in order to end up with
a smaller installation for ui=none this package only gets pulled in by
postmarketos-base if mesa is installed.

Related: pmaports MR 3478
2022-10-12 08:24:53 +02:00
Oliver Smith 550b9b3466
pmb.aportgen.gcc: remove !tracedeps option
abuild traces shared library dependencies for binaries in built
packages, and adds all of them to depends. This is needed for the cross
gcc builds, as otherwise it will not add the isl dependency (currently
isl25).

With the crossdirect compilation method we mount the cross-gcc from the
native chroot in the foreign arch chroot. Due to the missing dependency,
isl was not installed in the native chroot, and so when attempting to
use that native cross gcc from the foreign arch chroot, it would try to
load the foreign arch isl instead of the native one. Resulting in lots
of the following errors (and of course not a working gcc):

  Error relocating /usr/lib/libisl.so.23: unsupported relocation type 1026

I had probably added '!tracedeps' because abuild complains about it
otherwise... but as noted in [1] these complaints are safe to ignore.

Keep !strip for now even though it's not in Alpine's APKBUILD. I've
tried to build without and the build fails with:
  strip: Unable to recognise the format of the input file `./usr/aarch64-alpine-linux-musl/lib/libgcc_s.so.1'

[1]: 0415ebf6f9
Related: pmaports issue 1732
2022-10-05 20:44:31 +02:00
Oliver Smith b262609199
pmb.aportgen.gcc: add subpkg libstdc++-dev-$arch
Add the subpackage, because g++-$arch depends on it since
12.1.1_git20220630-r6. This fix was already applied to pmaports, thanks
to ungeskriptet! Adjust the aportgen code to make sure this is added in
the future as well.

Related: pmaports MR 3464
Related: f1044b1dae
2022-09-30 22:02:31 +02:00
Oliver Smith 22e0f64095
pmb.aportgen.gcc: set libgcc=false (MR 2203)
Do not build the foreign arch libgcc. We are using the one provided by
Alpine's binary repository instead, and when building it here and trying
to use it, we actually run into a conflict.

I tried setting BOOTSTRAP="nolibc" first since there is already logic to
then disable libgcc in the APKBUILD. But that also disables g++ which we
do want to build, so we can't use this.

Fixes: issue 2168
2022-09-13 23:42:15 -07:00
Oliver Smith 4c7d2459f5
pmb.aportgen.gcc: remove isl from depends (MR 2203)
Remove it from depends, as the package has been removed in Alpine and
since quite some time we shouldn't have depended on it anyway.

Related: issue 2167
2022-09-13 23:42:15 -07:00
Oliver Smith b41e4a418f
aportgen binutils: modernize (MR 2199)
Set CTARGET and CTARGET_ARCH on top of the generated APKBUILD and use
the existing code in the APKBUILD for build(), package(), makedepends,
subpackages. This is now possible, because the pmbootstrap parser for
APKBUILDs has been improved a lot since this was originally written and
because the Alpine APKBUILD does everything that was hacked in here,
like removing man, info directories and bfd-plugins if doing a cross
build.

This is now very similar to bootstrapping binutils for another
architecture via scripts/bootstrap.sh in aports.git.

Most importantly this sets --disable-gprofng, which fails to build
against musl and is the reason why our cross/binutils-* packages
generated from binutils 2.39.x didn't build anymore.

Related: https://git.alpinelinux.org/aports/tree/main/binutils/APKBUILD
Related: https://sourceware.org/bugzilla/show_bug.cgi?id=29477
2022-08-24 08:38:49 +02:00
Salvatore Stella 3567b7c123
Fix wrong output of pmbootstrap bootimg_analyze (MR 2198) 2022-08-21 14:25:11 +02:00
Jami Kettunen 5b3cd7a7a6
pmb.aportgen.linux: Install DTBs on header v2 (MR 2194)
A single DTB is required for "mkbootimg --dtb ..."
2022-07-18 14:49:38 -07:00
Jami Kettunen de890c83e7
pmb.aportgen.device: Generate appropriate header v2 deviceinfo (MR 2194)
Here's an example of the properties this could generate:

  deviceinfo_header_version="2"
  deviceinfo_append_dtb="false"
  deviceinfo_flash_offset_dtb="0x0bc08000"
2022-07-18 14:49:33 -07:00
Oliver Smith 6f6a3b0408
Happy new year 2022! 2022-01-02 22:39:14 +01:00
BO41 99bed38272
pmb.parse.apkbuild: remove unused args argument (MR 2136) 2021-11-27 14:13:33 +01:00
bo41 caf7973e24
args.arch_native: remove (MR 2130)
Replace "args.arch_native" with the direct function call in order to
avoid passing "args" to all functions. This is a step to get rid of this
args-passed-to-all-functions pattern in pmbootstrap.
2021-10-24 14:34:30 +02:00
BO41 944f539dd6
args.logfd: remove (MR 2114)
Replace "args.logfd" with "pmb.helpers.logging.logfd" in order to avoid
passing "args" to all functions that only use it to write to logfd. This
is the first step to get rid of this args-passed-to-all-functions
pattern in pmbootstrap.
2021-10-10 16:59:17 +02:00
Alexey Min 5761a29f07
pmb.aportgen.binutils: fix for new binutils file conflict (MR 2116)
Newly generated binutils package has file conflicsts with
non-cross binutils.

  ERROR: binutils-2.37-r3: trying to overwrite usr/lib/bfd-plugins/libdep.so
         owned by binutils-aarch64-2.37-r3.

Fix the generator to produce package that does not include these plugins.
2021-09-29 23:41:58 +02:00
Newbyte 2d23849aa3
pmb, test: remove redundant commas (MR 2115) 2021-09-26 17:58:40 +02:00
BO41 77d39ecdf1
lint: enforce max line length (MR 2097) 2021-09-10 03:18:27 +02:00
Henrik Grimler 51bfdc9784
pmb.aportgen: prefix $_outdir to dtbTool-sprd -p arg (MR 2107)
The -p arg is suppose to point to the folder where the dtc program
resides (if it is not found in PATH). If we use an _outdir, which the
template currently does, then the arg needs to be -p
$_outdir/scripts/dtc/, and not -p scripts/dtc/, as scripts/dtc/ only
contains the dtc source code.
2021-09-05 15:56:52 +02:00
Henrik Grimler c524926295
pmb.aportgen: rm -p scripts/dtc arg from dtbTool cmd (MR 2107)
The python variant of dtbTool, that we currently use, does not use
this arg as it does not run dtc in a shell.  I suppose the argument
was added only for compatibility with other dtbtools.
2021-09-05 15:54:43 +02:00
Alexey Min a6c63f9580
pmb.aportgen.gcc: use more f-strings (MR 2092) 2021-08-10 01:18:22 +03:00
afeuerstein 83c4f142e2
pmb.aportgen.gcc: sync makedepends of gcc aportgen to upstream (MR 2092)
Remove paxmark dep. Follow up to
1c6ba9f907,
which happened 5 months ago.

Fixup testdata too.
2021-08-10 01:16:54 +03:00
Anri Dellal d764b0de58
bootimg_analyze: Add support for boot header version 3 (MR 2073) 2021-07-07 04:43:24 +03:00
Luca Weiss b18281ab26
pmb.aportgen: fix architecture autocomplete (MR 2054)
Previously hitting the tab key wouldn't actually complete the
architecture field.
2021-06-13 15:05:27 +03:00
Luca Weiss edf43916a5
pmb.aportgen: don't suggest armhf (MR 2054)
New ports shouldn't use that architecture; and devices whose CPU only
supports armhf aren't really useful for anything anyways.

This will also make the suggested/default architecture be armv7
(architectures[0]).
2021-06-13 15:05:27 +03:00
Alexey Min 4a8fac6c6e
pmb.aportgen: use correct arch for gcc aportgen (MR 2068)
Previously it always used native (x84_64) arch for apkindex
version check.

As pmb.aportgen.core.alpine_apkindex_path() already has arch
parameter, use it to look up correct APKINDEX.

Also fixup test.
2021-06-13 02:17:28 +03:00
Caio Fontes fb98ad5329
enforce E501 partially in pmb/aportgen (MR 2058) 2021-06-06 19:21:31 +02:00
Oliver Smith 1481e69981
pmb.aportgen.binutils: adjust to subpackages in if (MR 2048)
Adjust the code so subpackages="" stays empty even with the latest
version of Alpine's APKBUILD.
2021-05-19 22:15:36 +02:00
nybbled 5f485b8ad3
pmb.aportgen: put dependencies on separate lines (MR 2024)
Generate APKBUILDs with dependencies sorted and placed one per line.
The dependency lists changed are
 - depends in pmb/aportgen/device.py
 - makedepends in pmb/aportgen/linux.py

Sort dependency lists in test/test_aportgen_device_wizard.py
assertions.
2021-02-10 00:08:22 +01:00
Oliver Smith 1c791da482
treewide: bump copyright to 2021 2021-01-07 23:30:47 +01:00
HenriDellal 2d496d983e
pmb/aportgen/linux.py: Fix bad substitution error (MR 1999) 2020-12-02 21:32:43 +03:00
HenriDellal 6793612a7e
pmb/aportgen/linux.py: add different QCDT implementations (MR 1992)
Adds QCDT templates for Spreadtrum and Exynos SoCs
When "pmbootstrap init" is executed, after the boot image analysis,
if the device is QCDT, then the user is asked about the SoC vendor.
Example:
[HH:MM:SS] SoC vendor (spreadtrum/exynos/other) [other]: exynos
After that, the corresponding template is picked.
2020-11-23 11:48:19 +01:00
Johannes Marbach e2d4678fb7
pmb.aportgen.device Reformat to 79 characters per line (MR 1993) 2020-11-23 11:30:56 +01:00
Oliver Smith 77a5dd1910
pmb.aportgen.linux: add gcc10 extern YYLOC patch (MR 1987)
Most downstream kernels need this patch to build with GCC-10, so add it
by default in the linux aport generator.
2020-11-10 12:06:36 +01:00
Oliver Smith 0dfe489b78
pmbootstrap aportgen: replace arch=all with native (MR 1965)
Packages like binutils-*, busybox-static-*, gcc-*, grub-efi-*, musl-*
are only needed for the native architecture during cross compilation.
Don't bother with trying to build them for other arches to save time and
to avoid getting stuck frequently at "armv7/binutils-aarch64" etc.

A few people like to use pmbootstrap on aarch64 hosts (e.g. PineBook
Pro), so let's make it available for aarch64 again when we can build
aarch64 packages natively in CI and bpo. (They do get stuck there right
now, because of qemu user emulation.)

Related: https://gitlab.com/postmarketOS/build.postmarketos.org/-/issues/75
2020-09-21 17:48:34 +02:00
Oliver Smith 5b55abd4d2
pmbootstrap aportgen: don't use CDN alpine mirror (MR 1963)
Use a deterministic mirror URL instead of CDN for aportgen. Otherwise we
may generate a pmaport that wraps an apk from Alpine (e.g. musl-armv7)
locally with one up-to-date mirror given by the CDN. But then the build
will fail if CDN picks an outdated mirror for CI or BPO.
2020-09-18 03:20:25 +03:00
Luca Weiss 86d61b8012
pmb.parse.bootimg: detect mediatek header (MR 1955)
Some Mediatek devices have a special 512-byte header around the zImage
which must be generated so the device boots.

Support for that exists for a while in postmarketOS but detection was
missing. Add that.
2020-08-21 18:33:30 +02:00
Oliver Smith 8a02187a1a
pmb/aportgen/grub_efi.py: fix distfile collisions (MR 1950)
Same fix as MR 1947, but for grub_efi.py instead of musl.py. While at
it, order the imports alphabetically.
2020-06-24 21:08:44 +03:00
Oliver Smith 460d2c0eb4
pmb/aportgen/grub_efi.py: alpine mirrordir (MR 1950)
On branch stable, we would use Alpine's mirrordir "v3.11" for example.
2020-06-24 21:08:44 +03:00
Oliver Smith a74aafb978
pmb/aportgen/grub_efi.py: pass apkbuild-lint (MR 1950) 2020-06-24 21:08:44 +03:00