Date: Fri, 8 Jul 2022 18:34:54 -0300 From: "Dr. Rolf Jansen" <freebsd-rj@cyclaero.com> To: freebsd-arm <freebsd-arm@freebsd.org> Cc: John Kennedy <warlock@phouka.net>, Mark Millard <marklmi@yahoo.com> Subject: Re: Failed to execute custom kernels which where build on a RPi 4 operated by 13.1-RELEASE Message-ID: <E1353A37-4AC5-48FB-9209-358C245963C0@cyclaero.com> In-Reply-To: <DD01DB57-7E6D-496F-9D31-762964F52388@yahoo.com> References: <B1296677-558F-49F3-B7B7-2784ACA6612B@cyclaero.com> <YsOU/Gzxnrq6H2sJ@phouka1.phouka.net> <D523159F-CEF5-4F98-92E8-11C79F5C6419@cyclaero.com> <YsRB9uOlUNOoDBVu@phouka1.phouka.net> <71D4E84B-5D80-43A5-BE22-8E4F6486B7E4@cyclaero.com> <DD01DB57-7E6D-496F-9D31-762964F52388@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> Am 06.07.2022 um 02:01 schrieb Mark Millard <marklmi@yahoo.com>: >=20 > On 2022-Jul-5, at 08:09, Dr. Rolf Jansen <freebsd-rj@cyclaero.com> = 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: <OFW I2C bus> on iichb0 iic0: <I2C generic I/O> on iicbus0 ds32310: <Maxim DS3231 RTC> at addr 0xd0 on iicbus0 ... ... mmcsd0: 16GB <SDHC SL16G 8.0 SN 399D0D61 MFG 09/2016 by 3 SD> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1353A37-4AC5-48FB-9209-358C245963C0>