From nobody Mon Jul 1 17:01:22 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 4WCXS85jXpz5Q1Gj for ; Mon, 01 Jul 2024 17:03:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 4WCXS859D5z4RXs; Mon, 1 Jul 2024 17:03:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719853416; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ml4vBjOeUuXkFMu6kNifk2r3vUCOobsJ3UWPd5SqtZ8=; b=r0QDqyImJYO9RFXtTrQSahCm5HEFSndErkAC0+p1LPSSgfalsgvp5i9RIta7navptydyRV ii7G0r4+l6l4+9IqpeNKTB9Tu0hIqzjoLiwOb8S46tImrbdYN3NbRAs8CkbmxV5houoKs1 5vZvjHAvlk0+KjtXZZELvb8ln88X7mLg8xKuvVAzo208kZTwV4b7K8HyLeCZLho1FmOB2i 6Cd6C96yIKZlgVbAMyoz3GCIAUFnX6EurON5x54+Lp0Rzmglik/RQhH27pUjK/7r/0qZaK 4iGFQ8RCX3nPhcyc2ELq2aXpwlVQpyTAF70iR1ntAVJ4r0DRwCwzFc0KgT5sNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719853416; a=rsa-sha256; cv=none; b=yUCeBpizQ5XY/QUcvT+DXlIkgn3mwB3z/GmqyXFnZIOMrTJ4S2m1fAmooxSrMkEXKI2LGn sXKnjlPv9+yDUQbUguOhz9O0OQls2FWwfnA5h3DyGNxKEth3nsXdgvbGuAhoSaJY5o8sy6 K3w+p7ViGQedCGCfgV3YF0qr+HlZYhHLac3gZwGmiGTqS59gnay/jWPuZWbCUA1pte5/Zi vagUIao2Yh3q3gLjY8IouPoXxKnc+ZN/fIDqxzsTteb+k0hvuW2XGZ0pXMT2DTlVuZdPJY XQ3q3CuIRzzFfGrDav6zGOtwzvztAzgCKjRez4OCPP+VsQZcAK1KY7idig+0tA== 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=1719853416; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ml4vBjOeUuXkFMu6kNifk2r3vUCOobsJ3UWPd5SqtZ8=; b=v79gUyPv5PlBFvySVv805Shv2P1TCCZntqEpmXmdOfTqPMxWY+uIyKjeACLQWoMl1xNsOZ 6T9Gq3DIul0EjjwafxKN6Bk6DOHwmBprh8Ol6sBR4e6uVzjOe2K6cgjcdIPfx8rIyZz+8Y Oy3CneY4RYdvXp3li6l+oSamekcEyqzjAyOvfkbhxO9fwmK9j3POM4ekmWozHd0AKJ0F6v 0XCM/ggNmBQB2UyAUK3aHCdEkjVFZO2s0O3vfaTjr/zm3Q90PjeqQIOj3RfZ4o/2A/Wt2G 8maciH7tnMXI3NoF5LH2BcNOtlkuBHoCLkPCc7DDT/fo3bSkCviJDmxT2I0zVw== Received: from localhost (unknown [IPv6:2400:4051:a743:3c00:5a9c:fcff:fe10:ffc2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: hrs) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WCXS75RSWzRRD; Mon, 1 Jul 2024 17:03:35 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Date: Tue, 02 Jul 2024 02:01:22 +0900 (JST) Message-Id: <20240702.020122.1030553811647103008.hrs@FreeBSD.org> To: zlei@FreeBSD.org Cc: imp@freebsd.org, jhb@FreeBSD.org, freebsd-usb@freebsd.org Subject: Re: How to test stand/usb From: Hiroki Sato In-Reply-To: <6B9A293F-18CF-4FB2-B095-BC468354BCA8@FreeBSD.org> References: <6B9A293F-18CF-4FB2-B095-BC468354BCA8@FreeBSD.org> X-Old-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-PGPkey-fingerprint: 6C0D 2353 27CF 80C7 901E FDD2 DBB0 7DC6 6F1F 737F X-Mailer: Mew version 6.8 on Emacs 28.2 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 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha512; boundary="--Security_Multipart(Tue_Jul__2_02_01_22_2024_397)--" Content-Transfer-Encoding: 7bit ----Security_Multipart(Tue_Jul__2_02_01_22_2024_397)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, Zhenlei Huang wrote in <6B9A293F-18CF-4FB2-B095-BC468354BCA8@FreeBSD.org>: 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 ? 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: https://people.allbsd.org/~hrs/FreeBSD/kshim-fix.20240702-1.diff 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=no because libusbboot.a is too large): # 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=no depend && \ make MK_LOADER_ZFS=no # cd /usr/src/stand/i386/loader && \ make MK_LOADER_ZFS=no DESTDIR=/tmp install 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. 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. Although the files under kshim/ and usb/ are not maintained well, I personally think they are still worth keeping. -- Hiroki ----Security_Multipart(Tue_Jul__2_02_01_22_2024_397)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iMoEABMKAC4WIQRsDSNTJ8+Ax5Ae/dLbsH3Gbx9zfwUCZoLg4hAcaHJzQGZyZWVi c2Qub3JnAAoJENuwfcZvH3N/ibgCCQE5UA7kL7XCf4JBXSXVoAvT3O5wntTC1jTm 15Mz3pSr1a2DkHuxXgjqV1+Eh81RlLcg5huEY27eDpbY7rYmla7gzAIJARQKmsQ6 fh6NYWgJ0Y/Qj6q04lxKAGiQWwR4paxmhiCEe9WHNCJmLlS3d7gSyoVmdagxWRpu Z3QB+IvQNBPdgYyH =lUTZ -----END PGP SIGNATURE----- ----Security_Multipart(Tue_Jul__2_02_01_22_2024_397)----