Skip to content

Commit 4dc2a98

Browse files
OldManYellsAtCloudkraj
authored andcommitted
firefox: drop nss and nspr recipes, cleanup
- add "--disable-sandbox" config to arm arch - this somehow disappeared during history squashing - remove vendored nss and nspr recipes, and make Firefox's vendored nss work with ARM CPUs without crypto engine - CI: clone meta-firefox-test repo with direct url, otherwise it would point to a non-existing repo when using variables - CI: set a new FF specific runner name - CI: remove the environment from the config, it is not that useful with matrix strategy, nor with running it in a separate repo
1 parent bb86629 commit 4dc2a98

25 files changed

+98
-1278
lines changed

.github/workflows/yocto_matrix.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ jobs:
2323
exclude:
2424
- yocto_version: kirkstone
2525
arch: riscv
26-
runs-on: [self-hosted, desktop]
26+
runs-on: [self-hosted, firefox]
2727
container:
2828
image: skandigraun/yocto:latest
2929
volumes:
3030
- yocto:/yocto
31-
environment: ff-build-env
3231
steps:
3332
- run: |
3433
mkdir -p /yocto/${{ matrix.yocto_version }}
@@ -37,10 +36,10 @@ jobs:
3736
git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY
3837
git -C meta-browser checkout $GITHUB_HEAD_REF
3938
# clone the test repo
40-
git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY_OWNER/meta-firefox-test
39+
git clone https://github.com/OldManYellsAtCloud/meta-firefox-test.git
4140
./meta-firefox-test/scripts/build.sh ${{ matrix.yocto_version}} ${{ matrix.arch }} ${{ matrix.ff_version }} ${{ matrix.libc_flavour}}
4241
test:
43-
runs-on: [self-hosted, desktop]
42+
runs-on: [self-hosted, firefox]
4443
needs: build
4544
strategy:
4645
matrix:

meta-firefox/classes/mozilla.bbclass

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ EXTRA_OECONF = "--target=${TARGET_SYS} --host=${BUILD_SYS} \
88
--prefix=${prefix} \
99
--libdir=${libdir}"
1010

11-
EXTRA_OECONF:append:arm = " --disable-elf-hack"
12-
EXTRA_OECONF:append:x86 = " --disable-elf-hack"
13-
EXTRA_OECONF:append:x86-64 = " --disable-elf-hack"
11+
EXTRA_OECONF:append:arm = " --disable-sandbox --disable-elf-hack "
12+
EXTRA_OECONF:append:aarch64 = " --disable-elf-hack "
13+
EXTRA_OECONF:append:x86-64 = " --disable-elf-hack "
1414

1515
EXTRA_OECONF:append:libc-musl = " --disable-jemalloc "
1616
EXTRA_OECONF:append:libc-musl:x86-64 = " --disable-sandbox "

meta-firefox/recipes-browser/firefox/firefox.inc

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ DEPENDS:x86:append = " nasm-native "
1010
RDEPENDS:${PN} = "libva libpci"
1111
RDEPENDS:${PN}-dev = "dbus"
1212

13-
# Use system's nss in case the CPU has no native crypto support (e.g. armv7)
14-
# On dunfell and kirkstone use the vendored version, as they contain too old version.
15-
# This is only for ARM arch: Firefox's nss explicitly includes code using hw-crypto support for this arch.
16-
ARM_AND_NO_HW_CRYPTO = "${@ True if 'crypto' not in d.getVar('TUNE_FEATURES') and \
13+
# Disable hw crypto support in freebl/nss in case the CPU has no native crypto support (e.g. armv7)
14+
EXTRA_OECONF:append = "${@ ' --nss-disable-arm-crypto=1 ' if 'crypto' not in d.getVar('TUNE_FEATURES') and \
1715
( 'arm' in d.getVar('TARGET_ARCH') or \
1816
'aarch64' in d.getVar('TARGET_ARCH') \
19-
) else False }"
17+
) else '' }"
2018

2119
LICENSE = "MPL-2.0"
2220

@@ -49,6 +47,7 @@ SRC_URI += "https://ftp.mozilla.org/pub/firefox/releases/${PV}/source/firefox-${
4947
file://0004-Fix-compiling-with-enable-openmax-config.patch \
5048
file://0001-rust-don-t-abort-on-panic.patch \
5149
file://0001-add-musl-support.patch \
50+
file://0001-Add-option-to-disable-arm-hw-crypto-engine.patch \
5251
file://debian-hacks/Add-another-preferences-directory-for-applications-p.patch \
5352
file://debian-hacks/Avoid-using-vmrs-vmsr-on-armel.patch \
5453
file://debian-hacks/Avoid-wrong-sessionstore-data-to-keep-windows-out-of.patch \
@@ -137,8 +136,6 @@ PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "alsa", "alsa", "", d
137136
rust-simd \
138137
"
139138

140-
PACKAGECONFIG:append = "${@ ' system-nss system-nspr ' if ${ARM_AND_NO_HW_CRYPTO} else '' }"
141-
142139
PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
143140
PACKAGECONFIG[wayland] = "--enable-default-toolkit=cairo-gtk3-wayland,--enable-default-toolkit=cairo-gtk3,virtual/egl,"
144141
PACKAGECONFIG[gpu] = ",,,"
@@ -149,10 +146,8 @@ PACKAGECONFIG[forbid-multiple-compositors] = ",,,"
149146
PACKAGECONFIG[disable-sandboxed-libraries] = "--without-wasm-sandboxed-libraries,,,"
150147
PACKAGECONFIG[rust-simd] = "--enable-rust-simd,,"
151148

