Bug 193588 - [new port] net/malo-firmware-1.4: Staged malo(4) firmware module
Summary: [new port] net/malo-firmware-1.4: Staged malo(4) firmware module
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Bartek Rutkowski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-12 14:43 UTC by Juan Ramón Molina Menor
Modified: 2014-11-27 21:58 UTC (History)
6 users (show)

See Also:


Attachments
Staging patch for Makefile (893 bytes, patch)
2014-09-12 14:43 UTC, Juan Ramón Molina Menor
no flags Details | Diff
malo-firmware-1.4_2.diff (4.17 KB, patch)
2014-09-12 23:42 UTC, Carlos J Puga Medina
no flags Details | Diff
malo-firmware-1.4.shar (3.10 KB, text/plain)
2014-11-10 21:37 UTC, Carlos J Puga Medina
no flags Details
malo-firmware-1.4.shar (3.09 KB, text/plain)
2014-11-10 23:48 UTC, Carlos J Puga Medina
no flags Details
malo-firmware-kmod.diff (526 bytes, patch)
2014-11-22 19:15 UTC, Carlos J Puga Medina
no flags Details | Diff
malo-firmware-kmod.shar (3.12 KB, text/plain)
2014-11-24 01:15 UTC, Carlos J Puga Medina
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juan Ramón Molina Menor 2014-09-12 14:43:55 UTC
Created attachment 147248 [details]
Staging patch for Makefile

Installing the malo(4) firmware kernel module fails with:

===>   Registering installation for malo-firmware-kmod-3.0.0.39_1
pkg-static: lstat(/root/malo-firmware-1.4/work/stage/boot/modules/malofw.ko): No suuh file or directory
*** Error code 74

Please find attached patch for staging this port and resolving the issue.

The original port was downloaded, as for malo(4) manual, from:
http://weongyo.org/project/malo/malo-firmware-1.4.tar.gz

NOTE: I’m far from understanding throughly how this (or any other) Makefile works, but the proposed patch works in my set up.
Comment 1 Adrian Chadd freebsd_committer freebsd_triage 2014-09-12 19:24:12 UTC
Hi!

This is a ports thing! I'd like some help!

Thanks!

