commit 31810c0603c3ba7f97c79096f3c637fdabc6b8b8 Author: Şahan Yılmaz Date: Wed Apr 23 04:51:44 2025 +0300 fix diff --git a/main/broadcom-wl/APKBUILD b/main/broadcom-wl/APKBUILD new file mode 100644 index 0000000..1329791 --- /dev/null +++ b/main/broadcom-wl/APKBUILD @@ -0,0 +1,76 @@ +# Contributor: NeYurii +# Maintainer: NeYurii +pkgname=broadcom-wl +_modname=wl +pkgver=6.30.223.271 +pkgrel=0 +pkgdesc="Broadcom 802.11 Linux STA wireless driver" +url="https://www.broadcom.com/site-search?filters[pages][content_type][values][]=Downloads&q=802.11%20linux%20sta%20wireless%20driver" +arch="x86 x86_64" +license="custom" +depends="akms" +source=" +https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz +patches/001-null-pointer-fix.patch +patches/002-rdtscl.patch +patches/003-linux47.patch +patches/004-linux48.patch +patches/005-debian-fix-kernel-warnings.patch +patches/006-linux411.patch +patches/007-linux412.patch +patches/008-linux415.patch +patches/009-fix_mac_profile_discrepancy.patch +patches/010-linux56.patch +patches/011-linux59.patch +patches/012-linux517.patch +patches/013-linux518.patch +patches/014-linux414.patch +patches/015-linux600.patch +patches/016-linux601.patch +patches/017-linux612.patch +patches/018-linux613.patch +patches/019-linux614.patch" +builddir="$srcdir" +options="!check" + +prepare() { + default_prepare + sed -i -e '/BRCM_WLAN_IFNAME/s/eth/wlan/' src/wl/sys/wl_linux.c + sed -i -e "/EXTRA_LDFLAGS/s|\$(src)/lib|/usr/lib|;/GE_49 :=/s|:= .*|:= 1|" Makefile + + cat >AKMBUILD <<-EOF +modname=wl +modver=6.30.223.271 +built_modules=wl.ko + EOF +} + +package() { + local destdir="$pkgdir/usr/src/$_modname-$pkgver" + install -D -m644 -t "$destdir" Makefile AKMBUILD + install -D -m644 "lib/wlc_hybrid.o_shipped" "$pkgdir/usr/lib/wlc_hybrid.o_shipped" + cp -a src "$destdir" +} + +sha512sums=" +6855781f7c69a9aecb9461932423688964879d5a4df571f01ae7adaa7bf21a410bef839605d555afb6c8f4eec92fe8510af6cb120930095617ff6cdcccedaf17 hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz +4403cad0360b01f8e88faccb77e6239865e9cc2b68dac62896153ab37957f1e73e5e4c95d3e81dac334106a2cd4ef0784955a5fefd8abc6e793a68f182bbffe4 001-null-pointer-fix.patch +b483a4fd5fbb5a4697365b6ddcd8034b4d90ddee9bf2aecf003b0fd6838a708d3e84be33b08acdbe165d440480da25fdf0dfff0d2fe12fa2c5271c51d6ac74c0 002-rdtscl.patch +f61ecfb6b8c5a377c7a4da7549c9ec75677782fa2f97e64de0df1259e0ec3b993cfa3eaa4ff50331703ee18ef28f2af0d09839dd3b63ed994e6b29cbfe8ed73f 003-linux47.patch +e5959921b6f0cd5d61d7ed568f549b0920f394458c28257c05064b89d7067ce11c8e44ed0e5a48a65bd041c6193d9ae2d02fca2f5efbfb787d3f9001786a4578 004-linux48.patch +6209a0a5a46a3efcede3cb1e263467173153d779b6267ba4c20f46421a9abd8743a7068527ace350a3da3ef3046b0399e09b37aba917fabe020c8c2600b60fdf 005-debian-fix-kernel-warnings.patch +b7db17e30731a9cbc940b83f7b62f059529cff6c134e47e2176cd7c6fcd8d028334ed4fe1fdce7cf1aef87590f9664b463383ae3302a6e2aabe1baa79fbc5c95 006-linux411.patch +d4acd891023ff8d4b9308afdd55c4e971cdf7773570c8e3a545400ed9e414eeca5016ebc8a530002e7858fd44f1fd5b0ae70c0d0a3cdbbffd5bd9abb702b2cde 007-linux412.patch +2fb5c3eebd48b6099fb87a9fd92545c17b2abf318b040a434c1b0bdd75a7a682b6e7ec9f80245c198f1c306bbaef35a2488123c5ba8764d5a83eb18132c0857b 008-linux415.patch +97d34398d18ac9a7943233c12e01cf7006bf0648938303100932cabf5000c346f1a852978e3c8c48bb6e8652177e625ce1190047d580624319e680a13802ce92 009-fix_mac_profile_discrepancy.patch +8fb320c1272246c91fdd99cade2fb67a6ecd924a132c1b9432fa1ff0338444700451ffc6a1cb35e07188c58c5bd1ccaf59ebf014c49f44cb6ba33d1ec732859d 010-linux56.patch +b9a0193ab604da92c99051e2a4fd91e43c3b6aeea7dbda15635b43eabd35b414e197bf5f25ac0d4ec905a1cb75abc15f165428470bc788dbefd73f178d165099 011-linux59.patch +ec34a2800d7a70a7a1ff8a96ba87c2327f68066addf5adc9f60ba303cfda9cee39159f110013f075e357988f92efe802010e9c1d7884a5dfb1908df1489bd608 012-linux517.patch +b815a4ff9289d81ddbe7f76553b092df19ee137438c9e33811c3a8b15e8a3896763715975b42391b4edfb60cfb0db46b71f4fee0f33a7b07f8d45cc4608d3faa 013-linux518.patch +30207d8872ee8925a7c7412184e3b4fd6935f8017fb46e1173aca77333c99fb4316ef1511a83e345593c369210d4cbf976eea53995e229b4d856d97662c98961 014-linux414.patch +21cf9b0b01ad4b30fa8541638e9a8428c8c68c89992b7e15c19f8526e8df6f8c5ff20de5ae2759b36fead07deacd1805749a9ed82611d15fb75dc94812e4941e 015-linux600.patch +22a5071dddfe14b7add661f670047948b20110e7b3adf8474d1a2cc5a344b587352c2b70338b26500ec242ef117a2a7836e7d0ef352fa4dfaebfcfb3c129b0fa 016-linux601.patch +3b57d064323e5602ac5e94538d3a810a72dd4185a09cf6be772e787ba968052d2bd43e5946689312cf8df934d72c9e7f495476d5851e106f3dcb2b525be8f3a1 017-linux612.patch +3caf2049555f39f71270d768d0b25d0cc8177f50a649a915284467f87de1d74926ecff158e211f3c05ea7e3107ab4047ec005786cf3bb88e856431e537974ab5 018-linux613.patch +db8f677138ed9b25d2c8cc8f66dff340a63fdef5e6d8a325bc684bda80053b68441b84b2e8b148aff06de51dc357c9d2dcf6ac11d40814d0914c393a24e93d62 019-linux614.patch +" diff --git a/main/broadcom-wl/patches/001-null-pointer-fix.patch b/main/broadcom-wl/patches/001-null-pointer-fix.patch new file mode 100644 index 0000000..adef19f --- /dev/null +++ b/main/broadcom-wl/patches/001-null-pointer-fix.patch @@ -0,0 +1,27 @@ +Description: Fixing null pointer crash + +Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773713 +Bug-Ubuntu: https://launchpad.net/bugs/1415880 +Last-Update: 2015-08-18 + +--- + src/wl/sys/wl_linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c +index 860b935..295156f 100644 +--- a/src/wl/sys/wl_linux.c ++++ b/src/wl/sys/wl_linux.c +@@ -2157,8 +2157,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev) + wlif = WL_DEV_IF(dev); + wl = WL_INFO(dev); + ++ skb->prev = NULL; + if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) { +- skb->prev = NULL; + + TXQ_LOCK(wl); + +-- +1.9.1 + diff --git a/main/broadcom-wl/patches/002-rdtscl.patch b/main/broadcom-wl/patches/002-rdtscl.patch new file mode 100644 index 0000000..1b9862c --- /dev/null +++ b/main/broadcom-wl/patches/002-rdtscl.patch @@ -0,0 +1,22 @@ +Since Linux 4.3, rdtscl() is no longer available and native_read_tsc() +is renamed to rdtsc(). Move the macro contents in-line and call the +new function. References: + +https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=fe47ae6e1a5005b2e82f7eab57b5c3820453293a +https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=4ea1636b04dbd66536fa387bae2eea463efc705b + +diff -ru a/src/shared/linux_osl.c b/src/shared/linux_osl.c +--- a/src/shared/linux_osl.c 2015-09-19 01:47:15.000000000 +0300 ++++ b/src/shared/linux_osl.c 2015-11-21 15:20:30.585902518 +0200 +@@ -932,7 +932,11 @@ + uint cycles; + + #if defined(__i386__) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) ++ cycles = (u32)rdtsc(); ++#else + rdtscl(cycles); ++#endif + #else + cycles = 0; + #endif diff --git a/main/broadcom-wl/patches/003-linux47.patch b/main/broadcom-wl/patches/003-linux47.patch new file mode 100644 index 0000000..566680a --- /dev/null +++ b/main/broadcom-wl/patches/003-linux47.patch @@ -0,0 +1,109 @@ +Since Linux 4.7, the enum ieee80211_band is no longer used + +This shall cause no problem's since both enums ieee80211_band +and nl80211_band were added in the same commit: +https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c + +This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_* + +Reference: +https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3 + +--- a/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:57:36.159340297 -0500 ++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:58:18.442323435 -0500 +@@ -236,7 +236,7 @@ + #endif + + #define CHAN2G(_channel, _freq, _flags) { \ +- .band = IEEE80211_BAND_2GHZ, \ ++ .band = NL80211_BAND_2GHZ, \ + .center_freq = (_freq), \ + .hw_value = (_channel), \ + .flags = (_flags), \ +@@ -245,7 +245,7 @@ + } + + #define CHAN5G(_channel, _flags) { \ +- .band = IEEE80211_BAND_5GHZ, \ ++ .band = NL80211_BAND_5GHZ, \ + .center_freq = 5000 + (5 * (_channel)), \ + .hw_value = (_channel), \ + .flags = (_flags), \ +@@ -379,7 +379,7 @@ + }; + + static struct ieee80211_supported_band __wl_band_2ghz = { +- .band = IEEE80211_BAND_2GHZ, ++ .band = NL80211_BAND_2GHZ, + .channels = __wl_2ghz_channels, + .n_channels = ARRAY_SIZE(__wl_2ghz_channels), + .bitrates = wl_g_rates, +@@ -387,7 +387,7 @@ + }; + + static struct ieee80211_supported_band __wl_band_5ghz_a = { +- .band = IEEE80211_BAND_5GHZ, ++ .band = NL80211_BAND_5GHZ, + .channels = __wl_5ghz_a_channels, + .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels), + .bitrates = wl_a_rates, +@@ -395,7 +395,7 @@ + }; + + static struct ieee80211_supported_band __wl_band_5ghz_n = { +- .band = IEEE80211_BAND_5GHZ, ++ .band = NL80211_BAND_5GHZ, + .channels = __wl_5ghz_n_channels, + .n_channels = ARRAY_SIZE(__wl_5ghz_n_channels), + .bitrates = wl_a_rates, +@@ -1876,8 +1876,8 @@ + wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX; + #endif + wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); +- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; +- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a; ++ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz; ++ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a; + wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; + wdev->wiphy->cipher_suites = __wl_cipher_suites; + wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); +@@ -2000,7 +2000,7 @@ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) + freq = ieee80211_channel_to_frequency(notif_bss_info->channel, + (notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ? +- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ); ++ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ); + #else + freq = ieee80211_channel_to_frequency(notif_bss_info->channel); + #endif +@@ -2116,7 +2116,7 @@ + return err; + } + chan = wf_chspec_ctlchan(chanspec); +- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; ++ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; + freq = ieee80211_channel_to_frequency(chan, band); + channel = ieee80211_get_channel(wiphy, freq); + cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL); +@@ -2250,10 +2250,10 @@ + join_params->params.chanspec_list[0] = + ieee80211_frequency_to_channel(chan->center_freq); + +- if (chan->band == IEEE80211_BAND_2GHZ) { ++ if (chan->band == NL80211_BAND_2GHZ) { + chanspec |= WL_CHANSPEC_BAND_2G; + } +- else if (chan->band == IEEE80211_BAND_5GHZ) { ++ else if (chan->band == NL80211_BAND_5GHZ) { + chanspec |= WL_CHANSPEC_BAND_5G; + } + else { +@@ -2885,7 +2885,7 @@ + + if (phy == 'n' || phy == 'a' || phy == 'v') { + wiphy = wl_to_wiphy(wl); +- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; ++ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n; + } + + return err; diff --git a/main/broadcom-wl/patches/004-linux48.patch b/main/broadcom-wl/patches/004-linux48.patch new file mode 100644 index 0000000..20e8a9a --- /dev/null +++ b/main/broadcom-wl/patches/004-linux48.patch @@ -0,0 +1,64 @@ +From d3f93542326a06d920c6eb89b703384290d37b8b Mon Sep 17 00:00:00 2001 +From: Alberto Milone +Date: Fri, 2 Sep 2016 17:35:34 +0200 +Subject: [PATCH 1/1] Add support for Linux 4.8 + +Orginal author: Krzysztof Kolasa +--- + src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c +index 2fc71fe..ec5e472 100644 +--- a/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/src/wl/sys/wl_cfg80211_hybrid.c +@@ -2388,8 +2388,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev, + s32 err = 0; + + if (wl->scan_request) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ struct cfg80211_scan_info info = { ++ .aborted = true, ++ }; ++ WL_DBG(("%s: Aborting scan\n", __FUNCTION__)); ++ cfg80211_scan_done(wl->scan_request, &info); ++#else + WL_DBG(("%s: Aborting scan\n", __FUNCTION__)); + cfg80211_scan_done(wl->scan_request, true); ++#endif + wl->scan_request = NULL; + } + +@@ -2490,7 +2498,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev, + + scan_done_out: + if (wl->scan_request) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ struct cfg80211_scan_info info = { ++ .aborted = false, ++ }; ++ cfg80211_scan_done(wl->scan_request, &info); ++#else + cfg80211_scan_done(wl->scan_request, false); ++#endif + wl->scan_request = NULL; + } + rtnl_unlock(); +@@ -2909,7 +2924,14 @@ s32 wl_cfg80211_down(struct net_device *ndev) + s32 err = 0; + + if (wl->scan_request) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ struct cfg80211_scan_info info = { ++ .aborted = true, ++ }; ++ cfg80211_scan_done(wl->scan_request, &info); ++#else + cfg80211_scan_done(wl->scan_request, true); ++#endif + wl->scan_request = NULL; + } + +-- +2.7.4 + diff --git a/main/broadcom-wl/patches/005-debian-fix-kernel-warnings.patch b/main/broadcom-wl/patches/005-debian-fix-kernel-warnings.patch new file mode 100644 index 0000000..e9bf66a --- /dev/null +++ b/main/broadcom-wl/patches/005-debian-fix-kernel-warnings.patch @@ -0,0 +1,161 @@ +--- a/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/src/wl/sys/wl_cfg80211_hybrid.c +@@ -1968,7 +1968,7 @@ + + if (dtoh32(bi->length) > WL_BSS_INFO_MAX) { + WL_DBG(("Beacon is larger than buffer. Discarding\n")); +- return err; ++ return -E2BIG; + } + notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) + + WL_BSS_INFO_MAX, GFP_KERNEL); +@@ -1992,9 +1992,15 @@ + beacon_proberesp->capab_info = cpu_to_le16(bi->capability); + wl_rst_ie(wl); + +- wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length); +- wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX - ++ err = wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length); ++ if (err) ++ goto inform_single_bss_out; ++ ++ err = wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX - + offsetof(struct wl_cfg80211_bss_info, frame_buf)); ++ if (err) ++ goto inform_single_bss_out; ++ + notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) + + wl_get_ielen(wl); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) +@@ -2006,14 +2012,14 @@ + #endif + if (freq == 0) { + WL_ERR(("Invalid channel, fail to chcnage channel to freq\n")); +- kfree(notif_bss_info); +- return -EINVAL; ++ err = -EINVAL; ++ goto inform_single_bss_out; + } + channel = ieee80211_get_channel(wiphy, freq); + if (unlikely(!channel)) { + WL_ERR(("ieee80211_get_channel error\n")); +- kfree(notif_bss_info); +- return -EINVAL; ++ err = -EINVAL; ++ goto inform_single_bss_out; + } + + WL_DBG(("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n", +@@ -2021,28 +2027,37 @@ + mgmt->u.beacon.capab_info, &bi->BSSID)); + + signal = notif_bss_info->rssi * 100; +- cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt, +- le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL); +- if (unlikely(!cbss)) { +- WL_ERR(("cfg80211_inform_bss_frame error\n")); +- kfree(notif_bss_info); +- return -EINVAL; +- } + +- notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); +- notify_ielen = le32_to_cpu(bi->ie_length); ++ if (!wl->scan_request) { ++ cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt, ++ le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL); ++ if (unlikely(!cbss)) { ++ WL_ERR(("cfg80211_inform_bss_frame error\n")); ++ err = -ENOMEM; ++ goto inform_single_bss_out; ++ } ++ } else { ++ notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); ++ notify_ielen = le32_to_cpu(bi->ie_length); + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) +- cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet), +- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int, +- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); ++ cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet), ++ 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int, ++ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); + #else +- cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, (const u8 *)(bi->BSSID.octet), +- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int, +- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); ++ cbss = cfg80211_inform_bss(wiphy, channel, ++ wl->active_scan ? ++ CFG80211_BSS_FTYPE_PRESP : CFG80211_BSS_FTYPE_BEACON, ++ (const u8 *)(bi->BSSID.octet), 0, ++ beacon_proberesp->capab_info, ++ beacon_proberesp->beacon_int, ++ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); + #endif +- +- if (unlikely(!cbss)) +- return -ENOMEM; ++ if (unlikely(!cbss)) { ++ WL_ERR(("cfg80211_inform_bss error\n")); ++ err = -ENOMEM; ++ goto inform_single_bss_out; ++ } ++ } + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cfg80211_put_bss(wiphy, cbss); +@@ -2050,6 +2065,7 @@ + cfg80211_put_bss(cbss); + #endif + ++inform_single_bss_out: + kfree(notif_bss_info); + + return err; +@@ -2316,6 +2332,9 @@ + if (err) + goto update_bss_info_out; + ++ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid, ++ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); ++ + ie = ((u8 *)bi) + bi->ie_offset; + ie_len = bi->ie_length; + } else { +@@ -2328,11 +2347,18 @@ + ie_len = bss->len_information_elements; + #endif + wl->conf->channel = *bss->channel; ++ } ++ ++ if (bss) { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cfg80211_put_bss(wiphy, bss); + #else + cfg80211_put_bss(bss); + #endif ++ } else { ++ WL_DBG(("Could not update BSS\n")); ++ err = -EINVAL; ++ goto update_bss_info_out; + } + + tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM); +@@ -2360,10 +2386,17 @@ + struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl); + s32 err = 0; + +- wl_get_assoc_ies(wl); ++ err = wl_get_assoc_ies(wl); ++ if (err) ++ return err; ++ + memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN); + memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); +- wl_update_bss_info(wl); ++ ++ err = wl_update_bss_info(wl); ++ if (err) ++ return err; ++ + cfg80211_roamed(ndev, + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) + &wl->conf->channel, diff --git a/main/broadcom-wl/patches/006-linux411.patch b/main/broadcom-wl/patches/006-linux411.patch new file mode 100644 index 0000000..7a2e8c0 --- /dev/null +++ b/main/broadcom-wl/patches/006-linux411.patch @@ -0,0 +1,27 @@ +diff -u sys0/wl_cfg80211_hybrid.c sys/wl_cfg80211_hybrid.c +--- a/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/src/wl/sys/wl_cfg80211_hybrid.c +@@ -39,6 +39,10 @@ + #include + #include + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#include ++#endif ++ + #define EVENT_TYPE(e) dtoh32((e)->event_type) + #define EVENT_FLAGS(e) dtoh16((e)->flags) + #define EVENT_STATUS(e) dtoh32((e)->status) +diff -u sys0/wl_linux.c sys/wl_linux.c +--- a/src/wl/sys/wl_linux.c ++++ b/src/wl/sys/wl_linux.c +@@ -2915,7 +2915,9 @@ + if (skb == NULL) return; + + skb->dev = wl->monitor_dev; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + skb->dev->last_rx = jiffies; ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) + skb_reset_mac_header(skb); + #else diff --git a/main/broadcom-wl/patches/007-linux412.patch b/main/broadcom-wl/patches/007-linux412.patch new file mode 100644 index 0000000..1673f06 --- /dev/null +++ b/main/broadcom-wl/patches/007-linux412.patch @@ -0,0 +1,78 @@ +From 0b888bf115612074df99654140a1980111c29748 Mon Sep 17 00:00:00 2001 +From: Antoine Cotten +Date: Fri, 7 Jul 2017 15:17:47 +0200 +Subject: [PATCH] Apply patch from Debian bug #867258 + +Compile fix with kernel 4.12 +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=867258 +--- + src/wl/sys/wl_cfg80211_hybrid.c | 29 +++++++++++++++++++++++++---- + 1 file changed, 25 insertions(+), 4 deletions(-) + +diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c +index c46944a..1a9840a 100644 +--- a/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/src/wl/sys/wl_cfg80211_hybrid.c +@@ -53,7 +53,11 @@ u32 wl_dbg_level = WL_DBG_ERR; + #endif + + static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, +- enum nl80211_iftype type, u32 *flags, struct vif_params *params); ++ enum nl80211_iftype type, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) ++ u32 *flags, ++#endif ++ struct vif_params *params); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + static s32 + wl_cfg80211_scan(struct wiphy *wiphy, +@@ -466,8 +470,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) + + static s32 + wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, +- enum nl80211_iftype type, u32 *flags, +- struct vif_params *params) ++ enum nl80211_iftype type, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) ++ u32 *flags, ++#endif ++ struct vif_params *params) + { + struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy); + struct wireless_dev *wdev; +@@ -2387,6 +2394,15 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev, + const wl_event_msg_t *e, void *data) + { + struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++ struct cfg80211_roam_info roam_info = { ++ .bssid = wl->profile->bssid, ++ .req_ie = conn_info->req_ie, ++ .req_ie_len = conn_info->req_ie_len, ++ .resp_ie = conn_info->resp_ie, ++ .resp_ie_len = conn_info->resp_ie_len, ++ }; ++#endif + s32 err = 0; + + err = wl_get_assoc_ies(wl); +@@ -2401,12 +2417,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev, + return err; + + cfg80211_roamed(ndev, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++ &roam_info, ++#else + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) + &wl->conf->channel, + #endif + (u8 *)&wl->bssid, + conn_info->req_ie, conn_info->req_ie_len, +- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); ++ conn_info->resp_ie, conn_info->resp_ie_len, ++#endif ++ GFP_KERNEL); + WL_DBG(("Report roaming result\n")); + + set_bit(WL_STATUS_CONNECTED, &wl->status); + diff --git a/main/broadcom-wl/patches/008-linux415.patch b/main/broadcom-wl/patches/008-linux415.patch new file mode 100644 index 0000000..1bced2f --- /dev/null +++ b/main/broadcom-wl/patches/008-linux415.patch @@ -0,0 +1,46 @@ +--- a/src/wl/sys/wl_linux.c 2017-07-17 00:11:24.000000000 +0100 ++++ b/src/wl/sys/wl_linux.c 2018-01-27 09:49:47.057799596 +0000 +@@ -93,7 +93,11 @@ + + #include + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++static void wl_timer(struct timer_list *tl); ++#else + static void wl_timer(ulong data); ++#endif + static void _wl_timer(wl_timer_t *t); + static struct net_device *wl_alloc_linux_if(wl_if_t *wlif); + +@@ -2297,10 +2301,17 @@ + atomic_dec(&t->wl->callbacks); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++static void ++wl_timer(struct timer_list *tl) ++{ ++ wl_timer_t *t = (wl_timer_t *)tl; ++#else + static void + wl_timer(ulong data) + { + wl_timer_t *t = (wl_timer_t *)data; ++#endif + + if (!WL_ALL_PASSIVE_ENAB(t->wl)) + _wl_timer(t); +@@ -2352,9 +2363,13 @@ + + bzero(t, sizeof(wl_timer_t)); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&t->timer, wl_timer, 0); ++#else + init_timer(&t->timer); + t->timer.data = (ulong) t; + t->timer.function = wl_timer; ++#endif + t->wl = wl; + t->fn = fn; + t->arg = arg; diff --git a/main/broadcom-wl/patches/009-fix_mac_profile_discrepancy.patch b/main/broadcom-wl/patches/009-fix_mac_profile_discrepancy.patch new file mode 100644 index 0000000..4260eba --- /dev/null +++ b/main/broadcom-wl/patches/009-fix_mac_profile_discrepancy.patch @@ -0,0 +1,14 @@ +--- a/src/wl/sys/wl_cfg80211_hybrid.c 2015-09-19 00:47:30.000000000 +0200 ++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2018-11-14 14:06:03.313487995 +0100 +@@ -1444,11 +1444,10 @@ + s32 rate; + s32 err = 0; + + if (memcmp(mac, wl->profile->bssid, ETHER_ADDR_LEN)) { + WL_ERR(("Wrong Mac address, mac = %pM profile =%pM\n", mac, wl->profile->bssid)); +- return -ENOENT; + } + + err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)); + if (err) { + WL_DBG(("Could not get rate (%d)\n", err)); diff --git a/main/broadcom-wl/patches/010-linux56.patch b/main/broadcom-wl/patches/010-linux56.patch new file mode 100644 index 0000000..f8d5783 --- /dev/null +++ b/main/broadcom-wl/patches/010-linux56.patch @@ -0,0 +1,55 @@ +diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c +index 6157d18..8237ec7 100644 +--- a/src/shared/linux_osl.c ++++ b/src/shared/linux_osl.c +@@ -942,7 +942,7 @@ osl_getcycles(void) + void * + osl_reg_map(uint32 pa, uint size) + { +- return (ioremap_nocache((unsigned long)pa, (unsigned long)size)); ++ return (ioremap((unsigned long)pa, (unsigned long)size)); + } + + void +diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c +index 0d05100..2ed1f0d 100644 +--- a/src/wl/sys/wl_linux.c ++++ b/src/wl/sys/wl_linux.c +@@ -582,7 +582,7 @@ wl_attach(uint16 vendor, uint16 device, ulong regs, + } + wl->bcm_bustype = bustype; + +- if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) { ++ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) { + WL_ERROR(("wl%d: ioremap() failed\n", unit)); + goto fail; + } +@@ -772,7 +772,7 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + if ((val & 0x0000ff00) != 0) + pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); + bar1_size = pci_resource_len(pdev, 2); +- bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2), ++ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2), + bar1_size); + wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev, + pdev->irq, bar1_addr, bar1_size); +@@ -3335,12 +3335,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t + } + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++static struct proc_ops wl_fops = { ++ .proc_read = wl_proc_read, ++ .proc_write = wl_proc_write, ++}; ++#else + static const struct file_operations wl_fops = { + .owner = THIS_MODULE, + .read = wl_proc_read, + .write = wl_proc_write, + }; + #endif ++#endif + + static int + wl_reg_proc_entry(wl_info_t *wl) diff --git a/main/broadcom-wl/patches/011-linux59.patch b/main/broadcom-wl/patches/011-linux59.patch new file mode 100644 index 0000000..6ef4764 --- /dev/null +++ b/main/broadcom-wl/patches/011-linux59.patch @@ -0,0 +1,211 @@ +From f3d652840f8dd959395065a1cf67ca40b04ec69b Mon Sep 17 00:00:00 2001 +From: Joan Bruguera +Date: Tue, 13 Oct 2020 19:35:55 +0200 +Subject: [PATCH] Get rid of get_fs/set_fs calls in Broadcom WL driver. + +Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 5.10 (tested -rc1 up to 5.10.1) + +Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-23 on Arch Linux. + +NB: Some checks in wlc_ioctl_internal are likely superfluous, + but I'm not familiar enough with the driver to remove them with confidence. + +See also: https://lwn.net/Articles/722267/ + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=47058bb54b57962b3958a936ddbc59355e4c5504 + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5 + +Signed-off-by: Joan Bruguera +--- + src/wl/sys/wl_cfg80211_hybrid.c | 25 ++------------------- + src/wl/sys/wl_iw.c | 25 ++------------------- + src/wl/sys/wl_linux.c | 40 ++++++++++++++++++++++++++++----- + src/wl/sys/wl_linux.h | 2 ++ + src/wl/sys/wlc_pub.h | 1 + + 5 files changed, 42 insertions(+), 51 deletions(-) + +diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c +index 7b606e0..1e0adb7 100644 +--- a/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/src/wl/sys/wl_cfg80211_hybrid.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + + #define EVENT_TYPE(e) dtoh32((e)->event_type) + #define EVENT_FLAGS(e) dtoh16((e)->flags) +@@ -435,30 +436,7 @@ static void key_endian_to_host(struct wl_wsec_key *key) + static s32 + wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) + { +- struct ifreq ifr; +- struct wl_ioctl ioc; +- mm_segment_t fs; +- s32 err = 0; +- +- BUG_ON(len < sizeof(int)); +- +- memset(&ioc, 0, sizeof(ioc)); +- ioc.cmd = cmd; +- ioc.buf = arg; +- ioc.len = len; +- strcpy(ifr.ifr_name, dev->name); +- ifr.ifr_data = (caddr_t)&ioc; +- +- fs = get_fs(); +- set_fs(get_ds()); +-#if defined(WL_USE_NETDEV_OPS) +- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); +-#else +- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE); +-#endif +- set_fs(fs); +- +- return err; ++ return wlc_ioctl_internal(dev, cmd, arg, len); + } + + static s32 +diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c +index c4c610b..e346b15 100644 +--- a/src/wl/sys/wl_iw.c ++++ b/src/wl/sys/wl_iw.c +@@ -37,6 +37,7 @@ typedef const struct si_pub si_t; + + #include + #include ++#include + + extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status, + uint32 reason, char* stringBuf, uint buflen); +@@ -103,29 +104,7 @@ dev_wlc_ioctl( + int len + ) + { +- struct ifreq ifr; +- wl_ioctl_t ioc; +- mm_segment_t fs; +- int ret; +- +- memset(&ioc, 0, sizeof(ioc)); +- ioc.cmd = cmd; +- ioc.buf = arg; +- ioc.len = len; +- +- strcpy(ifr.ifr_name, dev->name); +- ifr.ifr_data = (caddr_t) &ioc; +- +- fs = get_fs(); +- set_fs(get_ds()); +-#if defined(WL_USE_NETDEV_OPS) +- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); +-#else +- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE); +-#endif +- set_fs(fs); +- +- return ret; ++ return wlc_ioctl_internal(dev, cmd, arg, len); + } + + static int +diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c +index 947cef3..f04c148 100644 +--- a/src/wl/sys/wl_linux.c ++++ b/src/wl/sys/wl_linux.c +@@ -1643,10 +1643,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) + goto done2; + } + +- if (segment_eq(get_fs(), KERNEL_DS)) +- buf = ioc.buf; +- +- else if (ioc.buf) { ++ if (ioc.buf) { + if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) { + bcmerror = BCME_NORESOURCE; + goto done2; +@@ -1667,7 +1664,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) + WL_UNLOCK(wl); + + done1: +- if (ioc.buf && (ioc.buf != buf)) { ++ if (ioc.buf) { + if (copy_to_user(ioc.buf, buf, ioc.len)) + bcmerror = BCME_BADADDR; + MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN)); +@@ -1680,6 +1677,39 @@ done2: + return (OSL_ERROR(bcmerror)); + } + ++int ++wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len) ++{ ++ wl_info_t *wl; ++ wl_if_t *wlif; ++ int bcmerror; ++ ++ if (!dev) ++ return -ENETDOWN; ++ ++ wl = WL_INFO(dev); ++ wlif = WL_DEV_IF(dev); ++ if (wlif == NULL || wl == NULL || wl->dev == NULL) ++ return -ENETDOWN; ++ ++ bcmerror = 0; ++ ++ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd)); ++ ++ WL_LOCK(wl); ++ if (!capable(CAP_NET_ADMIN)) { ++ bcmerror = BCME_EPERM; ++ } else { ++ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif); ++ } ++ WL_UNLOCK(wl); ++ ++ ASSERT(VALID_BCMERROR(bcmerror)); ++ if (bcmerror != 0) ++ wl->pub->bcmerror = bcmerror; ++ return (OSL_ERROR(bcmerror)); ++} ++ + static struct net_device_stats* + wl_get_stats(struct net_device *dev) + { +diff --git a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h +index 5b1048e..c8c1f41 100644 +--- a/src/wl/sys/wl_linux.h ++++ b/src/wl/sys/wl_linux.h +@@ -22,6 +22,7 @@ + #define _wl_linux_h_ + + #include ++#include + + typedef struct wl_timer { + struct timer_list timer; +@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id, struct pt_regs *ptregs); + extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent); + extern void wl_free(wl_info_t *wl); + extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); ++extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len); + extern struct net_device * wl_netdev_get(wl_info_t *wl); + + #endif +diff --git a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h +index 53a98b8..2b5a029 100644 +--- a/src/wl/sys/wlc_pub.h ++++ b/src/wl/sys/wlc_pub.h +@@ -24,6 +24,7 @@ + + #include + #include ++#include + #include "proto/802.11.h" + #include "proto/bcmevent.h" + +-- +2.28.0 diff --git a/main/broadcom-wl/patches/012-linux517.patch b/main/broadcom-wl/patches/012-linux517.patch new file mode 100644 index 0000000..6f23316 --- /dev/null +++ b/main/broadcom-wl/patches/012-linux517.patch @@ -0,0 +1,80 @@ +From 31b7849092c43805c7fbaf7518b99874aa1b310c Mon Sep 17 00:00:00 2001 +From: Joan Bruguera +Date: Wed, 12 Jan 2022 20:49:20 +0100 +Subject: [PATCH] Tentative fix for broadcom-wl 6.30.223.271 driver for Linux 5.17-rc1 + +Set netdev->dev_addr through dev_addr_mod + PDE_DATA fix + +Since Linux 5.17 netdev->dev_addr is const and must be changed through +dev_addr_mod, otherwise a warning is logged in dmesg and bad things may happen. + +NB: The #if is not wrong, dev_addr_mod is defined since Linux 5.15-rc1 + +Plus a trivial fix for PDE_DATA. + +Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-28 on Arch Linux. + +See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=adeef3e32146a8d2a73c399dc6f5d76a449131b1 + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=359745d78351c6f5442435f81549f0207ece28aa +--- + src/wl/sys/wl_linux.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c +index e491df7..e4614fb 100644 +--- a/src/wl/sys/wl_linux.c ++++ b/src/wl/sys/wl_linux.c +@@ -93,6 +93,10 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev); + + #include + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)) ++#define PDE_DATA pde_data ++#endif ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) + static void wl_timer(struct timer_list *tl); + #else +@@ -490,6 +494,12 @@ wl_if_setup(struct net_device *dev) + #endif + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) ++static inline void eth_hw_addr_set(struct net_device *dev, const void *addr) { ++ memcpy(dev->dev_addr, addr, ETHER_ADDR_LEN); ++} ++#endif ++ + static wl_info_t * + wl_attach(uint16 vendor, uint16 device, ulong regs, + uint bustype, void *btparam, uint irq, uchar* bar1_addr, uint32 bar1_size) +@@ -634,7 +644,7 @@ wl_attach(uint16 vendor, uint16 device, ulong regs, + WL_ERROR(("wl%d: Error setting MAC ADDRESS\n", unit)); + } + #endif +- bcopy(&wl->pub->cur_etheraddr, dev->dev_addr, ETHER_ADDR_LEN); ++ eth_hw_addr_set(dev, wl->pub->cur_etheraddr.octet); + + online_cpus = 1; + +@@ -1835,7 +1845,7 @@ wl_set_mac_address(struct net_device *dev, void *addr) + + WL_LOCK(wl); + +- bcopy(sa->sa_data, dev->dev_addr, ETHER_ADDR_LEN); ++ eth_hw_addr_set(dev, sa->sa_data); + err = wlc_iovar_op(wl->wlc, "cur_etheraddr", NULL, 0, sa->sa_data, ETHER_ADDR_LEN, + IOV_SET, (WL_DEV_IF(dev))->wlcif); + WL_UNLOCK(wl); +@@ -3010,7 +3020,7 @@ _wl_add_monitor_if(wl_task_t *task) + else + dev->type = ARPHRD_IEEE80211_RADIOTAP; + +- bcopy(wl->dev->dev_addr, dev->dev_addr, ETHER_ADDR_LEN); ++ eth_hw_addr_set(dev, wl->dev->dev_addr); + + #if defined(WL_USE_NETDEV_OPS) + dev->netdev_ops = &wl_netdev_monitor_ops; +-- +2.35.1 + diff --git a/main/broadcom-wl/patches/013-linux518.patch b/main/broadcom-wl/patches/013-linux518.patch new file mode 100644 index 0000000..d837429 --- /dev/null +++ b/main/broadcom-wl/patches/013-linux518.patch @@ -0,0 +1,71 @@ +diff -u -r a/src/shared/linux_osl.c b/src/shared/linux_osl.c +--- a/src/shared/linux_osl.c 2022-05-24 20:51:15.662604980 +0000 ++++ b/src/shared/linux_osl.c 2022-05-24 21:13:38.264472425 +0000 +@@ -599,6 +599,8 @@ + va = kmalloc(size, GFP_ATOMIC | __GFP_ZERO); + if (va) + *pap = (ulong)__virt_to_phys(va); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) ++ va = dma_alloc_coherent(&((struct pci_dev *)osh->pdev)->dev, size, (dma_addr_t*)pap, GFP_ATOMIC); + #else + va = pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap); + #endif +@@ -612,6 +614,8 @@ + + #ifdef __ARM_ARCH_7A__ + kfree(va); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) ++ dma_free_coherent(&((struct pci_dev *)osh->pdev)->dev, size, va, (dma_addr_t)pa); + #else + pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa); + #endif +@@ -623,7 +627,11 @@ + int dir; + + ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) ++ dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE; ++#else + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; ++#endif + + #if defined(__ARM_ARCH_7A__) && defined(BCMDMASGLISTOSL) + if (dmah != NULL) { +@@ -641,7 +649,11 @@ + ASSERT(totsegs + nsegs <= MAX_DMA_SEGS); + sg->page_link = 0; + sg_set_buf(sg, PKTDATA(osh, skb), PKTLEN(osh, skb)); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) ++ dma_map_single(&((struct pci_dev *)osh->pdev)->dev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir); ++#else + pci_map_single(osh->pdev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir); ++#endif + } + totsegs += nsegs; + totlen += PKTLEN(osh, skb); +@@ -656,7 +668,11 @@ + } + #endif + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) ++ return (dma_map_single(&((struct pci_dev *)osh->pdev)->dev, va, size, dir)); ++#else + return (pci_map_single(osh->pdev, va, size, dir)); ++#endif + } + + void BCMFASTPATH +@@ -665,8 +681,13 @@ + int dir; + + ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) ++ dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE; ++ dma_unmap_single(&((struct pci_dev *)osh->pdev)->dev, (uint32)pa, size, dir); ++#else + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; + pci_unmap_single(osh->pdev, (uint32)pa, size, dir); ++#endif + } + + #if defined(BCMDBG_ASSERT) diff --git a/main/broadcom-wl/patches/014-linux414.patch b/main/broadcom-wl/patches/014-linux414.patch new file mode 100644 index 0000000..0576aa5 --- /dev/null +++ b/main/broadcom-wl/patches/014-linux414.patch @@ -0,0 +1,37 @@ +From: Gerardo Esteban Malazdrewicz +Date: Fri, 29 Dec 2017 23:44:24 -0400 +Subject: linux414 +Origin: https://bugs.debian.org/885885 + +linux 4.14 changed the kernel_read function prototype. +--- + src/shared/linux_osl.c | 12 +++++++++++- + 1 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c +index 9adc392..b24a973 100644 +--- a/src/shared/linux_osl.c ++++ b/src/shared/linux_osl.c +@@ -1076,11 +1076,21 @@ osl_os_get_image_block(char *buf, int len, void *image) + { + struct file *fp = (struct file *)image; + int rdlen; ++ loff_t pos; + + if (!image) + return 0; + +- rdlen = kernel_read(fp, fp->f_pos, buf, len); ++ pos = fp->f_pos; ++ rdlen = kernel_read(fp, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) ++ pos, ++#endif ++ buf, len ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ,&pos ++#endif ++ ); + if (rdlen > 0) + fp->f_pos += rdlen; + diff --git a/main/broadcom-wl/patches/015-linux600.patch b/main/broadcom-wl/patches/015-linux600.patch new file mode 100644 index 0000000..8645907 --- /dev/null +++ b/main/broadcom-wl/patches/015-linux600.patch @@ -0,0 +1,31 @@ +From 933540c63f33e6ac2825d65c4b681ef3387d9146 Mon Sep 17 00:00:00 2001 +From: Antoine Cotten +Date: Mon, 15 Aug 2022 17:53:51 +0200 +Subject: [PATCH] cfg80211_roam_info compat for MLO APIs in Linux >= 6.0 + +The 'bssid' struct field is now under 'links.bssid'. + +See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=efbabc11650040c64884ff3019b88c7bcc0ceb1d + +Original patch by Joan Bruguera: +https://gist.github.com/joanbm/207210d74637870c01ef5a3c262a597d +--- + src/wl/sys/wl_cfg80211_hybrid.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c +index 5e9e6d3..5ec35c5 100644 +--- a/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/src/wl/sys/wl_cfg80211_hybrid.c +@@ -2412,7 +2412,11 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev, + struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + struct cfg80211_roam_info roam_info = { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) + .bssid = wl->profile->bssid, ++#else ++ .links[0].bssid = wl->profile->bssid, ++#endif + .req_ie = conn_info->req_ie, + .req_ie_len = conn_info->req_ie_len, + .resp_ie = conn_info->resp_ie, diff --git a/main/broadcom-wl/patches/016-linux601.patch b/main/broadcom-wl/patches/016-linux601.patch new file mode 100644 index 0000000..9e71154 --- /dev/null +++ b/main/broadcom-wl/patches/016-linux601.patch @@ -0,0 +1,90 @@ +diff -Nurp a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c +--- a/src/wl/sys/wl_cfg80211_hybrid.c 2022-12-12 00:23:30.821615599 +0000 ++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2022-12-12 00:35:47.854975024 +0000 +@@ -105,14 +105,28 @@ static s32 wl_cfg80211_get_tx_power(stru + static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm); + #endif + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) ++static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy, ++ struct net_device *dev, int link_id, u8 key_idx, bool unicast, ++ bool multicast); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) + static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy, + struct net_device *dev, u8 key_idx, bool unicast, bool multicast); + #else + static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy, + struct net_device *dev, u8 key_idx); + #endif +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) ++static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, ++ int link_id, u8 key_idx, bool pairwise, const u8 *mac_addr, ++ struct key_params *params); ++static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, ++ int link_id, u8 key_idx, bool pairwise, const u8 *mac_addr); ++static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, ++ int link_id, u8 key_idx, bool pairwise, const u8 *mac_addr, ++ void *cookie, ++ void (*callback) (void *cookie, struct key_params *params)); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, + u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params); + static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, +@@ -1161,7 +1175,12 @@ static s32 wl_cfg80211_get_tx_power(stru + return err; + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) ++static s32 ++wl_cfg80211_config_default_key(struct wiphy *wiphy, ++ struct net_device *dev, int link_id, u8 key_idx, bool unicast, ++ bool multicast) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) + static s32 + wl_cfg80211_config_default_key(struct wiphy *wiphy, + struct net_device *dev, u8 key_idx, bool unicast, bool multicast) +@@ -1186,7 +1205,12 @@ wl_cfg80211_config_default_key(struct wi + return 0; + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) ++static s32 ++wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, ++ int link_id, u8 key_idx, bool pairwise, const u8 *mac_addr, ++ struct key_params *params) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + static s32 + wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, + u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params) +@@ -1307,7 +1331,11 @@ wl_cfg80211_add_key(struct wiphy *wiphy, + return err; + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) ++static s32 ++wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, ++ int link_id, u8 key_idx, bool pairwise, const u8 *mac_addr) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + static s32 + wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, + u8 key_idx, bool pairwise, const u8 *mac_addr) +@@ -1350,7 +1378,13 @@ wl_cfg80211_del_key(struct wiphy *wiphy, + return err; + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) ++static s32 ++wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, ++ int link_id, u8 key_idx, bool pairwise, const u8 *mac_addr, ++ void *cookie, ++ void (*callback) (void *cookie, struct key_params * params)) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + static s32 + wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, + u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie, diff --git a/main/broadcom-wl/patches/017-linux612.patch b/main/broadcom-wl/patches/017-linux612.patch new file mode 100644 index 0000000..b7d9ef6 --- /dev/null +++ b/main/broadcom-wl/patches/017-linux612.patch @@ -0,0 +1,15 @@ +diff -Nurp a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c +--- a/src/wl/sys/wl_linux.c 2024-11-19 03:05:21.160736778 +0000 ++++ b/src/wl/sys/wl_linux.c 2024-11-19 03:09:59.010905106 +0000 +@@ -56,7 +56,11 @@ + #include + #include + #include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) ++#include ++#else + #include ++#endif + + #include + diff --git a/main/broadcom-wl/patches/018-linux613.patch b/main/broadcom-wl/patches/018-linux613.patch new file mode 100644 index 0000000..bb4c752 --- /dev/null +++ b/main/broadcom-wl/patches/018-linux613.patch @@ -0,0 +1,32 @@ +From 5788a19e88aac78e6b2ec8bef7cb094fc14cfbf0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= +Date: Sat, 12 Oct 2024 11:54:40 +0000 +Subject: [PATCH] Tentative patch for broadcom-wl 6.30.223.271 driver for Linux + 6.13-rc1 + +The net/lib80211.h header has been removed by commit +"wifi: ipw2x00/lib80211: move remaining lib80211 into libipw" +(Johannes Berg, 7 Oct 2024). +The header does not appear to be actually used anywhere, so remove it. + + #include + #include +--- + src/include/linuxver.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/include/linuxver.h b/src/include/linuxver.h +index b05bc32..06e32eb 100644 +--- a/src/include/linuxver.h ++++ b/src/include/linuxver.h +@@ -147,7 +147,7 @@ typedef irqreturn_t(*FN_ISR) (int irq, void *dev_id, struct pt_regs *ptregs); + #include + #endif + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) && LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0) + #include + #endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) +-- +2.47.0 diff --git a/main/broadcom-wl/patches/019-linux614.patch b/main/broadcom-wl/patches/019-linux614.patch new file mode 100644 index 0000000..1ba8de1 --- /dev/null +++ b/main/broadcom-wl/patches/019-linux614.patch @@ -0,0 +1,34 @@ +From: Eduard Bloch +Date: Sun, 16 Mar 2025 16:13:08 +0100 +Subject: Prepare for 6.14.0-rc6 + +--- + src/wl/sys/wl_cfg80211_hybrid.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c +index 2c865c1..e23ef83 100644 +--- a/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/src/wl/sys/wl_cfg80211_hybrid.c +@@ -98,7 +98,9 @@ static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, + enum tx_power_setting type, s32 mbm); + #endif + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) ++static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u32 /*link_id*/, s32 *dbm); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, s32 *dbm); + #else + static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm); +@@ -1159,7 +1161,9 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, s32 mb + return err; + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) ++static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, u32 /*link_id*/, s32 *dbm) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, s32 *dbm) + #else + static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) diff --git a/main/broadcom-wl/readme.md b/main/broadcom-wl/readme.md new file mode 100644 index 0000000..861c1f5 --- /dev/null +++ b/main/broadcom-wl/readme.md @@ -0,0 +1,31 @@ +# Broadcom wl driver for alpine linux + +Uses [akms](https://github.com/jirutka/akms) + +Since alpine got rid of non-free repository, the only way is to build driver from third-party APKBUILD. + +**Installation:** + +1. follow this instructions: +2. Copy ~/.abuild/key.rsa.pub into /etc/apk/keys +3. Enter PACKAGER_PRIVKEY="$HOME/.abuild/key.rsa" into ~/.abuild/abuild.conf +4. Clone this repo and cd into it +5. Build package with `abuild -r` +6. Go into ~/packages/broadcom-wl-akms/x86_64 and install package with `apk add broadcom-wl-6.30.223.271-r0.apk` + +It`s done! + +If you followed instructions in wiki about keygen you can skip steps 2 and 3. + +--- + +Tested with Broadcom BCM43142, iwd, alpine edge + +With iwd and busybox's dhcp you will need to add that to iwd config + +``` +[General] +EnableNetworkConfiguration=True +``` + +With dhcpcd it may work without it diff --git a/main/cdesktop-jwm/APKBUILD b/main/cdesktop-jwm/APKBUILD new file mode 100644 index 0000000..6135a88 --- /dev/null +++ b/main/cdesktop-jwm/APKBUILD @@ -0,0 +1,85 @@ +# Maintainer: Şahan Yılmaz +pkgname=cdesktop-jwm +pkgver=1.4 +pkgrel=0 +pkgdesc="Minimal JWM Masaüstü Ortamı" +url="https://chronalinux.net.tr" +arch="all" +license="MIT" +depends=" + jwm + spacefm + xorg-server + xf86-input-libinput + xinit + eudev + menumaker + volumeicon + alsa-utils + alsaconf + mesa-dri-gallium + chrona-networkmanager-gtk + netsurf + st + font-dejavu + adwaita-icon-theme + dbus + dbus-x11 + tint2 + xterm + mesa-gles +" + +# Ek yapılandırma dosyaları eklendi +source=" + jwmrc + mainmenu.svg + tint2.conf + JWMMenu + chrona-startup.sh + cdesktop-wallpaper + chrona25-04.png +" + +build() { + return 0 +} + +package() { + mkdir -p "$pkgdir"/etc/skel + mkdir -p "$pkgdir"/etc/skel/.config/tint2 + mkdir -p "$pkgdir"/etc/skel/.config/cdesktop + mkdir -p "$pkgdir"/usr/share/cdesktop/ + mkdir -p "$pkgdir"/usr/share/icons/chrona/ + mkdir -p "$pkgdir"/usr/share/applications/ + mkdir -p "$pkgdir"/usr/share/cdesktop/wallpapers + install -Dm644 chrona25-04.png "$pkgdir"/usr/share/cdesktop/wallpapers/chrona25-04.png + install -Dm644 mainmenu.svg "$pkgdir"/usr/share/icons/chrona/mainmenu.svg + install -Dm644 jwmrc "$pkgdir"/etc/skel/.jwmrc + install -Dm644 tint2.conf "$pkgdir"/etc/skel/.config/tint2/tint2rc + install -Dm755 JWMMenu "$pkgdir"/usr/share/cdesktop/JWMMenu + install -Dm755 chrona-startup.sh "$pkgdir"/etc/skel/.config/cdesktop/cdesktop-startup.sh + install -Dm755 cdesktop-wallpaper "$pkgdir"/etc/skel/.config/cdesktop/cdesktop-wallpaper + cat >"$pkgdir"/usr/share/applications/cdesktop.desktop< ~/.jwm/menu & +nm-applet & +volumeicon & +tint2 diff --git a/main/cdesktop-jwm/chrona25-04.png b/main/cdesktop-jwm/chrona25-04.png new file mode 100644 index 0000000..07d772d Binary files /dev/null and b/main/cdesktop-jwm/chrona25-04.png differ diff --git a/main/cdesktop-jwm/jwmrc b/main/cdesktop-jwm/jwmrc new file mode 100644 index 0000000..ef8a15d --- /dev/null +++ b/main/cdesktop-jwm/jwmrc @@ -0,0 +1,45 @@ + + + /usr/share/icons/hicolor/256x256/apps + /usr/share/icons/hicolor/256x256/mimetypes + /usr/share/icons/hicolor/32x32/actions + /usr/share/icons/hicolor/32x32/apps + /usr/share/icons/hicolor/32x32/categories + /usr/share/icons/hicolor/32x32/devices + /usr/share/icons/hicolor/32x32/emblems + /usr/share/icons/hicolor/32x32/mimetypes + /usr/share/icons/hicolor/32x32/status + /usr/share/icons/hicolor/512x512/apps + /usr/share/icons/hicolor/512x512/mimetypes + /usr/share/icons/hicolor/scalable/actions + /usr/share/icons/hicolor/scalable/apps + /usr/share/icons/hicolor/scalable/categories + /usr/share/icons/hicolor/scalable/devices + /usr/share/icons/hicolor/scalable/emblems + /usr/share/icons/hicolor/scalable/mimetypes + /usr/share/icons/hicolor/scalable/places + /usr/share/icons/hicolor/scalable/status + /usr/share/icons + + + ~/.jwm/menu + + + + + + + + + + sh ~/.config/cdesktop/cdesktop-startup.sh + + + sans-12 + 4 + 24 + + +root:1 + + diff --git a/main/cdesktop-jwm/mainmenu.svg b/main/cdesktop-jwm/mainmenu.svg new file mode 100644 index 0000000..28164e6 --- /dev/null +++ b/main/cdesktop-jwm/mainmenu.svg @@ -0,0 +1,1687 @@ + + + + + + + + + + diff --git a/main/cdesktop-jwm/tint2.conf b/main/cdesktop-jwm/tint2.conf new file mode 100644 index 0000000..454e1a9 --- /dev/null +++ b/main/cdesktop-jwm/tint2.conf @@ -0,0 +1,181 @@ +#---- Generated by tint2conf 2641 ---- +# See https://gitlab.com/o9000/tint2/wikis/Configure for +# full documentation of the configuration options. +#------------------------------------- +# Backgrounds +# Background 1: Panel +rounded = 0 +border_width = 0 +background_color = #000000 60 +border_color = #000000 30 +background_color_hover = #000000 60 +border_color_hover = #000000 30 +background_color_pressed = #000000 60 +border_color_pressed = #000000 30 + +# Background 2: Default task, Iconified task +rounded = 4 +border_width = 1 +background_color = #777777 20 +border_color = #777777 30 +background_color_hover = #aaaaaa 22 +border_color_hover = #eaeaea 44 +background_color_pressed = #555555 4 +border_color_pressed = #eaeaea 44 + +# Background 3: Active task +rounded = 4 +border_width = 1 +background_color = #777777 20 +border_color = #ffffff 40 +background_color_hover = #aaaaaa 22 +border_color_hover = #eaeaea 44 +background_color_pressed = #555555 4 +border_color_pressed = #eaeaea 44 + +# Background 4: Urgent task +rounded = 4 +border_width = 1 +background_color = #aa4400 100 +border_color = #aa7733 100 +background_color_hover = #cc7700 100 +border_color_hover = #aa7733 100 +background_color_pressed = #555555 4 +border_color_pressed = #aa7733 100 + +# Background 5: Tooltip +rounded = 1 +border_width = 1 +background_color = #ffffaa 100 +border_color = #000000 100 +background_color_hover = #ffffaa 100 +border_color_hover = #000000 100 +background_color_pressed = #ffffaa 100 +border_color_pressed = #000000 100 + +#------------------------------------- +# Panel +panel_items = LTSC +panel_size = 100% 30 +panel_margin = 0 0 +panel_padding = 2 0 2 +panel_background_id = 1 +wm_menu = 1 +panel_dock = 0 +panel_position = bottom center horizontal +panel_layer = top +panel_monitor = all +primary_monitor_first = 0 +autohide = 0 +autohide_show_timeout = 0 +autohide_hide_timeout = 0.5 +autohide_height = 2 +strut_policy = follow_size +panel_window_name = tint2 +disable_transparency = 1 +mouse_effects = 1 +font_shadow = 0 +mouse_hover_icon_asb = 100 0 10 +mouse_pressed_icon_asb = 100 0 0 + +#------------------------------------- +# Taskbar +taskbar_mode = single_desktop +taskbar_padding = 0 0 2 +taskbar_background_id = 0 +taskbar_active_background_id = 0 +taskbar_name = 1 +taskbar_hide_inactive_tasks = 0 +taskbar_hide_different_monitor = 0 +taskbar_always_show_all_desktop_tasks = 0 +taskbar_name_padding = 4 2 +taskbar_name_background_id = 0 +taskbar_name_active_background_id = 0 +taskbar_name_font_color = #e3e3e3 100 +taskbar_name_active_font_color = #ffffff 100 +taskbar_distribute_size = 0 +taskbar_sort_order = none +task_align = left + +#------------------------------------- +# Task +task_text = 1 +task_icon = 1 +task_centered = 1 +urgent_nb_of_blink = 100000 +task_maximum_size = 150 35 +task_padding = 2 2 4 +task_tooltip = 1 +task_font_color = #ffffff 100 +task_background_id = 2 +task_active_background_id = 3 +task_urgent_background_id = 4 +task_iconified_background_id = 2 +mouse_left = toggle_iconify +mouse_middle = none +mouse_right = close +mouse_scroll_up = toggle +mouse_scroll_down = iconify + +#------------------------------------- +# System tray (notification area) +systray_padding = 0 4 2 +systray_background_id = 0 +systray_sort = ascending +systray_icon_size = 24 +systray_icon_asb = 100 0 0 +systray_monitor = 1 + +#------------------------------------- +# Launcher +launcher_padding = 2 4 2 +launcher_background_id = 0 +launcher_icon_background_id = 0 +launcher_icon_size = 24 +launcher_icon_asb = 100 0 0 +launcher_icon_theme_override = 0 +startup_notifications = 1 +launcher_tooltip = 1 +launcher_item_app = /usr/share/applications/cdesktop.desktop + +#------------------------------------- +# Clock +time1_format = %H:%M +time2_format = %A %d %B +time1_timezone = +time2_timezone = +clock_font_color = #ffffff 100 +clock_padding = 2 0 +clock_background_id = 0 +clock_tooltip = +clock_tooltip_timezone = +clock_lclick_command = +clock_rclick_command = orage +clock_mclick_command = +clock_uwheel_command = +clock_dwheel_command = + +#------------------------------------- +# Battery +battery_tooltip = 1 +battery_low_status = 10 +battery_low_cmd = notify-send "battery low" +battery_font_color = #ffffff 100 +battery_padding = 1 0 +battery_background_id = 0 +battery_hide = 101 +battery_lclick_command = +battery_rclick_command = +battery_mclick_command = +battery_uwheel_command = +battery_dwheel_command = +ac_connected_cmd = +ac_disconnected_cmd = + +#------------------------------------- +# Tooltip +tooltip_show_timeout = 0.5 +tooltip_hide_timeout = 0.1 +tooltip_padding = 2 2 +tooltip_background_id = 5 +tooltip_font_color = #222222 100 diff --git a/main/chrona-base/APKBUILD b/main/chrona-base/APKBUILD new file mode 100644 index 0000000..531168c --- /dev/null +++ b/main/chrona-base/APKBUILD @@ -0,0 +1,86 @@ +# Maintainer: Şahan Yılmaz +pkgname=chrona-base +pkgver=25.04 +pkgrel=0 +pkgdesc="Meta package for minimal chrona base" +url="https://chronalinux.org.tr" +arch="noarch" +license="MIT" +depends=" + alpine-baselayout + alpine-conf + chrona-release + apk-tools + busybox + busybox-mdev-openrc + busybox-openrc + busybox-suid + musl-utils + openrc + chrona-base-openrc + " +subpackages="chrona-release:release $pkgname-openrc:openrc" +replaces="alpine-baselayout" +options="!check" + +package() { + mkdir -p "$pkgdir" +} + +release() { + depends="alpine-keys" + pkgdesc="Chrona release data" + + mkdir -p "$subpkgdir"/etc + # create /etc/alpine-release + echo $pkgver > "$subpkgdir"/etc/alpine-release + local _ver="$(echo "$pkgver" | grep -E -o '^[0-9]+\.[0-9]+')" + local _rel="v$_ver" + case "$pkgver" in + *_alpha*|*_beta*|*_pre*) + _ver="$pkgver (edge)" + _rel="edge" + ;; + esac + + # create /etc/issue + cat >"$subpkgdir"/etc/issue<"$subpkgdir"/etc/motd<"$subpkgdir"/usr/lib/os-release<"$subpkgdir"/etc/secfixes.d/alpine< +pkgname=chrona-installer +pkgver=25.04 +pkgrel=3 +pkgdesc="Chrona Linux Installer" +url="https://chronalinux.org.tr" +arch="all" +license="MIT" +depends="rsync squashfs-tools sfdisk" +replaces="alpine-conf" +source="ci-disk" +package() { + mkdir -p "$pkgdir" + install -Dm755 ci-disk "$pkgdir"/usr/sbin/ci-disk +} +sha512sums="dcf3a9eaede3eec9ee31ac2c6e9d3d8dfbb8ae76e3979edb4127efc29c5e29cca8eb24fca13c19f568a4000c1b378f3f2c94e33d3f3c1b6734d562f954444767 ci-disk" diff --git a/main/chrona-installer/ci-disk b/main/chrona-installer/ci-disk new file mode 100644 index 0000000..48b0d32 --- /dev/null +++ b/main/chrona-installer/ci-disk @@ -0,0 +1,1462 @@ +#!/bin/sh + +PREFIX=/usr +: ${LIBDIR=$PREFIX/lib} +. "$LIBDIR/libalpine.sh" +. "$LIBDIR/dasd-functions.sh" + +MBR=${MBR:-"/usr/share/syslinux/mbr.bin"} +ROOTFS=${ROOTFS:-ext4} +BOOTFS=${BOOTFS:-ext4} +VARFS=${VARFS:-ext4} +DISKLABEL=${DISKLABEL:-dos} +KERNELOPTS=${KERNELOPTS:-rw quiet} +SYSROOT=${SYSROOT:-/mnt} +SHAANFS=/media/cdrom/boot/shaanfs.squashfs + +repos="$(sed -e 's/\#.*//' "/etc/apk/repositories" 2>/dev/null)" +repoflags= +for i in $repos; do + repoflags="$repoflags --repository $i" +done + +in_list() { + local i="$1" + shift + while [ $# -gt 0 ]; do + [ "$i" = "$1" ] && return 0 + shift + done + return 1 +} + +all_in_list() { + local needle="$1" + local i + [ -z "$needle" ] && return 1 + shift + for i in $needle; do + in_list "$i" $@ || return 1 + done + return 0 +} + +_blkid() { + blkid | grep "^$1:" +} + +uuid_or_device() { + local i= + for i in $NO_DISK_UUID; do + if [ "$i" = "$1" ]; then + echo "$1" && return 0 + fi + done + case "$1" in + /dev/md*) echo "$1" && return 0;; + esac + for i in $(_blkid "$1"); do + case "$i" in + UUID=*) eval $i;; + esac + done + if [ -n "$UUID" ]; then + echo "UUID=$UUID" + else + echo "$1" + fi +} + +enumerate_fstab() { + local mnt="$1" + local fs_spec= fs_file= fs_vfstype= fs_mntops= fs_freq= fs_passno= + [ -z "$mnt" ] && return + local escaped_mnt="$(echo $mnt | sed -e 's:/*$::' -e 's:/:\\/:g')" + awk "\$2 ~ /^$escaped_mnt(\/|\$)/ {print \$0}" "${ROOT}proc/mounts" | \ + sed "s:$mnt:/:g; s: :\t:g" | sed -E 's:/+:/:g' | \ + while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno; do + if [ "$fs_file" = / ]; then + fs_passno=1 + else + fs_passno=2 + fi + printf "%s\t%s\t%s\t%s %s %s\n" \ + "$(uuid_or_device $fs_spec)" "$fs_file" "$fs_vfstype" "$fs_mntops" $fs_freq $fs_passno + done +} + +crypt_required() { + while read -r devname mountpoint fstype mntops freq passno; do + if [ -z "$devname" ] || [ "${devname###}" != "$devname" ]; then + continue + fi + uuid="${devname##UUID=}" + if [ "$uuid" != "$devname" ]; then + devname="$(blkid --uuid "$uuid")" + fi + local devnames="$devname" + if is_lvm "$devname"; then + local vg="$(find_volume_group "$devname")" + devnames=$(find_pvs_in_vg $vg) + fi + for dev in $devnames; do + mapname="${dev##/dev/mapper/}" + if [ "$mapname" != "$dev" ]; then + if cryptsetup status "$mapname" >&1 >/dev/null; then + return 0 + fi + fi + done + done + return 1 +} + +is_lvm() { + lvs "$1" >/dev/null 2>&1 +} + +is_efi() { + [ -d "${ROOT}sys/firmware/efi" ] && return 0 + return 1 +} + +is_rpi() { + grep -q "Raspberry Pi" /proc/device-tree/model 2>/dev/null +} + +partition_id() { + local id + if [ "$DISKLABEL" = "gpt" ]; then + case "$1" in + biosboot) id=21686148-6449-6E6F-744E-656564454649 ;; + swap) id=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F ;; + linux) id=0FC63DAF-8483-4772-8E79-3D69D8477DE4 ;; + raid) id=A19D880F-05FC-4D3B-A006-743F0F84911E ;; + lvm) id=E6D6D379-F507-44C2-A23C-238F2A3DF928 ;; + prep) id=9E1A2d38-C612-4316-AA26-8B49521E5A8B ;; + esp) id=C12A7328-F81F-11D2-BA4B-00A0C93EC93B ;; + *) die "Partition id \"$1\" is not supported!" ;; + esac + elif [ "$DISKLABEL" = "dos" ]; then + case "$1" in + swap) id=82 ;; + linux) id=83 ;; + raid) id=fd ;; + lvm) id=8e ;; + prep) id=41 ;; + esp) id=EF ;; + vfat) id=0c ;; + *) die "Partition id \"$1\" is not supported!" ;; + esac + elif [ "$DISKLABEL" = "eckd" ]; then + case "$1" in + native|lvm|swap|raid|gpfs) id="$1" ;; + esac + else + die "Partition label \"$DISKLABEL\" is not supported!" + fi + echo $id +} + +find_partitions() { + local dev="$1" type="$2" search= + if is_dasd "$dev" eckd; then + case "$type" in + boot) echo "$dev"1 ;; + *) fdasd -p "$dev" | grep "Linux $(partition_id "$type")" | awk '{print $1}' | tail -n 1 ;; + esac + return 0 + fi + case "$type" in + boot) + if [ -n "$USE_EFI" ]; then + search=$(partition_id esp) + elif [ "$DISKLABEL" = "gpt" ]; then + search="LegacyBIOSBootable" + else + search=bootable + fi + sfdisk -d "${ROOT}${dev#/}" | awk '/'$search'/ {print $1}' + ;; + *) + search=$(partition_id "$type") + sfdisk -d "${ROOT}${dev#/}" | awk '/type='$search'/ {print $1}' + ;; + esac +} + +find_mount_fs() { + local mount_point="$1" + awk "\$2 == \"$mount_point\" {print \$3}" "${ROOT}proc/mounts" | tail -n 1 +} + +find_mount_dev() { + local mnt="$1" + awk "\$2 == \"$mnt\" { print \$1 }" "${ROOT}proc/mounts" | tail -n 1 +} + +supported_boot_fs() { + local supported="ext2 ext3 ext4 btrfs xfs vfat" + if [ "$BOOTLOADER" = "grub" ]; then + local supported="$supported zfs" + fi + local fs= + if is_rpi; then + supported=vfat + fi + for fs in $supported; do + [ "$fs" = "$1" ] && return 0 + done + echo "$1 is not supported. Only supported are: $supported" >&2 + return 1 +} + +supported_part_label() { + case "$1" in + dos|gpt|eckd) return 0 ;; + *) die "Partition label \"$DISKLABEL\" is not supported!" ;; + esac +} + +find_volume_group() { + local lv="${1##*/}" + lvs --noheadings "$1" | awk '{print $2}' +} + +find_pvs_in_vg() { + local vg="$1" + pvs --noheadings | awk "\$2 == \"$vg\" {print \$1}" +} + +init_chroot_mounts() { + local mnt="$1" i= + for i in proc dev sys; do + mkdir -p "$mnt"/$i + $MOCK mount --bind /$i "$mnt"/$i + done +} + +cleanup_chroot_mounts() { + local mnt="$1" i= + for i in proc dev sys; do + umount "$mnt"/$i + done +} + +get_bootopt() { + local opt="$1" + set -- $(cat /proc/cmdline) + for i; do + case "$i" in + "$opt"|"$opt"=*) echo "${i#*=}"; break;; + esac + done +} + +find_efi_directory() { + local mnt="$1" dir= + for dir in efi boot/efi boot; do + case "$(find_mount_fs "$mnt"/$dir)" in + vfat|fat|msdos) + echo "$mnt"/$dir + return + ;; + esac + done + return 1 +} + +extract_squashfs() { + SQUASHFS_FILE="$1" + TARGET_DIR="$2" + SQUASH_MOUNT="/mnt/squash" + + # Create mount and target directories + if ! mkdir -p "$SQUASH_MOUNT" || ! mkdir -p "$TARGET_DIR"; then + echo "Error: Could not create directories." + return 1 + fi + + # Mount the squashfs file + echo "Mounting squashfs file..." + if ! mount -t squashfs -o loop "$SQUASHFS_FILE" "$SQUASH_MOUNT"; then + echo "Error: Could not mount squashfs file." + rmdir "$SQUASH_MOUNT" 2>/dev/null + return 1 + fi + + # Copy files and show progress + echo -n "Copying files to target directory..." + # Run cp in the background and display progress dots + cp -a "$SQUASH_MOUNT/." "$TARGET_DIR"/ 2>/dev/null & + CP_PID=$! + while kill -0 $CP_PID 2>/dev/null; do + echo -n "." + sleep 0.5 + done + echo " done." + + # Check if copy was successful + if ! wait $CP_PID; then + echo "Error: Could not copy files." + umount "$SQUASH_MOUNT" + rmdir "$SQUASH_MOUNT" 2>/dev/null + return 1 + fi + + # Clean up mount point + echo "Unmounting mount point..." + if ! umount "$SQUASH_MOUNT"; then + echo "Error: Could not unmount mount point." + return 1 + fi + rmdir "$SQUASH_MOUNT" 2>/dev/null + + echo "Squashfs file successfully extracted to: $TARGET_DIR" + return 0 +} +setup_grub() { + local mnt="$1" root="$2" modules="$3" kernel_opts="$4" bootdev="$5" + local disk= + shift 5 + if [ -n "$USE_EFI" ]; then + local target fwa + local efi_directory=$(find_efi_directory "$mnt") + case "$ARCH" in + x86_64) target=x86_64-efi ; fwa=x64 ;; + x86) target=i386-efi ; fwa=ia32 ;; + arm*) target=arm-efi ; fwa=arm ;; + aarch64) target=arm64-efi ; fwa=aa64 ;; + riscv64) target=riscv64-efi ; fwa=riscv64 ;; + loongarch64) target=loongarch64-efi ; fwa=loongarch64 ;; + esac + grub-install --target=$target --efi-directory="$efi_directory" \ + --bootloader-id=alpine --boot-directory="$mnt"/boot --no-nvram + install -D "$efi_directory"/EFI/alpine/grub$fwa.efi \ + "$efi_directory"/EFI/boot/boot$fwa.efi + elif [ "$ARCH" = "ppc64le" ]; then + for disk in "$@"; do + prep=$(find_partitions "$disk" "prep") + grub-install --boot-directory="$mnt"/boot $prep + done + else + case "$ARCH" in + x86|x86_64) + for disk in "$@"; do + grub-install --boot-directory="$mnt"/boot \ + --target=i386-pc "$disk" + done + ;; + *) die "Cannot install GRUB in BIOS mode for $ARCH" ;; + esac + fi + install -d "$mnt"/etc/default/ + cat > "$mnt"/etc/default/grub <<- EOF + GRUB_TIMEOUT=2 + GRUB_DISABLE_SUBMENU=y + GRUB_DISABLE_RECOVERY=true + GRUB_CMDLINE_LINUX_DEFAULT="modules=$modules $kernel_opts" + EOF + if [ "$(openrc --sys)" = "XEN0" ]; then + echo "GRUB_DEFAULT=1" >> "$mnt"/etc/default/grub + fi + case "$initfs_features" in + *zfs*) echo "GRUB_FS=zfs" >> "$mnt"/etc/default/grub;; + esac +} + +setup_syslinux() { + local mnt="$1" root="$2" modules="$3" kernel_opts="$4" bootdev="$5" + local exlinux_raidopt= + sed -e "s:^root=.*:root=$root:" \ + -e "s:^default_kernel_opts=.*:default_kernel_opts=\"$kernel_opts\":" \ + -e "s:^modules=.*:modules=$modules:" \ + /etc/update-extlinux.conf > "$mnt"/etc/update-extlinux.conf + if [ -e "${ROOT}sys/block/${bootdev#/dev/}/md" ]; then + extlinux_raidopt="--raid" + fi + extlinux $extlinux_raidopt --install "$mnt"/boot +} + +setup_uboot() { + local mnt="$1" root="$2" modules="$3" kernel_opts="$4" + local parameters="root=$root modules=$modules $kernel_opts" + mkdir -p "$mnt"/boot/extlinux + cat > "$mnt/boot/extlinux/extlinux.conf" <<- EOF + menu title Chronalinux + timeout 50 + default $KERNEL_FLAVOR + label $KERNEL_FLAVOR + menu label Linux $KERNEL_FLAVOR + kernel /vmlinuz-$KERNEL_FLAVOR + initrd /initramfs-$KERNEL_FLAVOR + fdtdir /dtbs-$KERNEL_FLAVOR + append $parameters + EOF + update-u-boot +} + +setup_raspberrypi_bootloader() { + local mnt="$1" root="$2" modules="$3" kernel_opts="$4" + mkdir -p "$mnt"/boot + echo "root=$root modules=$modules $kernel_opts" > "$mnt"/boot/cmdline.txt +} + +select_firmware_pkgs() { + local firmware_pkgs="$( (cd "${ROOT}sys/module/" 2>/dev/null && echo *) \ + | xargs modinfo -F firmware 2>/dev/null \ + | awk -F/ '{print $1 == $0 ? "linux-firmware-other" : "linux-firmware-"$1}' \ + | sort -u)" + # filter out non-existing packages like linux-firmware-b43 + # https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10530 + apk search --quiet --exact ${firmware_pkgs:-linux-firmware-none} +} + +is_nvme_dev() { + local i + for i; do + case ${i##*/} in + nvme*) return 0;; + esac + done + return 1 +} + +install_mounted_root() { + local mnt="$(realpath "$1")" + local squashfs_file="$2" + shift 2 + local disks="$@" mnt_boot= boot_fs= root_fs= use_crypt= + local initfs_features="ata base ide scsi usb virtio" + local pvs= dev= rootdev= cryptdev= bootdev= extlinux_raidopt= root= modules= + local kernel_opts="$KERNELOPTS" + [ "$ARCH" = "s390x" ] && initfs_features="$initfs_features qeth dasd_mod" + [ "$ARCH" = "aarch64" ] && initfs_features="$initfs_features phy" + is_rpi && initfs_features="base mmc usb" + rootdev=$(find_mount_dev "$mnt") + if [ -z "$rootdev" ]; then + echo "'$mnt' does not seem to be a mount point" >&2 + return 1 + fi + root_fs=$(find_mount_fs "$mnt") + initfs_features="$initfs_features $root_fs" + if [ "$root_fs" = "zfs" ]; then + initfs_features="$initfs_features keymap" + fi + if is_lvm "$rootdev"; then + initfs_features="$initfs_features lvm" + local vg="$(find_volume_group "$rootdev")" + pvs=$(find_pvs_in_vg $vg) + cryptdev=$(cryptsetup status $pvs 2>&1 | awk '/device:/ { print $2 }') + else + cryptdev=$(cryptsetup status "$rootdev" 2>&1 | awk '/device:/ { print $2 }') + fi + bootdev=$(find_mount_dev "$mnt"/boot) + if [ -z "$bootdev" ]; then + bootdev=$rootdev + mnt_boot="$mnt" + else + mnt_boot="$mnt"/boot + fi + boot_fs=$(find_mount_fs "$mnt_boot") + if [ "$BOOTLOADER" != none ] && ! supported_boot_fs "$boot_fs"; then + [ -z "$FORCE_BOOTFS" ] && return 1 + echo "Continuing at your own risk." + fi + extract_squashfs "$squashfs_file" "$mnt" + if [ -f "$mnt"/etc/fstab ]; then + mv "$mnt"/etc/fstab "$mnt"/etc/fstab.old + fi + mkdir -p "$mnt"/etc + enumerate_fstab "$mnt" >> "$mnt"/etc/fstab + if [ -n "$SWAP_DEVICES" ]; then + local swap_dev + for swap_dev in $SWAP_DEVICES; do + printf "%s\tnone\tswap\tdefaults\t0 0\n" \ + "$(uuid_or_device $swap_dev)" \ + >> "$mnt"/etc/fstab + done + fi + cat >>"$mnt"/etc/fstab <<-__EOF__ + /dev/cdrom /media/cdrom iso9660 noauto,ro 0 0 + /dev/usbdisk /media/usb vfat noauto 0 0 + tmpfs /tmp tmpfs nosuid,nodev 0 0 + __EOF__ + if crypt_required <"$mnt"/etc/fstab; then + use_crypt=1 + initfs_features="$initfs_features cryptsetup keymap" + if is_nvme_dev "${ROOT}sys/block"/dm-*/slaves/*; then + initfs_features="$initfs_features nvme" + fi + fi + mkdir -p "$mnt"/etc/mkinitfs/features.d + echo "features=\"$initfs_features\"" > "$mnt"/etc/mkinitfs/mkinitfs.conf + if [ -n "$raidmod" ]; then + echo "/sbin/mdadm" > "$mnt"/etc/mkinitfs/features.d/raid.files + echo "/etc/mdadm.conf" >> "$mnt"/etc/mkinitfs/features.d/raid.files + fi + root=$(uuid_or_device $rootdev) + kernel_opts="$kernel_opts rootfstype=$root_fs" + if [ -n "$(get_bootopt nomodeset)" ]; then + kernel_opts="nomodeset $kernel_opts" + fi + if [ "$use_crypt" ]; then + if [ $(echo "$pvs" | wc -w) -gt 1 ]; then + echo "Root logical volume spans more than one physical volume." + echo "This is currently unsupported." + echo "Proceed manually or retry with root on a single physical volume." + exit 1 + fi + local cryptroot="${pvs:-"$rootdev"}" + if cryptsetup status "$cryptroot" 2>&1 >/dev/null; then + cryptroot=$(cryptsetup status "$cryptroot" | awk '/device:/ { print $2 }') + cryptroot=$(uuid_or_device $cryptroot) + kernel_opts="cryptroot=$cryptroot cryptdm=root $kernel_opts" + root=$([ -n "$pvs" ] && echo "$rootdev" || echo "/dev/mapper/root") + fi + fi + modules="sd-mod,usb-storage,${root_fs}${raidmod}" + case "$initfs_features" in + *nvme*) modules="$modules,nvme" + if [ -e /sys/module/vmd ]; then + modules="$modules,vmd" + fi + ;; + esac + init_chroot_mounts "$mnt" + rc_add() { + mkdir -p "$mnt"/etc/runlevels/"$2" + ln -sf /etc/init.d/"$1" "$mnt"/etc/runlevels/"$2"/"$1" + } + # Essential sysinit services + for svc in devfs dmesg mdev hwdrivers; do + rc_add "$svc" sysinit + done + # Core boot services + for svc in modules sysctl hostname bootmisc syslog localmount; do + [ -e ""$mnt"/etc/init.d/$svc" ] && rc_add "$svc" boot + done + # Shutdown services + for svc in mount-ro killprocs savecache; do + rc_add "$svc" shutdown + done + # Optional services + for svc in dbus networkmanager alsa; do + [ -e ""$mnt"/etc/init.d/$svc" ] && rc_add "$svc" boot + done + case "$BOOTLOADER" in + none) ;; + grub) setup_grub "$mnt" "$root" "$modules" "$kernel_opts" "$bootdev" $disks ;; + syslinux) setup_syslinux "$mnt" "$root" "$modules" "$kernel_opts" "$bootdev" ;; + zipl) setup_zipl "$mnt" "$root" "$modules" "$kernel_opts" ;; + raspberrypi-bootloader) setup_raspberrypi_bootloader "$mnt" "$root" "$modules" "$kernel_opts" ;; + u-boot) setup_uboot "$mnt" "$root" "$modules" "$kernel_opts" ;; + *) die "Bootloader \"$BOOTLOADER\" not supported!" ;; + esac + local apkflags="--quiet --allow-untrusted --no-interactive --progress" + pkgs="linux-lts $(select_bootloader_pkg) $(select_firmware_pkgs)" + if [ "$(openrc --sys)" = "XEN0" ]; then + pkgs="$pkgs xen-hypervisor" + fi + if is_rpi; then + pkgs="$pkgs dosfstools" + fi + apk add --root "$mnt" $apkflags $repoflags $pkgs + cleanup_chroot_mounts "$mnt" +} + +unmount_partitions() { + local mnt="$1" + umount $(awk '{print $2}' "${ROOT}proc/mounts" | grep -E "^$mnt(/|\$)" | sort -r) + if [ -n "$USE_CRYPT" ]; then + if [ -n "$USE_LVM" ]; then + vgchange -a n + fi + cryptsetup close /dev/mapper/root + fi +} + +find_swap_size() { + local memtotal_kb="$(awk '$1 == "MemTotal:" {print $2}' /proc/meminfo)" + local size="$(( $memtotal_kb * 2 / 1024 ))" + local disk= disksize= + for disk in $@; do + local sysfsdev="$(echo ${disk#/dev/} | sed 's:/:!:g')" + local sysfspath="${ROOT}sys/block/$sysfsdev/size" + maxsize=$(awk '{ printf "%i", $0 / 8192 }' $sysfspath ) + if [ $size -gt $maxsize ]; then + size=$maxsize + fi + done + if [ $size -gt 4096 ]; then + size=4096 + elif [ $size -lt 64 ]; then + size=0 + fi + echo $size +} + +find_efi_size() { + local blocksize=$(cat $(echo "$@" | sed -E "s:/?dev/([^ ]+):${ROOT}sys/block/\1/queue/logical_block_size:g") \ + | sort -n | tail -n 1 || echo 512) + local disksize_blk=$(cat $(echo "$@" | sed -E "s:/?dev/([^ ]+):${ROOT}sys/block/\1/size:g") \ + | sort -n | tail -n 1 || echo 0) + local disksize_mb=$(( blocksize * disksize_blk / 1024 / 1024 )) + local min_size=$(( blocksize * 64 / 1000 + 2 )) + local size=160 + if [ $disksize_mb -gt 8192 ]; then + size=512 + elif [ $disksize_mb -gt 2048 ]; then + size=264 + fi + echo $(( size > min_size ? size : min_size )) +} + +has_mounted_part() { + local p + local sysfsdev="$(echo ${1#/dev/} | sed 's:/:!:g')" + for p in $(awk '$1 ~ /^\/dev\// {gsub("/dev/", "", $1); gsub("/", "!", $1); print $1}' \ + "${ROOT}proc/mounts" 2>/dev/null); do + [ "$p" = "$sysfsdev" ] && return 0 + [ -e "${ROOT}sys/block/$sysfsdev/$p" ] && return 0 + done + return 1 +} + +has_holders() { + local i + for i in $1/holders/* $1/*/holders/*; do + [ -e "$i" ] && return 0 + done + return 1 +} + +is_available_disk() { + local dev="$1" + has_mounted_part $dev && return 1 + if has_holders "${ROOT}sys/block/$dev"; then + [ -n "$USE_RAID" ] && echo "Warning: $dev is part of a running raid" >&2 + return 1 + fi + return 0 +} + +find_disks() { + local p= + for p in "${ROOT}sys/block"/*/device; do + local dev="${p%/device}" + dev=${dev#*/sys/block/} + if is_available_disk "$dev"; then + printf %s " $dev" + fi + done +} + +stop_all_raid() { + local rd + for rd in /dev/md*; do + [ -b $rd ] && mdadm --stop $rd + done +} + +select_bootloader_pkg() { + if [ "$BOOTLOADER" = none ]; then + return + fi + local bootloader="$BOOTLOADER" + if [ "$ARCH" = "ppc64le" ]; then + bootloader=grub-ieee1275 + elif [ "$ARCH" = "s390x" ]; then + bootloader=s390-tools + elif [ -n "$USE_EFI" ]; then + bootloader=grub-efi + elif [ "$BOOTLOADER" = "grub" ]; then + bootloader=grub-bios + fi + echo "$bootloader" +} + +init_progs() { + local raidpkg= lvmpkg= cryptpkg= fs= fstools= grub= + [ -n "$USE_RAID" ] && raidpkg="mdadm" + [ -n "$USE_LVM" ] && lvmpkg="lvm2" + [ -n "$USE_CRYPT" ] && cryptpkg="cryptsetup blkid" + for fs in $BOOTFS $ROOTFS $VARFS; do + if ! grep -q -w "$fs" /proc/filesystems; then + modprobe $fs + fi + case $fs in + xfs) fstools="$fstools xfsprogs";; + ext*) fstools="$fstools e2fsprogs";; + btrfs) fstools="$fstools btrfs-progs";; + vfat) fstools="$fstools dosfstools";; + esac + done + apk add --quiet --allow-untrusted $repoflags sfdisk squashfs-tools $cryptpkg $lvmpkg $raidpkg $fstools $@ +} + +show_disk_info() { + local disk= vendor= model= d= size= busid= + for disk in $@; do + local dev="${disk#/dev/}" + d=$(echo $dev | sed 's:/:!:g') + vendor=$(cat "${ROOT}sys/block/$d/device/vendor" 2>/dev/null) + model=$(cat "${ROOT}sys/block/$d/device/model" 2>/dev/null) + busid=$(readlink -f "${ROOT}sys/block/$d/device" 2>/dev/null) + size=$(awk '{gb = ($1 * 512)/1000000000; printf "%.1f GB\n", gb}' "${ROOT}sys/block/$d/size" 2>/dev/null) + if is_dasd $dev eckd; then + echo " $dev ($size $vendor ${busid##*/})" + else + echo " $dev ($size $vendor $model)" + fi + done +} + +confirm_erase() { + local erasedisks="$@" + if [ "$ERASE_DISKS" = "$erasedisks" ]; then + return 0 + fi + printf "\n" + echo "WARNING: The following disk(s) will be erased:" + show_disk_info $@ + printf "\n" + ask_yesno "WARNING: Erase the above disk(s) and continue? (y/n)" n +} + +setup_partitions() { + local diskdev="${ROOT}${1#/}" + shift + supported_part_label "$DISKLABEL" || return 1 + echo "label: $DISKLABEL" | sfdisk --quiet "$diskdev" + if [ "$BOOTLOADER" = "syslinux" ] && [ -f "$MBR" ]; then + cat "$MBR" > "$diskdev" + fi + ( + for line in "$@"; do + case "$line" in + 0M*) ;; + *=*) echo "$line";; + *) echo ",$line" ;; + esac + done + ) | sfdisk --quiet --wipe-partitions always --label "$DISKLABEL" "$diskdev" || return 1 +} + +setup_boot_dev() { + local disks="$@" disk= bootdev= mkfs_args= + [ "$BOOTFS" != "vfat" ] && mkfs_args="-q" + local part="$(for disk in $disks; do find_partitions "$disk" "boot"; done)" + set -- $part + bootdev=$1 + [ -z "$bootdev" ] && return 1 + if [ "$ARCH" = "ppc64le" ]; then + for disk in $disks; do + echo ',,,*' | sfdisk --quiet $disk -N1 + echo ',,,-' | sfdisk --quiet $disk -N2 + done + $MOCK mdev -s + fi + echo "Creating file systems..." + if [ -n "$USE_RAID" ]; then + local missing= + local num=$# + if [ $# -eq 1 ]; then + missing="missing" + num=2 + fi + mdadm --create /dev/md0 --level=1 --raid-devices=$num \ + --metadata=0.90 --quiet --run $@ $missing || return 1 + bootdev=/dev/md0 + fi + case "$BOOTFS" in + vfat) mkfs_args="-F 32";; + btrfs) mkfs_args="";; + ext4) mkfs_args="$mkfs_args -O ^64bit";; + esac + $MOCK mkfs.$BOOTFS $MKFS_OPTS_BOOT $mkfs_args $bootdev + BOOT_DEV="$bootdev" +} + +find_nth_non_boot_parts() { + local idx="$1" id="$2" disk= type=bootable + shift 2 + local disks="$@" + local search="bootable" + if [ -n "$USE_EFI" ]; then + search="$(partition_id esp)" + elif [ "$DISKLABEL" = "gpt" ]; then + search="LegacyBIOSBootable" + fi + for disk in $disks; do + if is_dasd $disk eckd; then + fdasd -p $disk | grep "Linux $id" | awk '{print $1}' | tail -n 1 + else + sfdisk -d "${ROOT}${disk#/}" | grep -v "$search" \ + | awk "/(Id|type)=$id/ { i++; if (i==$idx) print \$1 }" + fi + done +} + +setup_non_boot_raid_dev() { + local md_dev="$1" + local idx="${md_dev#/dev/md}" + [ -z "$md_dev" ] && return 0 + if [ "$ARCH" = "ppc64le" ]; then + idx=$((idx+1)) + fi + shift + local level=1 + local missing= + local pid="$(partition_id raid)" + local raid_parts="$(find_nth_non_boot_parts $idx $pid $@)" + set -- $raid_parts + case $# in + 0) echo "No Raid partitions found" >&2; return 1;; + 1) level=1; missing="missing"; num=2;; + 2) level=1; missing= ; num=2;; + *) level=5; missing= ; num=$#;; + esac + mdadm --create $md_dev --level=$level --raid-devices=$num \ + --quiet --run $@ $missing || return 1 +} + +setup_lvm_volume_group() { + local vgname="$1" + shift + local lvmdev= + if [ -n "$USE_RAID" ]; then + setup_non_boot_raid_dev /dev/md1 $@ || return 1 + lvmdev=/dev/md1 + else + lvmdev=$(find_partitions "$1" "lvm") + fi + if [ -n "$USE_CRYPT" ] && [ "$DISK_MODE" = "data" ]; then + printf "target=var\nsource='%s'\n" "$lvmdev" > /etc/conf.d/dmcrypt + lvmdev=$(setup_crypt $lvmdev var) || return 1 + rc-update add dmcrypt boot + fi + if [ -n "$USE_CRYPT" ] && [ "$DISK_MODE" = "sys" ]; then + lvmdev=$(setup_crypt $lvmdev root) || return 1 + fi + local errmsg="$(dd if=/dev/zero of=$lvmdev bs=1k count=1 2>&1)" \ + || echo "$errmsg" + pvcreate --quiet $lvmdev \ + && vgcreate --quiet $vgname $lvmdev >/dev/null +} + +setup_swap_dev() { + local swap_dev= + sed -i -e '/swap/d' "${ROOT}etc/fstab" + SWAP_DEVICES= + for swap_dev in "$@"; do + $MOCK mkswap $swap_dev >/dev/null + printf "%s\tnone\t\tswap\tdefaults 0 0\n" \ + "$(uuid_or_device $swap_dev)" >> "${ROOT}etc/fstab" + SWAP_DEVICES="$SWAP_DEVICES $swap_dev" + done + swapon -a + rc-update --quiet add swap boot +} + +setup_lvm_swap() { + local vgname="$1" + local swapname=lv_swap + if [ -z "$SWAP_SIZE" ] || [ "$SWAP_SIZE" -eq 0 ]; then + return + fi + lvcreate --quiet -n $swapname -L ${SWAP_SIZE}MB $vgname + setup_swap_dev /dev/$vgname/$swapname +} + +reset_var() { + [ -z "$(find_mount_dev /var)" ] && return 0 + mkdir /.var + mv /var/* /.var/ 2>/dev/null + umount /var && rm -rf /var && mv /.var /var && rm -rf /var/lost+found +} + +setup_var() { + local var_dev="$1" + local varfs="${VARFS}" + echo "Creating file systems..." + mkfs.$varfs $MKFS_OPTS_VAR $var_dev >/dev/null || return 1 + sed -i -e '/[[:space:]]\/var[[:space:]]/d' /etc/fstab + printf "%s\t/var\t\t%s\tdefaults 1 2\n" \ + "$(uuid_or_device $var_dev)" "$varfs" >> /etc/fstab + mv /var /.var + mkdir /var + mount /var + mv /.var/* /var/ + rmdir /.var + service syslog --quiet condrestart + setup_mdadm_conf +} + +setup_mdadm_conf() { + local mods= mod= + if [ -n "$USE_RAID" ]; then + mdadm --detail --scan > /etc/mdadm.conf + rc-update --quiet add mdadm-raid boot + mods=$(awk '/^raid/ {print $1}' /proc/modules) + for mod in $mods; do + if ! grep -q "^$mod" /etc/modules; then + echo $mod >> /etc/modules + fi + done + fi +} + +data_only_disk_install_lvm() { + local diskdev= + local vgname=vg0 + local var_dev="/dev/$vgname/lv_var" + local lvm_part_type="$(partition_id lvm)" + local size="$LVM_SIZE" + unset BOOTLOADER + init_progs || return 1 + confirm_erase $@ || return 1 + if [ "$USE_RAID" ]; then + lvm_part_type=$(partition_id raid) + stop_all_raid + fi + for diskdev in "$@"; do + setup_partitions $diskdev "${size}${size:+M},$lvm_part_type" || return 1 + done + $MOCK mdev -s + setup_lvm_volume_group $vgname $@ || return 1 + setup_lvm_swap $vgname + lvcreate --quiet -n ${var_dev##*/} -l 100%FREE $vgname + setup_mdadm_conf + rc-update add lvm boot + setup_var $var_dev +} + +data_only_disk_install() { + local diskdev= + local var_dev= + local var_part_type="$(partition_id linux)" + local swap_part_type="$(partition_id swap)" + local size= + local swap_dev= var_dev= + unset BOOTLOADER + init_progs || return 1 + confirm_erase $@ || return 1 + if [ "$USE_RAID" ]; then + var_part_type=$(partition_id raid) + swap_part_type=$(partition_id raid) + stop_all_raid + fi + for diskdev in "$@"; do + setup_partitions $diskdev \ + "${SWAP_SIZE}M,$swap_part_type" \ + "${size}${size:+M},$var_part_type" || return 1 + done + $MOCK mdev -s + if [ "$USE_RAID" ]; then + if [ $SWAP_SIZE -gt 0 ]; then + swap_dev=/dev/md1 + var_dev=/dev/md2 + else + swap_dev= + var_dev=/dev/md1 + fi + setup_non_boot_raid_dev "$swap_dev" $@ || return 1 + setup_non_boot_raid_dev "$var_dev" $@ || return 1 + else + swap_dev=$(find_nth_non_boot_parts 1 "$swap_part_type" $@) + var_dev=$(find_nth_non_boot_parts 1 "$var_part_type" $@) + fi + if [ -n "$USE_CRYPT" ]; then + printf "target=var\nsource='%s'\n" "$var_dev" > /etc/conf.d/dmcrypt + var_dev=$(setup_crypt $var_dev var) || return 1 + rc-update add dmcrypt boot + fi + [ $SWAP_SIZE -gt 0 ] && setup_swap_dev $swap_dev + setup_var $var_dev +} + +setup_root() { + local root_dev="$1" boot_dev="$2" squashfs_file="$3" + shift 3 + local disks="$@" mkfs_args="-q" + local sysroot="${ROOT}${SYSROOT#/}" + [ "$ROOTFS" = "btrfs" ] && mkfs_args="" + $MOCK mkfs.$ROOTFS $MKFS_OPTS_ROOT $mkfs_args "$root_dev" + mkdir -p "$sysroot" + mount -t "$ROOTFS" "$root_dev" "$sysroot" || return 1 + if [ -n "$boot_dev" ]; then + if [ -n "$USE_EFI" ] && [ -z "$USE_CRYPT" ]; then + mkdir -p "$sysroot"/boot/efi + mount -t "$BOOTFS" "$boot_dev" "$sysroot"/boot/efi || return 1 + else + mkdir -p "$sysroot"/boot + mount -t "$BOOTFS" "$boot_dev" "$sysroot"/boot || return 1 + fi + fi + setup_mdadm_conf + install_mounted_root "$sysroot" "$squashfs_file" "$disks" || return 1 + $MOCK swapoff -a + unmount_partitions "$sysroot" + echo "" + echo "Installation is complete. Please reboot." +} + +native_disk_install_lvm() { + local diskdev= vgname=vg0 + local lvm_part_type="$(partition_id lvm)" + local boot_part_type="$(partition_id linux)" + local boot_size="${BOOT_SIZE:-300}" + local lvm_size="$LVM_SIZE" + local root_dev=/dev/$vgname/lv_root + local biosboot= + local squashfs_file="$SHAANFS" + init_progs $(select_bootloader_pkg) || return 1 + confirm_erase $@ || return 1 + if [ "$BOOTFS" = "vfat" ] && [ "$DISKLABEL" = "dos" ]; then + boot_part_type=$(partition_id vfat) + fi + if [ -n "$USE_RAID" ]; then + boot_part_type=$(partition_id raid) + lvm_part_type=$(partition_id raid) + stop_all_raid + fi + if [ -n "$USE_EFI" ]; then + boot_part_type=$(partition_id esp) + elif [ "$DISKLABEL" = "gpt" ]; then + biosboot="2M,$(partition_id biosboot)" + fi + for diskdev in "$@"; do + if is_dasd $diskdev eckd; then + root_part_type="lvm" + setup_partitions_eckd $diskdev \ + $boot_size 0 $root_part_type || return 1 + else + setup_partitions $diskdev \ + $biosboot \ + "${boot_size}M,$boot_part_type,*" \ + "${lvm_size}${lvm_size:+M},$lvm_part_type" || return 1 + if [ "$DISKLABEL" = "gpt" ] && [ -z "$USE_EFI" ]; then + sfdisk --part-attrs "${ROOT}${diskdev#/}" 2 LegacyBIOSBootable + fi + fi + done + $MOCK mdev -s + setup_boot_dev $@ + setup_lvm_volume_group $vgname $@ || return 1 + setup_lvm_swap $vgname + lvcreate --quiet -n ${root_dev##*/} -l ${ROOT_SIZE:-100%FREE} $vgname + rc-update add lvm boot + setup_root "$root_dev" "$BOOT_DEV" "$squashfs_file" "$@" +} + +setup_crypt() { + local dev="$1" local dmname="$2" + mkdir -p /run/cryptsetup + while true; do + echo "Preparing partition for encryption." >&2 + echo "You will be prompted for your password at boot." >&2 + echo "If you forget your password, your data will be lost." >&2 + cryptsetup luksFormat --batch-mode --verify-passphrase \ + --type luks2 "$dev" >&2 + case $? in + 2) continue;; + 0) ;; + *) return 1;; + esac + echo "Enter password again to unlock disk for installation." >&2 + cryptsetup open "$dev" "$dmname" >&2 \ + && break + echo "" >&2 + done + echo "/dev/mapper/$dmname" + return 0 +} + +native_disk_install() { + local prep_part_type="$(partition_id prep)" + local root_part_type="$(partition_id linux)" + local swap_part_type="$(partition_id swap)" + local boot_part_type="$(partition_id linux)" + local prep_size=8 + local boot_size="${BOOT_SIZE:-300}" + local swap_size="${SWAP_SIZE}" + local root_size="${ROOT_SIZE}" + local root_dev= boot_dev= swap_dev= biosboot= + local squashfs_file="$SHAANFS" + init_progs $(select_bootloader_pkg) || return 1 + confirm_erase $@ || return 1 + if [ "$BOOTFS" = "vfat" ] && [ "$DISKLABEL" = "dos" ]; then + boot_part_type=$(partition_id vfat) + fi + if [ -n "$USE_RAID" ]; then + boot_part_type=$(partition_id raid) + root_part_type=$(partition_id raid) + swap_part_type=$(partition_id raid) + stop_all_raid + fi + if [ -n "$USE_EFI" ]; then + boot_part_type=$(partition_id esp) + elif [ "$DISKLABEL" = "gpt" ]; then + biosboot="2M,$(partition_id biosboot)" + fi + for diskdev in "$@"; do + if [ "$ARCH" = "ppc64le" ]; then + setup_partitions $diskdev \ + "${prep_size}M,$prep_part_type" \ + "${boot_size}M,$boot_part_type,*" \ + "${swap_size}M,$swap_part_type" \ + "${root_size}${root_size:+M},$root_part_type" \ + || return 1 + elif is_dasd $diskdev eckd; then + swap_part_type="swap" + root_part_type="native" + setup_partitions_eckd $diskdev \ + $boot_size $swap_size $root_part_type || return 1 + else + setup_partitions $diskdev \ + $biosboot \ + "${boot_size}M,$boot_part_type,*" \ + "${swap_size}M,$swap_part_type" \ + "${root_size}${root_size:+M},$root_part_type" \ + || return 1 + if [ "$DISKLABEL" = "gpt" ] && [ -z "$USE_EFI" ]; then + sfdisk --part-attrs "${ROOT}${diskdev#/}" 2 LegacyBIOSBootable + fi + fi + done + $MOCK mdev -s + setup_boot_dev $@ + if [ "$USE_RAID" ]; then + if [ $SWAP_SIZE -gt 0 ]; then + swap_dev=/dev/md1 + root_dev=/dev/md2 + else + swap_dev= + root_dev=/dev/md1 + fi + setup_non_boot_raid_dev "$swap_dev" $@ || return 1 + setup_non_boot_raid_dev "$root_dev" $@ || return 1 + else + swap_dev=$(find_nth_non_boot_parts 1 "$swap_part_type" $@) + local index= + case "$ARCH" in + ppc64le) index=2;; + *) index=1;; + esac + root_dev=$(find_nth_non_boot_parts $index "$root_part_type" $@) + fi + if [ -n "$USE_CRYPT" ]; then + root_dev=$(setup_crypt $root_dev root) || return 1 + fi + [ $SWAP_SIZE -gt 0 ] && setup_swap_dev $swap_dev + setup_root $root_dev $BOOT_DEV "$squashfs_file" $@ +} + +diskselect_help() { + cat <<-__EOF__ + + The disk you select can be used for a traditional disk install or for a + data-only install. + + The disk will be erased. + + Enter 'none' if you want to run diskless. + + __EOF__ +} + +diskmode_help() { + cat <<-__EOF__ + + You can select between 'sys', 'data', 'crypt', 'cryptsys', 'lvm', 'lvmsys' + or 'lvmdata'. + + sys: + This mode is a traditional disk install. The following partitions will be + created on the disk: /boot, / (filesystem root) and swap. + + This mode may be used for development boxes, desktops, virtual servers, etc. + + data: + This mode uses your disk(s) for data storage, not for the operating system. + The system itself will run from tmpfs (RAM). + + Use this mode if you only want to use the disk(s) for a mailspool, databases, + logs, etc. + + crypt: + Enable encryption with cryptsetup and ask again for 'sys' or 'data'. + You will be prompted to enter a decryption password, and will need to + use this password to boot up the operating system after installation. + + cryptsys: + Same as 'sys' but also enable encryption. + + lvm: + Enable logical volume manager and ask again for 'sys' or 'data'. + + lvmsys: + Same as 'sys' but use logical volume manager for partitioning. + + lvmdata: + Same as 'data' but use logical volume manager for partitioning. + + __EOF__ +} + +ask_disk() { + local prompt="$1" + local help_func="$2" + local i= + shift 2 + local default_disk="${DEFAULT_DISK:-$1}" + resp= + while ! all_in_list "$resp" $@ "none" "abort"; do + echo "Available disks are:" + show_disk_info "$@" + printf "\n" + ask "$prompt" "$default_disk" + case "$resp" in + 'abort') exit 0;; + 'none') return 0;; + '?') $help_func;; + *) for i in $resp; do + if ! [ -b "/dev/$i" ]; then + echo "/dev/$i is not a block device" >&2 + resp= + fi + done;; + esac + done +} + +usage() { + cat <<-__EOF__ + usage: setup-disk [-hLqrve] [-k kernelflavor] [-m MODE] [-o apkovl] [-s SWAPSIZE] + [-w FILE] [MOUNTPOINT | DISKDEV...] + + Install Chronalinux on harddisk using squashfs. + + If MOUNTPOINT is specified, then do a traditional disk install with MOUNTPOINT + as root. + + If DISKDEV is specified, then use the specified disk(s) without asking. If + multiple disks are specified then set them up in a RAID array. If there are + more than 2 disks, then use raid level 5 instead of raid level 1. + + options: + -h Show this help + -e Encrypt disk + -m Use disk for MODE without asking, where MODE is either 'data' or 'sys' + -o Restore system from given apkovl file (not used with squashfs) + -k Use kernelflavor instead of $KERNEL_FLAVOR + -L Use LVM to manage partitions + -q Exit quietly if no disks are found + -r Enable software raid1 with single disk + -s Use SWAPSIZE MB instead of autodetecting swap size (Use 0 to disable swap) + -v Be more verbose about what is happening + -w Write selected install mode to FILE + + __EOF__ + exit $1 +} + +write_disk_mode() { + if [ -n "$WRITE_DISK_MODE_FILE" ]; then + echo "$DISK_MODE" > "$WRITE_DISK_MODE_FILE" + fi +} + +kver=$(uname -r) +case $kver in + *-rc[0-9]*) KERNEL_FLAVOR=lts;; + *-[a-z]*) KERNEL_FLAVOR=${kver##*-};; + *) KERNEL_FLAVOR=lts;; +esac + +if [ -n "$SETUP_DISK_TESTFUNC" ]; then + $SETUP_DISK_TESTFUNC "$@" + exit +fi + +USE_CRYPT= +DISK_MODE= +USE_LVM= +while getopts "hek:Lm:o:qrs:vw:" opt; do + case $opt in + e) USE_CRYPT="_crypt";; + h) usage 0;; + m) DISK_MODE="$OPTARG";; + k) KERNEL_FLAVOR="$OPTARG";; + L) USE_LVM="_lvm";; + o) APKOVL="$OPTARG";; + q) QUIET=1;; + r) USE_RAID=1;; + s) SWAP_SIZE="$OPTARG";; + v) VERBOSE=1;; + w) WRITE_DISK_MODE_FILE="$OPTARG";; + '?') usage "1" >&2;; + esac +done +shift $(( $OPTIND - 1)) + +if [ "$DISK_MODE" = "none" ] || [ "$1" = "none" ]; then + exit 0 +fi + +if is_rpi; then + : ${BOOTLOADER:=raspberrypi-bootloader} + BOOTFS=vfat + SWAP_SIZE=0 +fi + +if is_efi || [ -n "$USE_EFI" ]; then + USE_EFI=1 + DISKLABEL=gpt + BOOTFS=vfat +fi + +if [ "$DISKLABEL" = "gpt" ]; then + : ${BOOTLOADER:=grub} +fi + +ARCH=$(apk --print-arch) +case "$ARCH" in + x86*) : ${BOOTLOADER:=syslinux};; + ppc64le) : ${BOOTLOADER:=grub};; + s390x) : ${BOOTLOADER:=zipl};; + arm*|aarch64) : ${BOOTLOADER:=u-boot};; +esac + +if [ -d "$1" ]; then + apk add --quiet --allow-untrusted $repoflags $(select_bootloader_pkg) + install_mounted_root "${1%/}" "$SHAANFS" || exit + if [ -z "$USE_EFI" ] && [ "$ARCH" = "x86_64" -o "$ARCH" = x86 ]; then + echo "You might need fix the MBR to be able to boot" >&2 + fi + write_disk_mode + exit 0 +fi + +reset_var +$MOCK swapoff -a +$MOCK vgchange --ignorelockingfailure -a n >/dev/null 2>&1 + +if [ -n "$USE_RAID" ]; then + stop_all_raid +fi + +check_dasd + +diskdevs= +while [ -z "$disks" ]; do + disks=$(find_disks) + [ -n "$disks" ] && break + modloop_media=$(find_modloop_media) + if [ -z "$modloop_media" ] || ! ask_yesno "No disks available. Try boot media $modloop_media? (y/n)" n; then + [ -z "$QUIET" ] && echo "No disks found." >&2 + exit 0 + fi + DO_UMOUNT=1 modloop_media=$modloop_media copy-modloop +done + +if [ $# -gt 0 ]; then + for i in "$@"; do + j=$(readlink -f "$i" | sed 's:^/dev/::; s:/:!:g') + if ! [ -e "${ROOT}sys/block/$j/device" ]; then + die "$i is not a block device suitable for partitioning" + fi + diskdevs="$diskdevs $i" + done +else + ask_disk "Which disk(s) would you like to use? (or '?' for help or 'none')" \ + diskselect_help $disks + if [ "$resp" = "none" ]; then + exit 0 + fi + for i in $resp; do + diskdevs="$diskdevs /dev/$i" + done +fi + +if [ -z "$SWAP_SIZE" ]; then + SWAP_SIZE=$(find_swap_size $diskdevs) +fi + +if [ -n "$diskdevs" ] && [ -z "$DISK_MODE" ]; then + resp= + disk_is_or_disks_are="disk is" + it_them="it" + set -- $diskdevs + if [ $# -gt 1 ]; then + disk_is_or_disks_are="disks are" + it_them="them" + fi + while true; do + printf "\nThe following %s selected" "$disk_is_or_disks_are" + [ -n "$USE_CRYPT" ] && [ -z "$USE_LVM" ] && printf %s " (with encryption)" + [ -z "$USE_CRYPT" ] && [ -n "$USE_LVM" ] && printf %s " (with LVM)" + [ -n "$USE_CRYPT" ] && [ -n "$USE_LVM" ] && printf %s " (with LVM on LUKS)" + printf ":\n" + show_disk_info $diskdevs + _crypt=$([ -z "$USE_CRYPT" ] && [ -z "$USE_LVM" ] && echo ", 'crypt'") + _lvm=${USE_LVM:-", 'lvm'"} + printf "\n" + ask "How would you like to use $it_them? ('sys', 'data'$_crypt${_lvm#_lvm} or '?' for help)" "?" + case "$resp" in + '?') diskmode_help;; + sys|data) break;; + lvm) USE_LVM="_lvm" ;; + nolvm) USE_LVM="";; + crypt) + USE_CRYPT="_crypt" + if [ "$SWAP_SIZE" -gt 0 ]; then + USE_LVM="_lvm" + fi + ;; + nocrypt) USE_CRYPT="";; + lvmsys|lvmdata) + resp=${resp#lvm} + USE_LVM="_lvm" + break + ;; + cryptsys) + resp=${resp#crypt} + USE_CRYPT="_crypt" + if [ "$SWAP_SIZE" -gt 0 ]; then + USE_LVM="_lvm" + fi + break + ;; + esac + done + DISK_MODE="$resp" +fi + +if [ -n "$USE_EFI" ] && [ -z "$USE_CRYPT" ] && [ -z "$BOOT_SIZE" ]; then + BOOT_SIZE=$(find_efi_size $diskdevs) +fi + +set -- $diskdevs +if is_dasd $1 eckd; then + DISKLABEL=eckd +fi +if [ $# -gt 1 ]; then + USE_RAID=1 +fi + +$MOCK dmesg -n1 + +if [ -n "$USE_LVM" ] && ! grep -w -q device-mapper /proc/misc; then + modprobe dm-mod +fi + +write_disk_mode + +case "$DISK_MODE" in +sys) native_disk_install$USE_LVM $diskdevs;; +data) data_only_disk_install$USE_LVM $diskdevs;; +none) exit 0;; +*) die "Not a valid install mode: $DISK_MODE" ;; +esac diff --git a/main/chrona-live-boot/APKBUILD b/main/chrona-live-boot/APKBUILD new file mode 100644 index 0000000..beddd92 --- /dev/null +++ b/main/chrona-live-boot/APKBUILD @@ -0,0 +1,23 @@ +# Maintainer: Şahan Yılmaz +pkgname=chrona-live-boot +pkgver=1.1 +pkgrel=6 +pkgdesc="Live Packages for Chrona Linux" +url="https://chronalinux.org.tr" +arch="all" +license="MIT" +install="$pkgname.post-install" +subpackages="chrona-live-boot-openrc:openrc" +depends="chrona-live-boot-openrc" +package() { + mkdir -p "$pkgdir" +} +openrc() { + replaces="openrc" + mkdir -p "$subpkgdir" + source="clive.initd" + install -Dm755 clive.initd "$subpkgdir"/etc/init.d/clive + sha512sums="f83455ea6a0ca6de196199fc449a2a22e182e0c8e1a3726ed3da2c7153cff8d1919f95980fd3df0f82996b32384e0a779dd196fdca7d0bdc7c3f9f402496d39c clive.initd +" +} + diff --git a/main/chrona-live-boot/chrona-live-boot.post-install b/main/chrona-live-boot/chrona-live-boot.post-install new file mode 100644 index 0000000..2b4082f --- /dev/null +++ b/main/chrona-live-boot/chrona-live-boot.post-install @@ -0,0 +1,42 @@ +#!/bin/sh + +# Create the 'chrona-live' group (continue even if the command fails) +addgroup -S chrona-live || true + +# Create the 'chrona-live' user with basic settings +adduser -S -D -h /home/chrona-live -s /bin/sh -G chrona-live -g "Chrona Live User" chrona-live +echo "chrona-live:chrona-live" | chpasswd + +# Add the user to additional groups; attempt to create each group first +# tty group +addgroup tty || true +addgroup chrona-live tty + +# plugdev group +addgroup plugdev || true +addgroup chrona-live plugdev + +# audio group +addgroup audio || true +addgroup chrona-live audio + +# video group +addgroup video || true +addgroup chrona-live video + +# input group +addgroup input || true +addgroup chrona-live input + +# Configure udev rules for tty subsystem +mkdir -p /etc/udev/rules.d/ +echo "SUBSYSTEM==\"tty\", KERNEL==\"tty[0-9]*\", GROUP=\"tty\", MODE=\"0660\"" > /etc/udev/rules.d/99-tty.rules + +# Create messagebus group and user for D-Bus +addgroup -S messagebus 2>/dev/null +adduser -S -D -H -h /dev/null -s /sbin/nologin -G messagebus -g messagebus messagebus 2>/dev/null + +# Confirm user setup +echo "chrona-live user created and added to plugdev, tty, audio, video, and input groups." + +exit 0 diff --git a/main/chrona-live-boot/clive.initd b/main/chrona-live-boot/clive.initd new file mode 100644 index 0000000..69a87fe --- /dev/null +++ b/main/chrona-live-boot/clive.initd @@ -0,0 +1,148 @@ +#!/sbin/openrc-run + +depend() { + before networkmanager +} + +# Check if a specific package is installed +check_pkg() { + # -e option lists only installed packages + apk info -e "$1" >/dev/null 2>&1 + return $? +} + +# Configure .xinitrc for cdesktop (icewm-session) +configure_xinitrc_for_cdesktop_icewm() { + XINITRC_PATH="/home/chrona-live/.xinitrc" + + # Skip if .xinitrc exists and already configured for icewm-session + if [ -f "$XINITRC_PATH" ] && grep -q "exec icewm-session" "$XINITRC_PATH"; then + return 0 + fi + + # Create .xinitrc with icewm-session configuration + cat > "$XINITRC_PATH" < "$XINITRC_PATH" < "$XINITRC_PATH" < "$XINITRC_PATH" < /etc/X11/Xwrapper.config + fi + + # Start appropriate session based on installed packages + if check_pkg clxqt; then + # Start clxqt service if clxqt package is installed + rc-service clxqt start + ret=$? + elif check_pkg mate-desktop-environment; then + # Configure and start mate session + configure_xinitrc_for_mate + su - chrona-live -c "startx" + ret=$? + elif check_pkg xfce4; then + # Configure and start xfce4 session + configure_xinitrc_for_xfce + su - chrona-live -c "startx" + ret=$? + elif check_pkg cdesktop-jwm; then + # Configure and start cdesktop (jwm) session + configure_xinitrc_for_cdesktop_jwm + su - chrona-live -c "startx" + ret=$? + elif check_pkg cdesktop-icewm; then + # Configure and start cdesktop (icewm) session + configure_xinitrc_for_cdesktop_icewm + su - chrona-live -c "startx" + ret=$? + else + # No action if no relevant packages are installed + ret=0 + fi + + eend $ret +} + +stop() { + ebegin "Stopping chrona-live session service" + # Perform session termination tasks + eend $? +} diff --git a/main/chrona-networkmanager-gtk/APKBUILD b/main/chrona-networkmanager-gtk/APKBUILD new file mode 100644 index 0000000..e5ff764 --- /dev/null +++ b/main/chrona-networkmanager-gtk/APKBUILD @@ -0,0 +1,33 @@ +# Maintainer: Şahan Yılmaz +pkgname=chrona-networkmanager-gtk +pkgver=1.0 +pkgrel=2 +pkgdesc="NetworkMamager GTK for Chrona Linux" +url="https://chrona.org.tr" +arch="all" +license="MIT" +depends="networkmanager networkmanager-wifi network-manager-applet wpa_supplicant" +replaces="networkmanager" +package() { + mkdir -p "$pkgdir" + mkdir -p "$pkgdir"/etc/NetworkManager + mkdir -p "$pkgdir"/etc/NetworkManager/conf.d + cat < "$pkgdir"/etc/NetworkManager/NetworkManager.conf +[main] +dhcp=internal +plugins=ifupdown,keyfile + +[ifupdown] +managed=true + +[device] +wifi.scan-rand-mac-address=yes +wifi.backend=wpa_supplicant +EOF + + cat < "$pkgdir"/etc/NetworkManager/conf.d/any-user.conf +[main] +auth-polkit=false +EOF + +} diff --git a/main/menumaker/APKBUILD b/main/menumaker/APKBUILD new file mode 100644 index 0000000..6626ac1 --- /dev/null +++ b/main/menumaker/APKBUILD @@ -0,0 +1,33 @@ +# Maintainer: Avis Orsetti +# Contributor: Dominika Liberda +pkgname=menumaker +pkgver=0.99.14 +pkgrel=1 +pkgdesc="Heuristics-driven menu generator for Deskmenu, FluxBox, IceWM, OpenBox, WindowMaker and XFCE" +url="https://menumaker.sourceforge.net/" +arch="all" +license="BSD-2-Clause" +depends="python3" +options="!check" # No tests provided +source="https://downloads.sourceforge.net/menumaker/menumaker-$pkgver.tar.gz" + +prepare() { + default_prepare + ./configure --prefix=/usr --infodir=/usr/share/info +} + +build() { + make +} + +package() { + mkdir -p "$pkgdir"/usr/bin + make DESTDIR="$pkgdir" pkgdatadir=/usr/lib/menumaker install + make DESTDIR="$pkgdir" PYTHON_BIN="python3" pkgdatadir=/usr/lib/menumaker install-exec-local + rm -rf "$pkgdir"/usr/share/info + install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/license +} + +sha512sums=" +81d44c1917d0fd4cd1c8b7cdd4ce12795fee7cc286959a7fc9dc6f84a096ea850a4348d98b6a7dce153c5d07fdb8b3aaf13f3476a9f34dd56646af3097d406d0 menumaker-0.99.14.tar.gz +" diff --git a/main/netsurf/APKBUILD b/main/netsurf/APKBUILD new file mode 100644 index 0000000..71d5046 --- /dev/null +++ b/main/netsurf/APKBUILD @@ -0,0 +1,95 @@ +# Contributor: Sören Tempel +# Contributor: ScrumpyJack +# Contributor: Miles Alan +# Maintainer: ScrumpyJack +pkgname=netsurf +pkgver=3.11 +pkgrel=0 +pkgdesc="free, open source web browser" +url="http://www.netsurf-browser.org" +arch="all" +license="GPL-2.0-or-later" +makedepends="curl-dev openssl-dev doxygen flex bison libwebp-dev lcms2-dev + libmng-dev gperf gtk+3.0-dev libcurl libpng-dev libidn-dev + check-dev libharu-dev librsvg-dev libjpeg-turbo-dev vim + perl perl-html-parser sdl12-compat-dev expat-dev" +subpackages=" + $pkgname-doc + $pkgname-framebuffer + $pkgname-framebuffer-doc +" +source="http://download.netsurf-browser.org/netsurf/releases/source-full/netsurf-all-$pkgver.tar.gz + netsurf + non-coreutils-install-compatibility.patch" + +builddir="$srcdir"/$pkgname-all-$pkgver + +export CFLAGS="$CFLAGS -fcommon" + +prepare() { + default_prepare + sed 's:-Werror::' -i "$builddir"/libsvgtiny/Makefile +} + +build() { + make \ + TARGET=gtk3 \ + LIBDIR=lib \ + INCLUDEDIR=include \ + PREFIX=/usr + + make \ + TARGET=framebuffer \ + LIBDIR=lib \ + INCLUDEDIR=include \ + PREFIX=/usr +} + +package() { + make \ + TARGET=gtk3 \ + LIBDIR=lib \ + INCLUDEDIR=include \ + DESTDIR="$pkgdir" \ + PREFIX=/usr \ + install + + install -Dm755 "$srcdir/netsurf" "$pkgdir/usr/bin/$pkgname" + install -Dm644 netsurf/docs/netsurf-gtk.1 -t "$pkgdir"/usr/share/man/man1 + + # Icon + install -Dm644 netsurf/frontends/gtk/res/netsurf.xpm \ + "$pkgdir"/usr/share/pixmaps/netsurf.xpm + + # Desktop file + install -Dm644 netsurf/frontends/gtk/res/netsurf-gtk.desktop \ + "$pkgdir"/usr/share/applications/netsurf.desktop + + # Run netsurf, not netsurf-gtk + sed \ + -e 's:netsurf-gtk:netsurf:g' \ + -e 's:netsurf.png:netsurf:g' \ + -i "$pkgdir"/usr/share/applications/netsurf.desktop +} + +framebuffer() { + pkgdesc="$pkgdesc (framebuffer)" + + cd "$builddir" + make \ + TARGET=framebuffer \ + LIBDIR=lib \ + INCLUDEDIR=include \ + PREFIX=/usr \ + DESTDIR="$subpkgdir" \ + install + + install -Dm755 netsurf/nsfb "$subpkgdir/usr/bin/netsurf-framebuffer" + install -Dm644 netsurf/docs/netsurf-fb.1 -t "$pkgdir"/usr/share/man/man1 +} + +sha512sums=" +f931687e08976ca336762587cc1ac75e45518be62b19d1d31aac3063b92b9666f8a022ff3a183e80c89404ba8ff33458b26521130e96943043085a42291ee283 netsurf-all-3.11.tar.gz +4f6868f377abb1fbade92088bee9a319952c4cee82821ca5b3f892484e0d111f33045c8583f3d069e48af6f3f2fcad43c364daa0f5457b3b013542793ac10fcf netsurf +528a0d085afcf089789fc2e2aafa27e48c71f9eba1eeed65ba293ccb9c60187193d8e36337ff56b9de8221821d6cb2a4146e175edb383f7a6ef660771c8a1e28 non-coreutils-install-compatibility.patch +" diff --git a/main/netsurf/netsurf b/main/netsurf/netsurf new file mode 100644 index 0000000..30b6c52 --- /dev/null +++ b/main/netsurf/netsurf @@ -0,0 +1,7 @@ +#!/bin/sh +shortname=$(echo $LANG | cut -b1-2) +if [ -d /usr/share/netsurf/$shortname ]; then + /usr/bin/netsurf-gtk3 "$@" +else + LANG=en /usr/bin/netsurf-gtk3 "$@" +fi diff --git a/main/netsurf/non-coreutils-install-compatibility.patch b/main/netsurf/non-coreutils-install-compatibility.patch new file mode 100644 index 0000000..de5374d --- /dev/null +++ b/main/netsurf/non-coreutils-install-compatibility.patch @@ -0,0 +1,27 @@ +Alpine / busybox's install doesn't have coreutils' -T option. + +--- a/netsurf/frontends/framebuffer/Makefile ++++ b/netsurf/frontends/framebuffer/Makefile +@@ -200,10 +200,10 @@ NETSURF_FRAMEBUFFER_RESOURCE_LIST := adblock.css credits.html \ + install-framebuffer: + $(VQ)echo " INSTALL: $(DESTDIR)/$(PREFIX)" + $(Q)$(INSTALL) -d $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN) +- $(Q)$(INSTALL) -T $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)/netsurf-fb ++ $(Q)$(INSTALL) $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)/netsurf-fb + $(Q)$(INSTALL) -d $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES) + $(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do $(INSTALL) -m 644 $(FRONTEND_RESOURCES_DIR)/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done +- $(Q)$(INSTALL) -m 644 -T $(MESSAGES_TARGET)/en/Messages $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES)/Messages ++ $(Q)$(INSTALL) -m 644 $(MESSAGES_TARGET)/en/Messages $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES)/Messages + + # ---------------------------------------------------------------------------- + # Package target +--- a/buildsystem/makefiles/Makefile.tools ++++ b/buildsystem/makefiles/Makefile.tools +@@ -285,7 +285,7 @@ GENHTML ?= genhtml + + BUILD_CXX ?= c++ + +-INSTALL ?= install -C ++INSTALL ?= install + + LCOV ?= lcov diff --git a/main/qastools/APKBUILD b/main/qastools/APKBUILD new file mode 100644 index 0000000..fc15db6 --- /dev/null +++ b/main/qastools/APKBUILD @@ -0,0 +1,39 @@ +# Contributor: A. Wilcox +# Maintainer: A. Wilcox +pkgname=qastools +pkgver=0.23.0 +pkgrel=0 +pkgdesc="ALSA mixer and utilities for Qt" +url="https://gitlab.com/sebholt/qastools" +arch="all" +license="MIT" +depends="bash" +makedepends="alsa-lib-dev cmake eudev-dev qt5-qtbase-dev qt5-qtsvg-dev + qt5-qttools-dev" +subpackages="$pkgname-doc $pkgname-lang" +langdir="/usr/share/qastools/l10n" +source="https://gitlab.com/sebholt/qastools/-/archive/v$pkgver/qastools-v$pkgver.tar.bz2" +builddir="$srcdir/$pkgname-v$pkgver" + +build() { + if [ "$CBUILD" != "$CHOST" ]; then + CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" + fi + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_SHARED_LIBS=True \ + -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + ${CMAKE_CROSSOPTS} . + make +} + +check() { + CTEST_OUTPUT_ON_FAILURE=TRUE ctest +} + +package() { + make DESTDIR="$pkgdir" install +} + +sha512sums="543e2f6407ba36f7cb0ce811ee1ceac14652960c58636671fabeaca25d154db263b654d07795ec2a81232b1e177469cbb45617099d40af47d6ab1148443582fb qastools-v0.23.0.tar.bz2" diff --git a/main/volumeicon/APKBUILD b/main/volumeicon/APKBUILD new file mode 100644 index 0000000..6139b4a --- /dev/null +++ b/main/volumeicon/APKBUILD @@ -0,0 +1,34 @@ +# Contributor: ScrumpyJack +# Maintainer: ScrumpyJack +pkgname=volumeicon +pkgver=0.5.1 +pkgrel=1 +pkgdesc="Volume Icon is a lightweight volume control that sits in your systray" +url="http://softwarebakery.com/maato/volumeicon.html" +arch="all" +license="GPL-3.0-only" +makedepends="gtk+3.0-dev intltool alsa-lib-dev libnotify-dev + automake autoconf libtool" +subpackages="$pkgname-lang" +source="$pkgname-$pkgver.tar.gz::https://github.com/Maato/volumeicon/archive/$pkgver.tar.gz" + +prepare() { + default_prepare + ./autogen.sh +} + +build() { + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --enable-notify + make +} + +package() { + make DESTDIR="$pkgdir" install +} + +sha512sums="c158a1a1bdf84e91fa039defc4c2a7fefa53f9a3ffc48b92388144fee6f7400f2e20618d3527d5c26f694d2280b1035fa4f91080ffe3b4baa5d229130d0c13b7 volumeicon-0.5.1.tar.gz" diff --git a/test/cdesktop-icewm/APKBUILD b/test/cdesktop-icewm/APKBUILD new file mode 100644 index 0000000..a9ce974 --- /dev/null +++ b/test/cdesktop-icewm/APKBUILD @@ -0,0 +1,77 @@ +# Maintainer: Şahan Yılmaz +pkgname=cdesktop +pkgver=1.4 +pkgrel=0 +pkgdesc="Minimal Icewm Masaüstü Ortamı" +url="https://chronalinux.net.tr" +arch="all" +license="MIT" +depends=" + icewm + spacefm + xorg-server + xf86-input-libinput + xinit + eudev + volumeicon + alsa-utils + alsaconf + mesa-dri-gallium + chrona-networkmanager-gtk + netsurf + st + font-dejavu + adwaita-icon-theme + dbus + dbus-x11 + xterm + mesa-gles +" + +# Ek yapılandırma dosyaları eklendi +source=" + mainmenu.svg + preferences + startup + cdesktop-wallpaper + chrona25-04.png +" + +build() { + return 0 +} + +package() { + mkdir -p "$pkgdir"/etc/skel/ + mkdir -p "$pkgdir"/etc/skel/.config/cdesktop/ + mkdir -p "$pkgdir"/etc/skel/.config/icewm/ + mkdir -p "$pkgdir"/usr/share/cdesktop/ + mkdir -p "$pkgdir"/usr/share/icons/chrona/ + mkdir -p "$pkgdir"/usr/share/applications/ + mkdir -p "$pkgdir"/usr/share/cdesktop/wallpapers + install -Dm755 startup "$pkgdir"/etc/skel/.config/icewm/startup + install -Dm755 preferences "$pkgdir"/etc/skel/.config/icewm/preferences + install -Dm644 chrona25-04.png "$pkgdir"/usr/share/cdesktop/wallpapers/chrona25-04.png + install -Dm644 mainmenu.svg "$pkgdir"/usr/share/icons/chrona/mainmenu.svg + install -Dm755 cdesktop-wallpaper "$pkgdir"/etc/skel/.config/cdesktop/cdesktop-wallpaper + cat >"$pkgdir"/usr/share/applications/cdesktop.desktop< + + + + + + + + + diff --git a/test/cdesktop-icewm/preferences b/test/cdesktop-icewm/preferences new file mode 100644 index 0000000..acd000d --- /dev/null +++ b/test/cdesktop-icewm/preferences @@ -0,0 +1,52 @@ +# ~/.icewm/preferences - TAM YAPILANDIRMA +# ================================================== +# ÇEKİRDEK AYARLAR +# +WorkspaceNames=" 1 " # Tek çalışma alanı +QuickSwitch=0 # Pencere geçiş efektleri kapalı +FocusMode=2 # Sıkı odak yönetimi (CLICKTOFOCUS) +HonorOrigin=1 # Pencere pozisyonunu koru +EdgeResistance=200 # Ekran kenarı direnci + +# ================================================== +# PERFORMANS OPTİMİZASYONU +# +UseComposite=0 # Compositing kapalı +ShowBlend=0 # Animasyon yok +ShowSplash=0 # Açılış ekranı kapalı +TaskBarClockLeds=0 # Saat LED efekti yok +TaskBarShowAPM=0 # Pil göstergesi kapalı +TaskBarShowCPUStatus=0 # CPU göstergesi kapalı +TaskBarShowMailboxStatus=0 # Posta bildirimi kapalı +TaskBarShowWindowListMenu=0 # Pencere listesi menüsü kapalı + +# ================================================== +# MODERN GÖRÜNÜM +# + +DesktopBackgroundImage="/usr/share/cdesktop/wallpapers/chrona25-04.png" # Arka plan resmi +DesktopBackgroundScaled=1 # Resmi ekrana sığdır + +# ================================================== +# GÖREV ÇUBUĞU ve SİSTEM ÇEKMECESİ +# +TaskBarShowTray=1 # Sistem çekmecesi aktif +TaskBarShowShowDesktopButton=1 # Masaüstünü göster butonu +TaskBarButtonless=0 # Görev çubuğunda uygulama butonları +TaskBarShowWorkspaces=0 # Çalışma alanı düğmeleri kapalı +NotificationArea=1 # Bildirim alanı aktif +TrayNotifyd=1 # Sistem bildirimleri açık + +# ================================================== +# PENCERE YÖNETİMİ +# +OperateOnScreen=1 # Pencereleri ekran içinde tut +SnapMove=1 # Pencere kenetleme aktif +SnapResize=1 # Boyutlandırma kenetleme +ShowAllWindows=1 # Tüm pencereleri göster + +# ================================================== +# KLASÖR ve UYGULAMA YOLLARI +# +PathApplications="/usr/share/applications:/usr/local/share/applications" +PathIcons="/usr/share/icons:/usr/share/pixmaps" diff --git a/test/cdesktop-icewm/startup b/test/cdesktop-icewm/startup new file mode 100644 index 0000000..5726706 --- /dev/null +++ b/test/cdesktop-icewm/startup @@ -0,0 +1,6 @@ +#!/bin/sh +~/.config/cdesktop/cdesktop-wallpaper & +spacefm --desktop & +volumeicon & +nm-applet + diff --git a/test/chrona-networkmanager-qt/APKBUILD b/test/chrona-networkmanager-qt/APKBUILD new file mode 100644 index 0000000..5cc43a1 --- /dev/null +++ b/test/chrona-networkmanager-qt/APKBUILD @@ -0,0 +1,33 @@ +# Maintainer: Şahan Yılmaz +pkgname=chrona-networkmanager-qt +pkgver=1.0 +pkgrel=2 +pkgdesc="NetworkMamager Qt for Chrona Linux" +url="https://chrona.org.tr" +arch="all" +license="MIT" +depends="networkmanager networkmanager-wifi nm-tray wpa_supplicant" +replaces="networkmanager" +package() { + mkdir -p "$pkgdir" + mkdir -p "$pkgdir"/etc/NetworkManager + mkdir -p "$pkgdir"/etc/NetworkManager/conf.d + cat < "$pkgdir"/etc/NetworkManager/NetworkManager.conf +[main] +dhcp=internal +plugins=ifupdown,keyfile + +[ifupdown] +managed=true + +[device] +wifi.scan-rand-mac-address=yes +wifi.backend=wpa_supplicant +EOF + + cat < "$pkgdir"/etc/NetworkManager/conf.d/any-user.conf +[main] +auth-polkit=false +EOF + +} diff --git a/test/clxqt/APKBUILD b/test/clxqt/APKBUILD new file mode 100644 index 0000000..604b361 --- /dev/null +++ b/test/clxqt/APKBUILD @@ -0,0 +1,59 @@ +# Maintainer: Şahan Yılmaz +pkgname=clxqt +pkgver=1.4 +pkgrel=0 +pkgdesc="Lxqt Desktop for Chrona Linux" +url="https://chrona.org.tr" +arch="noarch !armhf !s390x" +license="MIT" +subpackages="clxqt-openrc:openrc clxqt-full:full clxqt-themes:theme" +depends=" + xorg-server xf86-input-libinput clxqt-themes clxqt-openrc xinit eudev udev-init-scripts + udev-init-scripts-openrc mesa-dri-gallium + libqtxdg libsysstat liblxqt libfm-qt lxqt-themes + libdbusmenu-lxqt lxqt-about lxqt-admin lxqt-config + lxqt-globalkeys lxqt-powermanagement chrona-lxqt-session + lxqt-panel lxqt-runner chrona-pcmanfm-qt xscreensaver + lxqt-qtplugin lxqt-notificationd lxqt-archiver + lxqt-policykit lxqt-openssh-askpass lxqt-sudo + pm-utils qtermwidget qterminal openbox xdg-utils + lximage-qt pavucontrol-qt arandr obconf-qt screengrab lxdm + elogind polkit-elogind gvfs udisks2 breeze oxygen + font-dejavu dbus dbus-x11 acpid upower pulseaudio pulseaudio-alsa + chrona-nm-gtk + " + +package() { + mkdir -p "$pkgdir" +} + + +theme() { + replaces="lxqt-themes pcmanfm-qt" + source="chrona.tar.gz chrona-25-03.png" + mkdir -p "$subpkgdir" + mkdir -p "$subpkgdir"/usr/share/lxqt/themes + mkdir -p "$subpkgdir"/usr/share/lxqt/wallpapers + tar -xzf chrona.tar.gz -C "$subpkgdir"/usr/share/lxqt/themes/ + install -Dm644 chrona-25-03.png "$subpkgdir"/usr/share/lxqt/wallpapers/chrona-25-03.png + sha512sums=" +b4a06a22786c49822d105880755b8599a16dc1abb2ed332ff9dcfeb00e6125dddecc200a84d99009784889df380207d52e11d5380e78881835101c6b66325542 chrona.tar.gz +8bbf2565d4e6c2f743a23e14331db0e7e3ec22e51281baf7d056eac53425719850d17c5ac4f32d785bd685e7b9f93b60bb79b592a2c0714af5aaa74af2b0a942 chrona-25-03.png +" +} + + +openrc() { + replaces="openrc" + mkdir -p "$subpkgdir" + source="clxqt.initd" + install -Dm755 clxqt.initd "$subpkgdir"/etc/init.d/clxqt + sha512sums="623a732334015c248b508fedf17100cc50d037276c016c104d29d67329fc846ccff84a892c2059ff000a6c3a562173c1cfabd1d66cb902b026c5f86a3253439d clxqt.initd +" +} + + +full() { + depends="clxqt mpv xpdf falkon libreoffice claws-mail xpdf" + mkdir -p "$subpkgdir" +} diff --git a/test/clxqt/chrona-25-03.png b/test/clxqt/chrona-25-03.png new file mode 100644 index 0000000..07d772d Binary files /dev/null and b/test/clxqt/chrona-25-03.png differ diff --git a/test/clxqt/chrona.tar.gz b/test/clxqt/chrona.tar.gz new file mode 100644 index 0000000..51b3e3e Binary files /dev/null and b/test/clxqt/chrona.tar.gz differ diff --git a/test/clxqt/clxqt.initd b/test/clxqt/clxqt.initd new file mode 100644 index 0000000..dbccc4a --- /dev/null +++ b/test/clxqt/clxqt.initd @@ -0,0 +1,94 @@ +#!/sbin/openrc-run + +description="Chrona Masaüstü Oturumu" + +# Paketin kurulu olup olmadığını kontrol eder +check_pkg() { + apk info "$1" >/dev/null 2>&1 +} + +# NetworkManager'ı yapılandırır (opsiyonel) +configure_networkmanager() { + if check_pkg chrona-nm-gtk; then + # NetworkManager zaten eklendiğinden emin olmak için kontrol + if ! rc-status | grep -q networkmanager; then + rc-update add networkmanager default + rc-service networkmanager start + fi + fi +} + +start_pre() { + # Gerekli hizmetlerin başlatılması + setup-devd udev + configure_networkmanager + + ebegin "X11 ortamı hazırlanıyor" + + # X11 dizinini oluştur + if ! mkdir -p /etc/X11; then + eend 1 "X11 dizini oluşturulamadı" + return 1 + fi + + # Xwrapper yapılandırmasını ayarla + XWRAPPER_CONFIG="/etc/X11/Xwrapper.config" + if ! echo "allowed_users=anybody" > "$XWRAPPER_CONFIG"; then + eend 1 "Xwrapper yapılandırması başarısız" + return 1 + fi + + # Kullanıcı .xinitrc dosyalarını oluştur + for user_dir in /etc/skel /home/chrona /root; do + xinitrc="$user_dir/.xinitrc" + if [ -f "$xinitrc" ]; then + continue + fi + + # Dosyayı yaz + if ! echo "exec startlxqt" > "$xinitrc"; then + ewarn "$xinitrc oluşturulamadı" + continue + fi + + # Dosya izinlerini ayarla + chmod 755 "$xinitrc" + einfo "$xinitrc oluşturuldu" + done + + eend 0 +} + +start() { + ebegin "Grafik oturumu başlatılıyor" + + # Gerekli kullanıcı kontrolü + if ! id -u chrona >/dev/null 2>&1; then + eend 1 "Kullanıcı 'chrona' bulunamadı" + return 1 + fi + + # Başlangıç senaryoları + if check_pkg chrona-live-boot; then + # X sunucusunu başlat + su - chrona -c "startx" 2>/var/log/chrona-startx.log & + eend 0 + + elif check_pkg lxdm; then + # LXDM'yi başlat + if ! rc-service lxdm start; then + eend 1 "LXDM başlatılamadı" + return 1 + fi + eend 0 + + else + eend 1 "Gerekli paketler eksik (chrona-live-boot veya lxdm)" + return 1 + fi +} + +stop() { + ebegin "Servisler durduruluyor" + eend 0 +} diff --git a/test/nm-tray/APKBUILD b/test/nm-tray/APKBUILD new file mode 100644 index 0000000..90632a2 --- /dev/null +++ b/test/nm-tray/APKBUILD @@ -0,0 +1,39 @@ +# Contributor: cristian_ci +# Maintainer: cristian_ci +pkgname=nm-tray +pkgver=0.5.0 +pkgrel=0 +pkgdesc="Simple NetworkManager front end based on Qt" +url="https://github.com/palinek/nm-tray" +arch="all" +license="GPL-2.0-or-later" +makedepends=" + cmake + networkmanager-qt5-dev + qt5-qtbase-dev + qt5-qttools-dev + samurai + " +subpackages="$pkgname-lang" +source="$pkgname-$pkgver.tar.gz::https://github.com/palinek/nm-tray/archive/refs/tags/$pkgver.tar.gz" +options="!check" # no test suite + +build() { + cmake -B build -G Ninja \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DNM_TRAY_XDG_AUTOSTART_DIR=/etc/xdg/autostart + cmake --build build +} + +package() { + DESTDIR="$pkgdir" cmake --install build +} + +lang() { + install_if="lang $pkgname=$pkgver-r$pkgrel" + amove usr/share/$pkgname/*.qm +} + +sha512sums=" +ba118f7fd07a60af5ed6b7b53cf771f339c89f9bef02aeb2f59bfbddd3e896bdc31aa506437e33cb8fe2ef921c595b76527d61cefd202e9e1f5197762b69ab51 nm-tray-0.5.0.tar.gz +"