152-
# nspr and nss dependencies are handled separately, due to requiring
153-
# different versions depending on Yocto version and CPU capabilities.
154-
PACKAGECONFIG[system-nspr] = "--with-system-nspr,,nspr-4.35,nspr-4.35"
155-
PACKAGECONFIG[system-nss] = "--with-system-nss,,nss-3.108,nss-3.108"
149+
PACKAGECONFIG[system-nspr] = "--with-system-nspr,,nspr,nspr"
150+
PACKAGECONFIG[system-nss] = "--with-system-nss,,nss,nss"
156151
PACKAGECONFIG[system-ffi] = "--with-system-ffi,,libffi,libffi"
157152
PACKAGECONFIG[system-icu] = "--with-system-icu,,icu,icu"
158153
PACKAGECONFIG[system-zlib] = "--with-system-zlib,,zlib,zlib"
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
From 0a3789949ffb04829eee00ebe28c785253ce7a96 Mon Sep 17 00:00:00 2001
2+
From: Gyorgy Sarvari <skandigraun@gmail.com>
3+
Date: Sun, 30 Mar 2025 14:14:06 +0200
4+
Subject: [PATCH] Add option to disable arm hw crypto engine
5+
6+
On some older ARM SoC's there is no hardware support for cryptography.
7+
However the nss librray in Firefox expect this support to be present,
8+
which fails the build when this is not the case.
9+
10+
To avoid this, introduce a new option that allows disabling building
11+
for ARM crypto engine when it is required.
12+
13+
Upstream-Status: Pending
14+
---
15+
moz.configure | 12 ++++++++++++
16+
security/moz.build | 3 +++
17+
security/nss/coreconf/config.gypi | 6 +++---
18+
3 files changed, 18 insertions(+), 3 deletions(-)
19+
20+
diff --git a/moz.configure b/moz.configure
21+
index 804b9a3..fd13950 100755
22+
--- a/moz.configure
23+
+++ b/moz.configure
24+
@@ -517,6 +517,18 @@ def build_backend_defaults(
25+
return tuple(all_backends) or None
26+
27+
28+
+option(
29+
+ "--nss-disable-arm-crypto",
30+
+ default="0",
31+
+ help="Build NSS libraries with HW crypto engine for ARM"
32+
+)
33+
+
34+
+@depends("--nss-disable-arm-crypto")
35+
+def nss_disable_arm_crypto(disable):
36+
+ return disable
37+
+
38+
+set_config("DISABLE_NSS_ARM_HW_CRYPTO", nss_disable_arm_crypto)
39+
+
40+
option(
41+
"--build-backends",
42+
nargs="+",
43+
diff --git a/security/moz.build b/security/moz.build
44+
index b30e9c2..9c122e2 100644
45+
--- a/security/moz.build
46+
+++ b/security/moz.build
47+
@@ -107,6 +107,9 @@ gyp_vars["enable_draft_hpke"] = 1
48+
# build system ignores.
49+
gyp_vars["iphone_deployment_target"] = "doesntmatter"
50+
51+
+# When set to 1, this disables building with arm hw crypto engine
52+
+gyp_vars["arm_hw_crypto"] = CONFIG["DISABLE_NSS_ARM_HW_CRYPTO"]
53+
+
54+
# Clang can build NSS with its integrated assembler since version 9.
55+
if (
56+
CONFIG["TARGET_CPU"] == "x86_64"
57+
diff --git a/security/nss/coreconf/config.gypi b/security/nss/coreconf/config.gypi
58+
index baf4256..e6e7160 100644
59+
--- a/security/nss/coreconf/config.gypi
60+
+++ b/security/nss/coreconf/config.gypi
61+
@@ -101,9 +101,9 @@
62+
'cc_is_gcc%': '<(cc_is_gcc)',
63+
'cc_use_gnu_ld%': '<(cc_use_gnu_ld)',
64+
# Some defaults
65+
- 'disable_arm_hw_aes%': 0,
66+
- 'disable_arm_hw_sha1%': 0,
67+
- 'disable_arm_hw_sha2%': 0,
68+
+ 'disable_arm_hw_aes%': '<(arm_hw_crypto)',
69+
+ 'disable_arm_hw_sha1%': '<(arm_hw_crypto)',
70+
+ 'disable_arm_hw_sha2%': '<(arm_hw_crypto)',
71+
'disable_intel_hw_sha%': 0,
72+
'disable_tests%': 0,
73+
'disable_chachapoly%': 0,
74+
diff --git a/security/nss/lib/freebl/freebl.gyp b/security/nss/lib/freebl/freebl.gyp
75+
index 14f213c..09e29ac 100644
76+
--- a/security/nss/lib/freebl/freebl.gyp
77+
+++ b/security/nss/lib/freebl/freebl.gyp
78+
@@ -606,7 +606,7 @@
79+
'dependencies': [
80+
'gcm-aes-x86_c_lib',
81+
]
82+
- }, 'target_arch=="arm" or target_arch=="arm64" or target_arch=="aarch64"', {
83+
+ }, '(disable_arm_hw_aes==0 or disable_arm_hw_sha1==0 or disable_arm_hw_sha2==0) and (target_arch=="arm" or target_arch=="arm64" or target_arch=="aarch64")', {
84+
'dependencies': [
85+
'armv8_c_lib',
86+
],

meta-firefox/recipes-devtools/nspr/nspr-4.35.bb

Lines changed: 0 additions & 206 deletions
This file was deleted.

0 commit comments

Comments
 (0)