From nobody Fri Jul 08 21:34:54 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E26A917D0378 for ; Fri, 8 Jul 2022 21:35:09 +0000 (UTC) (envelope-from freebsd-rj@cyclaero.com) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lfmlc6KBWz3kJ8 for ; Fri, 8 Jul 2022 21:35:08 +0000 (UTC) (envelope-from freebsd-rj@cyclaero.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1657316101; s=strato-dkim-0002; d=cyclaero.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject:Cc:Date: From:Subject:Sender; bh=DvZa/XHifvA8cw4HJoRWnCqki+o1DlCvpP8JeTyi7XM=; b=LLxArROspa5Mv4UmifoRE8roWdL41chaZoJ3wc4d/2Ltyp0yFtOY5WJtO4hkxdXkxr lpWWwEE7ff6dO2oEYL5hWQ959M73mbgOUT6KRTQpDaR6W4L2TVKsf4pbZuyUQqT1jE5t 3oZW9w27sPwQcbXnQPkGlKR8jM/Vi/fb1om+VyfvMtasWZhiCpxFiB0G4X0xB0C7hNCY WTCZMxpmuL1/9H6bekRxh5xSfyEDwWTcwFvIFlF9oTtDICue4OIEA7vi7WBXJiApjrgX +kNWnyIfmIitLTk2EqgKhNDSq7FJRGheA2kWwINUIBM7DQmRUNVdR4wKrYK/rorrV7km oqxw== X-RZG-AUTH: ":O2kGeEG7b/pS1F2rRHW2isrKl4DV03XBEi+I6ZuztdvN9wS3wFGySS4Lw+ldTBio08NTPnK5bNCibgxfnBg=" X-RZG-CLASS-ID: mo00 Received: from mail.obsigna.com by smtp.strato.de (RZmta 47.46.1 AUTH) with ESMTPSA id kcd9d5y68LZ1akQ (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 8 Jul 2022 23:35:01 +0200 (CEST) Received: from rolf-mini.obsigna.com (unknown [177.95.254.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id 8297763921; Fri, 8 Jul 2022 23:34:59 +0200 (CEST) Content-Type: text/plain; charset=us-ascii List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Subject: Re: Failed to execute custom kernels which where build on a RPi 4 operated by 13.1-RELEASE From: "Dr. Rolf Jansen" In-Reply-To: Date: Fri, 8 Jul 2022 18:34:54 -0300 Cc: John Kennedy , Mark Millard Content-Transfer-Encoding: quoted-printable Message-Id: References: <71D4E84B-5D80-43A5-BE22-8E4F6486B7E4@cyclaero.com> To: freebsd-arm X-Mailer: Apple Mail (2.3445.104.15) X-Rspamd-Queue-Id: 4Lfmlc6KBWz3kJ8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cyclaero.com header.s=strato-dkim-0002 header.b=LLxArROs; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-rj@cyclaero.com designates 81.169.146.219 as permitted sender) smtp.mailfrom=freebsd-rj@cyclaero.com X-Spamd-Result: default: False [-2.10 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_NAME_HAS_TITLE(1.00)[dr]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.996]; MV_CASE(0.50)[]; R_DKIM_ALLOW(-0.20)[cyclaero.com:s=strato-dkim-0002]; R_SPF_ALLOW(-0.20)[+ip4:81.169.146.128/25]; RCVD_IN_DNSWL_LOW(-0.10)[81.169.146.219:from]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MLMMJ_DEST(0.00)[freebsd-arm]; DMARC_NA(0.00)[cyclaero.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[81.169.146.219:from]; RCPT_COUNT_THREE(0.00)[3]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FREEMAIL_CC(0.00)[phouka.net,yahoo.com]; DKIM_TRACE(0.00)[cyclaero.com:+]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:6724, ipnet:81.169.144.0/22, country:DE]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N > Am 06.07.2022 um 02:01 schrieb Mark Millard : >=20 > On 2022-Jul-5, at 08:09, Dr. Rolf Jansen = wrote: >=20 >>> . . . >>=20 >> That would be the second step. The first step would be that somebody = else confirms my finding that building and running a custom kernel on a = stock FreeBSD 13.1-RELEASE on RPi 4 does not work out. And actually that = was my initial question. >>=20 >> (1) In case somebody raises her/his hand telling, that this worked = flawlessly on their system, >> then I would have a more in deep look, what might have gone wrong = here. >>=20 >> (2) In case the issue would be confirmed, then I would submit a bug = report, and the discussion >> may continue in a more productive way on bugs.freebsd.org. >=20 > Summary of the later material: >=20 > It would appear that if building any kernels are > broken, it is specific to some custom kernel(s) > in question, not to building kernels in general. > 13.1-RELEASE's install is able to build, install, > and boot its own generic kernel on a 8GiByte > RPi4B Rev. 1.4. So we are talking about case (1 - works flawlessly as expected), and as = I promised, I will look more in deep on what might have gone wrong here. = For those who want to reproduce building of kernels completely from the = scratch on the RPi 4 in the shortest possible way, I leave a transcript = of the procedure at the very bottom of this message (see: *** Installing = FreeBSD on a microSD card and building a (custom) kernel ****). Results with the thus builded kernels: 13.1-GENERIC does work 13.1-GENERIC-MMCCAM does boot from the microSD, but USB does not work 13.1-GNNERIC-RPi4 stalls when booting. cat /usr/src/sys/arm64/conf/GENERIC-RPi4 include GENERIC ident GENERIC-RPi4 nooptions SOC_NVIDIA_TEGRA210 In the serial console: ... mmcsd0: Error indicated: 1 Timeout mountroot: waiting for device /dev/ufs/rootfs... bcm_dma0: DMA error 4 on CH5 Mounting from ufs:/dev/ufs/rootfs failed with error 19. My conclusion is that we may not completely disable NVIDIA Tegra 210. = And after all, my goal was not exactly to disable the Tegra, but to = mitigate the egoistic behaviour of its internal RTC driver for the = MAX77620 (all i2c-addr 68 is mine). I achieved that goal by replacing in = the source file /usr/src/sys/arm64/nvidia/tegra210/max77620_rtc.c (of = 13.1-RELEASE) the I2C address from 0x68 to 0x7F. Nothing uses 0x7F and = so the MAX77620 driver may claim it for itself without harm to other = devices. sed -e "s/#define MAX77620_RTC_I2C_ADDR.0x68/#define = MAX77620_RTC_I2C_ADDR 0x7F/" \ -i "" /usr/src/sys/arm64/nvidia/tegra210/max77620_rtc.c=20 13.1-GENERIC (patched) does work, including the DS3231 RTC on i2c1 = address 0x68. ... iicbus0: on iichb0 iic0: on iicbus0 ds32310: at addr 0xd0 on iicbus0 ... ... mmcsd0: 16GB at mmc1 = 50.0MHz/4bit/65535-block bcm2835_cpufreq0: ARM 1500MHz, Core 500MHz, SDRAM 400MHz, Turbo ON ds32310: registered as a time-of-day clock, resolution 1.000000s ... Many thanks for all your inputs and efforts. Best regards Rolf *** Installing FreeBSD on a microSD card and building a (custom) kernel = **** 1. Fetch the image and write it to a pristine microSD card: # fetch = https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/13.1/FreeBS= D-13.1-RELEASE-arm64-aarch64-RPI.img.xz # xz -d FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img.xz # dd if=3DFreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img of=3D/dev/da0 = bs=3D1m conv=3Dsync 2. Preparation before the first start which automatically would max. out = the UFS partition. Hovever, I want to reserve space for a 2 GB swap partition (omit this step, in case you don't want a swap p.): # gpart resize -i 2 da0 # gpart show da0 da0s2 =3D> 63 31116225 da0 MBR (15G) 63 2016 - free - (1.0M) 2079 102312 1 fat32lba [active] (50M) 104391 31011897 2 freebsd (15G) =3D> 0 31011897 da0s2 BSD (15G) 0 57 - free - (29K) 57 6186880 1 freebsd-ufs (2.9G) 6186937 24824960 - free - (12G) Calculate the base (start) of the swap partition, e.g. here: 6186937 = + 24824960 - 4*1024*1024 =3D 26817593 # gpart add -b 26817593 -t freebsd-swap da0s2 # gpart show da0s2 =3D> 0 31011897 da0s2 BSD (15G) 0 57 - free - (29K) 57 6186880 1 freebsd-ufs (2.9G) 6186937 20630656 - free - (9.8G) 26817593 4194304 2 freebsd-swap (2.0G) 3. Start the RPi 4 with the SD card and enter via serial console as = root: login: root Password: May 12 08:46:57 generic login[1206]: ROOT LOGIN (root) ON ttyu0 FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC Welcome to FreeBSD! Release Notes, Errata: https://www.FreeBSD.org/releases/ Security Advisories: https://www.FreeBSD.org/security/ FreeBSD Handbook: https://www.FreeBSD.org/handbook/ FreeBSD FAQ: https://www.FreeBSD.org/faq/ Questions List: = https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/ FreeBSD Forums: https://forums.FreeBSD.org/ Documents installed with the system are in the = /usr/local/share/doc/freebsd/ directory, or can be installed later with: pkg install = en-freebsd-doc For other languages, replace "en" with a language code like de or fr. Show the version of FreeBSD installed: freebsd-version ; uname -a Please include that output and any error messages when posting = questions. Introduction to manual pages: man man FreeBSD directory layout: man hier To change this login announcement, see motd(5). root@generic:~ # gpart show =3D> 63 31116225 mmcsd0 MBR (15G) 63 2016 - free - (1.0M) 2079 102312 1 fat32lba [active] (50M) 104391 31011897 2 freebsd (15G) =3D> 0 31011897 mmcsd0s2 BSD (15G) 0 57 - free - (29K) 57 26814464 1 freebsd-ufs (13G) 26814521 3072 - free - (1.5M) 26817593 4194304 2 freebsd-swap (2.0G) 4. Donwload and install the sources: # cd / # fetch --no-verify-peer = https://download.freebsd.org/releases/arm64/aarch64/13.1-RELEASE/src.txz # tar -xzf src.txz 5. Build and install the GENERIC kernel =20 # cd /usr/src # make -j4 buildkernel KERNCONF=3DGENERIC # make installkernel KERNCONF=3DGENERIC 6. Restart the RPi 4