Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jul 2024 12:38:04 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Hiroki Sato <hrs@freebsd.org>
Cc:        Warner Losh <imp@freebsd.org>, "jhb@freebsd.org" <jhb@FreeBSD.org>, freebsd-usb@freebsd.org
Subject:   Re: How to test stand/usb
Message-ID:  <DEAE3F35-7B2C-419D-9D3F-46526947070A@FreeBSD.org>
In-Reply-To: <20240702.020122.1030553811647103008.hrs@FreeBSD.org>
References:  <6B9A293F-18CF-4FB2-B095-BC468354BCA8@FreeBSD.org> <20240702.020122.1030553811647103008.hrs@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <hrs@freebsd.org> wrote:
>=20
> Hi,
>=20
> Zhenlei Huang <zlei@FreeBSD.org> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DEAE3F35-7B2C-419D-9D3F-46526947070A>