From nobody Tue Jul 02 04:38:04 2024 X-Original-To: freebsd-usb@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 4WCqsc4FgTz5P9Nv for ; Tue, 02 Jul 2024 04:38:12 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WCqsc3lyLz4tp9; Tue, 2 Jul 2024 04:38:12 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719895092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=B8Ivds3Rx/pRofr0x4imFXWdCOA4BVdOJC6Tq9lfp9o=; b=p5hI/8uGaG/QB6Y7PcKDktzbNjsft/qSaMomGmSWYsiwyCXfWFl/SIvanS01y6FC37btyg WiSjQTwOt75V9RCyVuGc/jY39hiPrtxOeHzKFuGAAuZ1l0C2VPQm4a+xOiBiT6wizJF87J j6Jd/qXwvSmlKfjXrKxi0CdTJSCpMVcAyflFMEA3SRqvuSJzTw9VmDkJmZPgsFAsz52BWb LijpKXM56NVecI90H1kZ1EyMoxiN1R7i3QtbOtpYIMdNPkvP+alfITmRaIrky9Gx5h5427 jcEe+SMjXDLfEKZ/Z2/q6wWSlta3uGZ3a1IUig3MfFoyLZ88gU1KnwgmUUb+mg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719895092; a=rsa-sha256; cv=none; b=JPTAGEBdh7GecQokVblD0LcL8xN/JaPKM5pMsPaQKwsgtUZ+8LxnFaUw8Mf3I/jjbqs97b a++K6Fxl/W2/rXOWo6TTkim9tyHAQeWhtbkxqTmJ1fJuRhglZgS1hDo5/2Ta5CiNjCk1Iw 48vQZG0L6vq1p4wWzWGlZagHjzifBzM/fqsWoEOtt7DQXoi02nOQZxooP6qsxhuckeQm97 N8B4hvC3y5PATDeGRWdqNnBcqEZjfjzt47iEhbNtA/zxy0NSKLn2+8o/8PmYWSIf01dtnz Rv2BT2Ru+TKtI21abNekbAve6Wcd30nwwHJaqelBrRQOXL4+zyxvQbw19zyPow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719895092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=B8Ivds3Rx/pRofr0x4imFXWdCOA4BVdOJC6Tq9lfp9o=; b=Hny4qCruOnAcQ2bn7SaADpFFLONmGVKckFBKEVcykS0UeMBPgkh8myzgDJH600M8Hl72v9 Tk3zDE/nJfNzFBihz4mxziOkYsJj4LEU3DtHBhP2LF2aIWVUR7q3f8ujAD/kbdInuDtXnm QMs6R/6R3MtiYgBrZwYGgx8ITZzt6At5SXruzGZfAfqYKAneFaQ9+7/jcrWLyeVvcUTdM7 1ERAdeSFm1zJ32WIi6O5WSnKkk0U1M60ZWbRdWJEYzH6XBcft/i5zQDTso6JntkZnnT/zd b/zwoUND+wpnmrsU+lp6/9xzLx1/wfbzF5tQwTmx/iu3SAOcEAzxH5bawFyBKw== Received: from smtpclient.apple (unknown [IPv6:2001:19f0:6001:9db:98f0:9fe0:3545:10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WCqsb1DZtzgtj; Tue, 2 Jul 2024 04:38:10 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: multipart/signed; boundary="Apple-Mail=_FFC27E81-6851-486F-964A-033F82BBC321"; protocol="application/pgp-signature"; micalg=pgp-sha512 List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-usb@freebsd.org Sender: owner-freebsd-usb@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: How to test stand/usb From: Zhenlei Huang In-Reply-To: <20240702.020122.1030553811647103008.hrs@FreeBSD.org> Date: Tue, 2 Jul 2024 12:38:04 +0800 Cc: Warner Losh , "jhb@freebsd.org" , freebsd-usb@freebsd.org Message-Id: References: <6B9A293F-18CF-4FB2-B095-BC468354BCA8@FreeBSD.org> <20240702.020122.1030553811647103008.hrs@FreeBSD.org> To: Hiroki Sato X-Mailer: Apple Mail (2.3696.120.41.1.8) --Apple-Mail=_FFC27E81-6851-486F-964A-033F82BBC321 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Jul 2, 2024, at 1:01 AM, Hiroki Sato wrote: >=20 > Hi, >=20 > Zhenlei Huang wrote > in <6B9A293F-18CF-4FB2-B095-BC468354BCA8@FreeBSD.org>: >=20 > zl> I'm recently working on cleaning up malloc(M_WAITOK), and found = that the sys/dev/usb > zl> stack is also used by bootloader. Currently stand/usb fails to = compile ( since the > zl> commit 9e4e7bcaef3f 2022/8/23 ) and I have some WIP patches. I do = not find a good > zl> page about its usage. How can I test stand/usb ? Or it has no = usage any more and should > zl> be retired ? >=20 > The stand/usb directory is used to build the libusbboot.a library > containing the devsw for umass(4). The following patch (against a bit > old tree) should fix the build errors at least: >=20 > https://people.allbsd.org/~hrs/FreeBSD/kshim-fix.20240702-1.diff >=20 > To compile a loader with libusbboot.a, you need to build a > libusbboot.a with some flags first and link it with a loader. On the > loader side, you need to edit conf.c and Makefile. The above patch > includes changes for i386/loader, and the following command lines > should build both (MK_LOADER_ZFS=3Dno because libusbboot.a is too > large): >=20 > # cd /usr/src/stand/usb/tools && make && make install > % cd /usr/src/stand/usb && \ > make obj && \ > make -DHAVE_UMASS_LOADER -DHAVE_EHCI depend && \ > make -DHAVE_UMASS_LOADER -DHAVE_EHCI > % cd /usr/src/stand/i386/loader && \ > make obj && \ > make MK_LOADER_ZFS=3Dno depend && \ > make MK_LOADER_ZFS=3Dno > # cd /usr/src/stand/i386/loader && \ > make MK_LOADER_ZFS=3Dno DESTDIR=3D/tmp install >=20 > and you should be able to find a legacy BIOS loader in > /tmp/boot/loader. I did not test whether the build result works > actually, though. Note that the first command builds "sysinit" tool > and installs it into /usr/bin. You can remove it after testing. >=20 > Also note that the kernel source files used by ones under usb/ will > use a different malloc implementation defined in > kshim/bsd_kernel.[ch]. So, malloc(9) flags are simply ignored. If > your work intends to check if rewriting of malloc(M_WAITOK) works or > not, I think you can consider it does not affect the loaders using the > libusbboot library. Thanks for the detailed instructions. I'll try that. >=20 > Although the files under kshim/ and usb/ are not maintained well, I > personally think they are still worth keeping. >=20 > -- Hiroki --Apple-Mail=_FFC27E81-6851-486F-964A-033F82BBC321 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iNUEARYKAH0WIQRj28YmNowGX1isJg7GJJ6Jgbd0XwUCZoOELF8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0NjNE QkM2MjYzNjhDMDY1RjU4QUMyNjBFQzYyNDlFODk4MUI3NzQ1RgAKCRDGJJ6Jgbd0 X4MVAQCZd0B36ZZStUNaQZFEIirpATHevNSaKhRZiQFWKmTk/wEA4KCEmORXu9tX 31eT5rPf8tOoDC/lN2n4wOoUBzVGug4= =Zo5l -----END PGP SIGNATURE----- --Apple-Mail=_FFC27E81-6851-486F-964A-033F82BBC321--