Build Linux 5.10 LTS for Phicomm N1
Recently I built Linux 5.10 LTS for my N1 box. Below are the patches I needed during the building process. TEXT_OFFSET Obsolete: See comments from justin below, it’s no longerContinue reading
Recently I built Linux 5.10 LTS for my N1 box. Below are the patches I needed during the building process. TEXT_OFFSET Obsolete: See comments from justin below, it’s no longerContinue reading
I wrote a blog about blocking Thunder in tranmission-daemon 2.94. The patch does not apply cleanly on Transmission 3.00, so I update it here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | --- a/libtransmission/peer-mgr.c 2021-08-31 03:10:20.435836776 +0800 +++ b/libtransmission/peer-mgr.c 2021-08-31 03:14:31.268153266 +0800 @@ -2007,6 +2007,21 @@ tr_peerMsgsUpdateActive(msgs, TR_DOWN); } +static bool isUserAgentBad(const char* ua) +{ + static const char* blacklist[] = {"Thunder", "Xunlei"}; + int i; + + for (i = 0; i != sizeof(blacklist) / sizeof(blacklist[0]); ++i) { + // Performs bad, honestly. + if (!strncmp(blacklist[i], ua, strlen(blacklist[i]))) { + return true; + } + } + return false; +} + + /* FIXME: this is kind of a mess. */ static bool myHandshakeDoneCB(tr_handshake* handshake, tr_peerIo* io, bool readAnythingFromPeer, bool isConnected, uint8_t const* peer_id, void* vmanager) @@ -2100,21 +2115,29 @@ tr_quark client; tr_peerIo* io; char buf[128]; + const char* ua = ""; if (peer_id != NULL) { - client = tr_quark_new(tr_clientForId(buf, sizeof(buf), peer_id), TR_BAD_SIZE); + client = tr_quark_new((ua = tr_clientForId(buf, sizeof(buf), peer_id)), TR_BAD_SIZE); } else { client = TR_KEY_NONE; } - io = tr_handshakeStealIO(handshake); /* this steals its refcount too, which is balanced by our unref in peerDelete() */ - tr_peerIoSetParent(io, &s->tor->bandwidth); - createBitTorrentPeer(s->tor, io, atom, client); + if (!isUserAgentBad(ua)) + { + io = tr_handshakeStealIO(handshake); /* this steals its refcount too, which is balanced by our unref in peerDelete() */ + tr_peerIoSetParent(io, &s->tor->bandwidth); + createBitTorrentPeer(s->tor, io, atom, client); - success = true; + success = true; + } + else + { + tr_logAddDebug("Bad user agent \"%s\" (peer %s) tried to connect to us", ua, tr_atomAddrStr(atom)); + } } } } |
The rest instructions are theContinue reading
This seems to relate to a kernel change in 3.15. To workaround it I have to prevent UAS driver from binding to my HDD drive by setting usb-storage.quirks. Unfortunately, solutionContinue reading
Section 5.1.4 in Debian 10’s Release Notes explained this, and suggested using haveged to populate system’s entropy. However, haveged does not work correctly on my N1 box, reporting:
1 | haveged[1234]: haveged: Couldn't initialize HAVEGE rng 5 |
FromContinue reading
All your data will be lost if you do something wrong. Don’t follow this post unless you’re ABSOLUTELY aware of what you’re doing. Well, this idea has come to meContinue reading
Since I can’t attach a USB-to-TTL to my N1 box right now, I can’t confirm this is the same issue as a topic found in U-boot’s mailing list ([U-Boot] ‘usbContinue reading
Even if both the documentation (in source code) and the source code of boot_get_ramdisk suggest that booti (as well as other boot* family commands) support raw initrd image, my attemptContinue reading
It’s recommended to backup your firmware environment variables before changing them. If fw_printenv / fw_setenv does not work on your device, you might want to checkout this post to fixContinue reading
Be careful when doing this, I suggest you backup your data before reformatting your /boot as ext4. Any mistake you make would potentially require a reflash of your device (orContinue reading
meson-text-offset.patch: Patch for moving TEXT_OFFSET. This is necessary for booting Linux on Meson SoCs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | diff -uNr a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S --- a/arch/arm64/kernel/head.S 2019-01-01 00:00:00.000000000 +0000 +++ b/arch/arm64/kernel/head.S 2019-01-01 00:00:00.000000000 +0000 @@ -52,7 +52,7 @@ #elif (PAGE_OFFSET & 0x1fffff) != 0 #error PAGE_OFFSET must be at least 2MB aligned #elif TEXT_OFFSET > 0x1fffff -#error TEXT_OFFSET must be less than 2MB +// #error TEXT_OFFSET must be less than 2MB #endif /* diff -uNr a/arch/arm64/Makefile b/arch/arm64/Makefile --- a/arch/arm64/Makefile 2019-01-01 00:00:00.000000000 +0000 +++ b/arch/arm64/Makefile 2019-01-01 00:00:00.000000000 +0000 @@ -98,7 +98,7 @@ int(2 * 1024 * 1024 / (2 ^ $(CONFIG_ARM64_PAGE_SHIFT)) * \ rand()) * (2 ^ $(CONFIG_ARM64_PAGE_SHIFT))}") else -TEXT_OFFSET := 0x00080000 +TEXT_OFFSET := 0x01080000 endif ifeq ($(CONFIG_KASAN_SW_TAGS), y) |
decrease-emmc-max-frequency.patch: Cap (internal) eMMC’s max-frequency. This is necessary for Phicomm N1 to boot.
1 2 3 4 5 6 7 8 9 10 11 12 | diff -uNr a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi --- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi 2019-01-01 00:00:00.000000000 +0000 +++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi 2019-01-01 00:00:00.000000000 +0000 @@ -202,7 +202,7 @@ bus-width = <8>; cap-mmc-highspeed; - max-frequency = <200000000>; + max-frequency = <100000000>; non-removable; disable-wp; mmc-ddr-1_8v; |
disable-usb2-lpm.patch:Continue reading