-a
Comment 2 Juan Ramón Molina Menor 2014-09-12 20:26:22 UTC
(In reply to Adrian Chadd from comment #1)
> Hi!
> 
> This is a ports thing! I'd like some help!
> 
> Thanks!
> 
> -a

Hi Adrian.

You should maybe wait before wasting your time: the kernel module installs and loads without issues… but the card is not recognized, no dmesg or pciconf output. 

I had better luck with ndis: it created the module based on the XP driver and the card was recognized, but failed with:
ndis0: <IEEE 802.11g Wireless Cardbus/PCI Adapter> mem 0xeb000000-0xeb00ffff,0xeb010000-0xeb01ffff irq 19 at device 8.0 on pci0
ndis0: NDIS API version: 5.0
ndis0: init handler failed
device_attach: ndis0 attach returned 6

At first I thought the problem was the lack of firmware, so I repeated the process adding to the Windows driver files the two files (malo8335-h and malo8335-m) packed in:
http://weongyo.org/project/malo/malo-firmware-1.4.tar.gz

… but the result was the same.

I’m quite sure this card is ok (just bought it from a serious shop) but I have no XP computer to test it.

I guess I should open different PRs for this, isn’t it?

Best regards,
Juan
Comment 3 Carlos J Puga Medina 2014-09-12 23:42:46 UTC
Created attachment 147260 [details]
malo-firmware-1.4_2.diff

I reviewed it to reduce portlint warnings.

% portlint
WARN: Makefile: use of DISTFILES with single file discouraged. distribution filename should be set by DISTNAME and EXTRACT_SUFX.
WARN: Makefile: Consider defining LICENSE.
WARN: Makefile: DISTFILES/DISTNAME affects WRKSRC. take caution when changing them.
WARN: Makefile: "NO_PACKAGE" found. do not forget to update ports/LEGAL.
WARN: Consider to set DEVELOPER=yes in /etc/make.conf
0 fatal errors and 5 warnings found.
Comment 4 Carlos J Puga Medina 2014-09-12 23:55:01 UTC
I temporarily comment 'NO_PACKAGE' in order to test it via redports:

https://redports.org/buildarchive/20140912234901-6736/
Comment 5 Juan Ramón Molina Menor 2014-09-13 23:01:35 UTC
Thanks Carlos, I could have not do it myself.

Do you think I should open a new PR for the problem with the driver itself? The chip on this card is expected to be supported but it seems it's not the case and the lack of attention to the firmware port could suggest that it's better to abandon it.

Best regards,
Juan
Comment 6 Carlos J Puga Medina 2014-09-13 23:09:17 UTC
(In reply to Juan Ramón Molina Menor from comment #5)
> Thanks Carlos, I could have not do it myself.
> 
> Do you think I should open a new PR for the problem with the driver itself?
> The chip on this card is expected to be supported but it seems it's not the
> case and the lack of attention to the firmware port could suggest that it's
> better to abandon it.
> 
> Best regards,
> Juan

Yes, file a new PR.
Comment 7 Juan Ramón Molina Menor 2014-09-14 08:55:14 UTC
(In reply to Carlos Jacobo Puga Medina from comment #6)
> (In reply to Juan Ramón Molina Menor from comment #5)
> > Thanks Carlos, I could have not do it myself.
> > 
> > Do you think I should open a new PR for the problem with the driver itself?
> > The chip on this card is expected to be supported but it seems it's not the
> > case and the lack of attention to the firmware port could suggest that it's
> > better to abandon it.
> > 
> > Best regards,
> > Juan
> 
> Yes, file a new PR.

Done: bug 193628.
Comment 8 John Marino freebsd_committer freebsd_triage 2014-10-31 09:40:08 UTC
I can't follow what's going on with this PR.  Should it be closed?   If not, what needs to be done?
Comment 9 Juan Ramón Molina Menor 2014-10-31 10:13:10 UTC
malo(4) is the Marvell Libertas IEEE 802.11b/g wireless network driver. It is included in GENERIC kernel. It requires a firmware kernel module that must be installed through a port that it’s not present in the current ports tree and have to be downloaded from:
http://weongyo.org/project/malo/malo-firmware-1.4.tar.gz

As this port has not been updated to conform to the new staging infrastructure, these family of NICs cannot work in recent versions of FreeBSD.

I guess the solution should be to contact weongyo@FreeBSD.org for replacing the above mentioned file with the patched (staged) one provided by Carlos. Or move the port to the official ports tree and change the malo(4) man page. This is maybe not possible, as hinted in the pkg-descr file:

Marvell Libertas 88W8335 firmware files are not free because Marvell
refuses to grant distribution rights.  As a result, we need to build the
firmware using ports.

This firmware files are comed from OpenBSD malo driver.

	http://www.nazgul.ch/malo/malo-firmware-1.4.tgz

Hope I understood it well and it helps,
Juan
Comment 10 John Marino freebsd_committer freebsd_triage 2014-10-31 14:21:32 UTC
yes, it helps.

If I understand this correctly, the original port is in the link mentioned in in the description, and the attachments are patches to that link.

Needless to that, that is less than optimal (read unacceptable).

A new port needs to be introduced with a shar file: 
https://www.freebsd.org/doc/en/books/porters-handbook/porting-submitting.html

Before this port can advance, I'd like to see a completely up-to-date shar file submitted and all the other patches made obsolete.   We also need poudriere logs with stage-qa checks (testport, bulk -t) as a second attachment, at the very least.
Comment 11 Juan Ramón Molina Menor 2014-11-03 11:42:00 UTC
Sorry, but I’m not competent enough to tackle such a task. :(
Comment 12 John Marino freebsd_committer freebsd_triage 2014-11-03 11:50:28 UTC
well, there are 4 other people listening to this PR.

If one of them can do it, then they should, otherwise we have to close the PR.

Superficially I don't see what is so difficult but the task but if you can't do it, so be it.
Comment 13 Juan Ramón Molina Menor 2014-11-03 12:07:30 UTC
I’m a mere final user with very little experience in programming. Nevertheless, if nobody steps up I’ll try to fulfil the task.
Comment 14 Carlos J Puga Medina 2014-11-04 11:54:00 UTC
I'll take it.

Thanks, John :)
Comment 15 Juan Ramón Molina Menor 2014-11-04 12:21:35 UTC
(In reply to Carlos Jacobo Puga Medina from comment #14)
> I'll take it.
> 
> Thanks, John :)

And thanks to you Carlos! I had just installed poudriere but was scared about wasting my time and yours by lack of knowledge.
Comment 16 Carlos J Puga Medina 2014-11-07 12:32:41 UTC
Don't worry about, mate. This weekend I'll attach the shar file.
Comment 17 Carlos J Puga Medina 2014-11-10 21:37:10 UTC
Created attachment 149270 [details]
malo-firmware-1.4.shar

Attached shar file according to request.
Comment 18 John Marino freebsd_committer freebsd_triage 2014-11-10 22:47:09 UTC
two minor issues:

XPORTREVISION=	2

why does a new port have PORTREVISION set?  it should not.


change this:
X	cd ${WRKSRC}/${DRIVERNAME}; ${SETENV} KMODDIR="${KMODDIR}" make all
to
X	(cd ${WRKSRC}/${DRIVERNAME} && \
		${SETENV} KMODDIR="${KMODDIR}" ${MAKE_CMD} all)


Is it possible to get verification with poudriere log (attached)?
Comment 19 Carlos J Puga Medina 2014-11-10 23:48:32 UTC
Created attachment 149274 [details]
malo-firmware-1.4.shar

It was fixed. Regarding to the poudriere logs, I'm testing it now.

Thanks, John :)
Comment 21 John Marino freebsd_committer freebsd_triage 2014-11-13 11:15:23 UTC
Looks good, I'm promoting the PR.
Comment 22 Bartek Rutkowski freebsd_committer freebsd_triage 2014-11-16 12:34:48 UTC
John, I've few doubts about the package, namely the issues listed by portlint:

WARN: Makefile: use of DISTFILES with single file discouraged. distribution filename should be set by DISTNAME and EXTRACT_SUFX.
WARN: Makefile: Consider defining LICENSE.
WARN: Makefile: DISTFILES/DISTNAME affects WRKSRC. take caution when changing them.
WARN: Makefile: "NO_PACKAGE" found. do not forget to update ports/LEGAL.

and the fact that the port is called 'malo-firmware-1.4' however, the port version seems to be extracted from firmware version, that comes from distfiles and currently is  '3.0.0.39', so the package name will be extremely confusing, like 'malo-firmware-1.4-3.0.0.39'. Beside that, what's the '1.4', if the port version is '3.0.0.39'?

Mind looking into the Makefile a bit more carefully and help us solve the puzzle?
Comment 23 John Marino freebsd_committer freebsd_triage 2014-11-21 11:49:15 UTC
As a super-quick, untested review:

change
DISTFILES=	${FWNAME}${EXTRACT_SUFX}
to
DISTNAME=	${FWNAME}


change:
WRKSRC=		${WRKDIR}
to
NO_WRKSUB=	yes


I don't see any problem with the versions -- I assume 1.4 means something.


You'll need to update LEGAL too per portlint warning.
Comment 24 Carlos J Puga Medina 2014-11-21 15:31:48 UTC
Ok, I will do that tonight.
Comment 25 John Marino freebsd_committer freebsd_triage 2014-11-21 15:34:37 UTC
robak can do it as well -- although it would be nice to get those changes tested.
Comment 26 Carlos J Puga Medina 2014-11-22 19:15:16 UTC
Created attachment 149727 [details]
malo-firmware-kmod.diff

Done!
Comment 27 Carlos J Puga Medina 2014-11-24 01:15:45 UTC
Created attachment 149760 [details]
malo-firmware-kmod.shar
Comment 28 commit-hook freebsd_committer freebsd_triage 2014-11-27 21:57:27 UTC
A commit references this bug:

Author: robak
Date: Thu Nov 27 21:57:13 UTC 2014
New revision: 373524
URL: https://svnweb.freebsd.org/changeset/ports/373524

Log:
  net/malo-firmware-kmod: NEW PORT - Marvell Libertas 88W8335 firmware

  Marvell Libertas 88W8335 firmware files are not free because Marvell
  refuses to grant distribution rights.  As a result, we need to build the
  firmware using ports.

  This firmware files are comed from OpenBSD malo driver.

  WWW: http://www.nazgul.ch/malo/

  PR:		193588
  Submitted by:	Juan Ramon Molina Menor <info@juanmolina.eu>

Changes:
  head/LEGAL
  head/net/Makefile
  head/net/malo-firmware-kmod/
  head/net/malo-firmware-kmod/Makefile
  head/net/malo-firmware-kmod/distinfo
  head/net/malo-firmware-kmod/pkg-descr
  head/net/malo-firmware-kmod/pkg-plist
Comment 29 Bartek Rutkowski freebsd_committer freebsd_triage 2014-11-27 21:58:21 UTC
Committed, thanks for your work!