Skip to contentSkip to conversation

pcmciautils: New package. Patch against current git attached

Buildroot Patrik Dahlström 2 participants 3 messages Sep 28, 2010 – Sep 29, 2010

lore
Share & tools
lore
#0 lore raw

Hello,

I've made a patch to add pcmciautils to the list of packages in buildroot. Please review and reply with comments and improvement

Signature · 12 lines
Yours sincerely
Patrik Dahlstr?m

"all animals except man know that the principal business of life is to enjoy 
it!" --Samuel Butler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_pcmciautils.patch
Type: text/x-patch
Size: 4661 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20100929/e18481db/attachment.bin>
#1 lore raw

Hello Patrik,

Thanks for this patch. First comment: the usual practice is to include the patch inline in the e-mail, to make it easier to comment on. You can achieve this very easily without having any problem related to your e-mail client by using "git send-email" (you just need to teach Git about your SMTP server and configuration).

No, on your patch!

package/pcmciautils/Config.in line 5

Quoted 11 lines · On Wed, 29 Sep 2010 00:19:33 +0200 Patrik Dahlstr?m <[email protected]> wrote:
package/pcmciautils/Config.in new file +5 -0
new file mode 100644
index 0000000..ad8b26a
@@ -0,0 +1,40 @@
+config BR2_PACKAGE_PCMCIAUTILS
+	bool "pcmciautils"
+    depends on BR2_PACKAGE_LIBSYSFS && BR2_PACKAGE_UDEV || BR2_PACKAGE_LIBSYSFS && BR2_PACKAGE_HOTPLUG
+	help
+	  Set of tools needed to use PC-card slots usually found in laptops

There are indentation issues here. The indentation rules :

* Nothing before the "config"

* One tab before all sub-specifiers such as "bool", "depends", "select" and "help"

* One tab + two spaces before each line of the help text.

Regarding the dependencies :

* We usually use a "select" type of dependency for libraries. So you could "select BR2_PACKAGE_LIBSYSFS"

* Hotplug is deprecated, so I'm not sure it's worth supporting it.

* It's usual to add a comment when something can't be selected due to a missing dependency.

So you could have :

config BR2_PACKAGE_PCMCIAUTILS
select BR2_PACKAGE_LIBSYSFS
depends on BR2_PACKAGE_UDEV

comment "pcmciautils requires udev"
depends on !BR2_PACKAGE_UDEV

package/pcmciautils/Config.in line 18

Quoted 13 lines
package/pcmciautils/Config.in new file +13 -0
+if BR2_PACKAGE_PCMCIAUTILS
+
+config BR2_PACKAGE_PCMCIAUTILS_STARTUP
+	bool "Build socket-startup script"
+	default y
+	help
+      Enable this if you need the socket-startup script
+ 
+	  You don't need it if the socket driver does not select
+	  PCCARD_NONSTATIC -- that is the case for many embedded systems --
+	  and for yenta_socket if the cardbus bridge is either below a
+	  PCI-PCI bridge, or where the PCI bus is not equivalent to the host
+	  bus (e.g. on PPC)

Not sure to understand this help text, but probably it's because I'm not familiar with pcmcia support.

package/pcmciautils/Config.in line 30

Quoted 12 lines
package/pcmciautils/Config.in new file +12 -0
+choice
+	prompt "pcmciautils invocation system"
+	default BR2_PACKAGE_PCMCIAUTILS_HOTPLUG
+	help
+	  Select which system to use to invoke the necessary pcmciautils commands.
+
+	config BR2_PACKAGE_PCMCIAUTILS_HOTPLUG
+		bool "linux hotplug"
+
+	config BR2_PACKAGE_PCMCIAUTILS_UDEV
+		bool "udev"
+endchoice

As per the suggestion above, I'd get rid of the "hotplug" thing.

Do you have any idea on whether pcmciautils can work on top of mdev (the light Busybox reimplementation of udev) ?

package/pcmciautils/Config.in line 36

Quoted 6 lines
package/pcmciautils/Config.in new file +6 -0
+config BR2_PACKAGE_PCMCIAUTILS_STATIC
+	bool "Static build"
+	default y
+	help
+	  Enable this if you want to statically link the binaries
+	  to be compiled.

It's not usual for packages to have such options. There's a global option BR2_PREFER_STATIC that can be used instead, even though it's usage is not very widespread and therefore fairly broken.

package/pcmciautils/Config.in

Quoted 7 lines
package/pcmciautils/Config.in new file +7 -0
+# pcmciautils also depends on module-init-tool (according to
+# their manual, but that package might also be provided by busybox.
+# Not really shure if it's really necessary to list module-init-tools
+# as a dependency for pcmciautils though.
+#ifeq ($(BR2_PACKAGE_MODULE_INIT_TOOLS),y)
+#	PCMCIAUTILS_DEPENDENCIES += module-init-tools
+#endif

pcmciautils does not need module-init-tools at build time, it's only the udev/hotplug rules that need modprobe to load the appropriate kernel module automatically.

The insmod/rmmod/lsmod/modprobe commands are part of our default Busybox configuration file, so I think we can safely assume that those will be present on the target. We may improve this later if we want to properly support building target systems without Busybox, but I think many of our packages are broken with regard to this, so let's not make the rules more complicated for this package than for all the other we already have.

package/pcmciautils/Config.in

Quoted 7 lines
package/pcmciautils/Config.in new file +7 -0
+define PCMCIAUTILS_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_CC)" -C "$(@D)" \
+		STARTUP=$(BR2_PACKAGE_PCMCIAUTILS_BUILD_STARTUP) \
+		UDEV=$(BR2_PACKAGE_PCMCIAUTILS_BUILD_UDEV) \
+		STATIC=$(BR2_PACKAGE_PCMCIAUTILS_BUILD_STATIC) \
+		DESTDIR="$(TARGET_DIR)" \
+		KERNEL_DIR="$(BUILD_DIR)/linux-$(LINUX26_VERSION)" \

Any idea why KERNEL_DIR is needed ? It's indeed defined in their main Makefile, but doesn't seem to be used anywhere. Because if pcmciautils really needs to have access to the kernel sources, then you need to add a dependency on linux26, otherwise you have no guarantees that $(BUILD_DIR)/linux-$(LINUX26_VERSION) will contain something.

Quoted 6 lines
package/pcmciautils/Config.in new file +6 -0
+		HOSTCC="$(HOSTCC)" \
+		V="true"
+endef
+
+define PCMCIAUTILS_INSTALL_TARGET_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_CC)" -C "$(@D)" \

package/pcmciautils/Config.in

Quoted 10 lines
package/pcmciautils/Config.in new file +10 -0
+		DESTDIR="$(TARGET_DIR)" \
+		INSTALL="$(INSTALL)" \
+		INSTALL_PROGRAM="$(INSTALL)" \
+		install
+# Buildroot seems to remove /usr/share/man already.
+#	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_CC)" -C "$(@D)" \
+#		DESTDIR="$(TARGET_DIR)" \
+#		INSTALL="$(INSTALL)" \
+#		INSTALL_PROGRAM="$(INSTALL)" \
+#		uninstall-man

Yes, manpages are already removed globally by Buildroot in the top-level Makefile, unless BR2_HAVE_DOCUMENTATION is enabled (and by default this option is not set). So there's no need to do this uninstallation of manpages directly in your package .mk file.

Thanks again for this contribution!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw
Quoted 1 line · On Wednesday 29 September 2010 08:45:14 Thomas Petazzoni wrote:

Hello Patrik,

Hi Thomas

Quoted 5 lines

Thanks for this patch. First comment: the usual practice is to include the patch inline in the e-mail, to make it easier to comment on. You can achieve this very easily without having any problem related to your e-mail client by using "git send-email" (you just need to teach Git about your SMTP server and configuration).

Sorry about that. I did git send-email first, but resorted to kmail when git wasn't set up (it was past midnight after all).

Quoted 19 lines

No, on your patch!

On Wed, 29 Sep 2010 00:19:33 +0200

package/pcmciautils/Config.in

Quoted 11 lines · Patrik Dahlstr?m
(quoted diff) +0 -0

b/package/pcmciautils/Config.in new file mode 100644 index 0000000..ad8b26a

package/pcmciautils/Config.in new file +3 -0
@@ -0,0 +1,40 @@
+config BR2_PACKAGE_PCMCIAUTILS
+	bool "pcmciautils"
+    depends on BR2_PACKAGE_LIBSYSFS && BR2_PACKAGE_UDEV ||

BR2_PACKAGE_LIBSYSFS && BR2_PACKAGE_HOTPLUG + help

package/pcmciautils/Config.in new file +1 -0
+	  Set of tools needed to use PC-card slots usually found in laptops

There are indentation issues here. The indentation rules :

Quoted 6 lines

* Nothing before the "config"

* One tab before all sub-specifiers such as "bool", "depends", "select" and "help"

* One tab + two spaces before each line of the help text.

The patch got truncated when attached. I've followed these rules in my files and it is also present in the patch (on my machine). Next submit will be with git send-mail.

Quoted 4 lines

Regarding the dependencies :

* We usually use a "select" type of dependency for libraries. So you could "select BR2_PACKAGE_LIBSYSFS"

Done

Quoted 2 lines

* Hotplug is deprecated, so I'm not sure it's worth supporting it.

I actually use it on my system (thought it would be smaller and faster, perhaps not).

Quoted 4 lines

* It's usual to add a comment when something can't be selected due to a missing dependency.

Quoted 8 lines

So you could have :

config BR2_PACKAGE_PCMCIAUTILS
select BR2_PACKAGE_LIBSYSFS
depends on BR2_PACKAGE_UDEV

comment "pcmciautils requires udev"
depends on !BR2_PACKAGE_UDEV

Done!

Quoted 8 lines
Quoted 8 lines
package/pcmciautils/Config.in new file +8 -0
+if BR2_PACKAGE_PCMCIAUTILS
+
+config BR2_PACKAGE_PCMCIAUTILS_STARTUP
+	bool "Build socket-startup script"
+	default y
+	help
+      Enable this if you need the socket-startup script
+
Quoted 8 lines

package/pcmciautils/Config.in

Quoted 5 lines
package/pcmciautils/Config.in new file +5 -0
+	  You don't need it if the socket driver does not select
+	  PCCARD_NONSTATIC -- that is the case for many embedded systems --
+	  and for yenta_socket if the cardbus bridge is either below a
+	  PCI-PCI bridge, or where the PCI bus is not equivalent to the host
+	  bus (e.g. on PPC)

Not sure to understand this help text, but probably it's because I'm not familiar with pcmcia support.

Not really shure either. I copied it from the Makefile. I could research it a bit. All I know is that it was needed for my system (old Compaq laptop, 120MHz).

Quoted 15 lines

package/pcmciautils/Config.in

Quoted 12 lines
package/pcmciautils/Config.in new file +5 -0
+choice
+	prompt "pcmciautils invocation system"
+	default BR2_PACKAGE_PCMCIAUTILS_HOTPLUG
+	help
+	  Select which system to use to invoke the necessary pcmciautils

commands. +

package/pcmciautils/Config.in new file +6 -0
+	config BR2_PACKAGE_PCMCIAUTILS_HOTPLUG
+		bool "linux hotplug"
+
+	config BR2_PACKAGE_PCMCIAUTILS_UDEV
+		bool "udev"
+endchoice

As per the suggestion above, I'd get rid of the "hotplug" thing.

Quoted 2 lines

Do you have any idea on whether pcmciautils can work on top of mdev (the light Busybox reimplementation of udev) ?

Not shure. As I said before I used the hotplug scripts.

Quoted 11 lines

package/pcmciautils/Config.in

Quoted 7 lines
package/pcmciautils/Config.in new file +6 -0
+config BR2_PACKAGE_PCMCIAUTILS_STATIC
+	bool "Static build"
+	default y
+	help
+	  Enable this if you want to statically link the binaries
+	  to be compiled.

It's not usual for packages to have such options. There's a global option BR2_PREFER_STATIC that can be used instead, even though it's usage is not very widespread and therefore fairly broken.

Forgot about that option. Static builds can be good for initramfs and such, or so I'm told.

Quoted 12 lines

package/pcmciautils/Config.in

Quoted 7 lines
package/pcmciautils/Config.in new file +7 -0
+# pcmciautils also depends on module-init-tool (according to
+# their manual, but that package might also be provided by busybox.
+# Not really shure if it's really necessary to list module-init-tools
+# as a dependency for pcmciautils though.
+#ifeq ($(BR2_PACKAGE_MODULE_INIT_TOOLS),y)
+#	PCMCIAUTILS_DEPENDENCIES += module-init-tools
+#endif

pcmciautils does not need module-init-tools at build time, it's only the udev/hotplug rules that need modprobe to load the appropriate kernel module automatically.

Quoted 7 lines

The insmod/rmmod/lsmod/modprobe commands are part of our default Busybox configuration file, so I think we can safely assume that those will be present on the target. We may improve this later if we want to properly support building target systems without Busybox, but I think many of our packages are broken with regard to this, so let's not make the rules more complicated for this package than for all the other we already have.

Yeah, I had the same thought. I left it in for your comments.

Quoted 14 lines

package/pcmciautils/Config.in

Quoted 8 lines
package/pcmciautils/Config.in new file +7 -0
+define PCMCIAUTILS_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_CC)" -C "$(@D)" \
+		STARTUP=$(BR2_PACKAGE_PCMCIAUTILS_BUILD_STARTUP) \
+		UDEV=$(BR2_PACKAGE_PCMCIAUTILS_BUILD_UDEV) \
+		STATIC=$(BR2_PACKAGE_PCMCIAUTILS_BUILD_STATIC) \
+		DESTDIR="$(TARGET_DIR)" \
+		KERNEL_DIR="$(BUILD_DIR)/linux-$(LINUX26_VERSION)" \

Any idea why KERNEL_DIR is needed ? It's indeed defined in their main Makefile, but doesn't seem to be used anywhere. Because if pcmciautils really needs to have access to the kernel sources, then you need to add a dependency on linux26, otherwise you have no guarantees that $(BUILD_DIR)/linux-$(LINUX26_VERSION) will contain something.

You're right. I think KERNEL_DIR can safely be removed.

Quoted 23 lines
Quoted 7 lines
package/pcmciautils/Config.in new file +6 -0
+		HOSTCC="$(HOSTCC)" \
+		V="true"
+endef
+
+define PCMCIAUTILS_INSTALL_TARGET_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_CC)" -C "$(@D)" \

package/pcmciautils/Config.in

Quoted 10 lines
package/pcmciautils/Config.in new file +10 -0
+		DESTDIR="$(TARGET_DIR)" \
+		INSTALL="$(INSTALL)" \
+		INSTALL_PROGRAM="$(INSTALL)" \
+		install
+# Buildroot seems to remove /usr/share/man already.
+#	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_CC)" -C "$(@D)" \
+#		DESTDIR="$(TARGET_DIR)" \
+#		INSTALL="$(INSTALL)" \
+#		INSTALL_PROGRAM="$(INSTALL)" \
+#		uninstall-man

Yes, manpages are already removed globally by Buildroot in the top-level Makefile, unless BR2_HAVE_DOCUMENTATION is enabled (and by default this option is not set). So there's no need to do this uninstallation of manpages directly in your package .mk file.

Quoted 3 lines

Thanks again for this contribution!

Thomas

I'll commit a new patch later tonight when I get home and can setup git mail correctly.

--
Yours sincerely
Patrik Dahlstr?m

"all animals except man know that the principal business of life is to enjoy it!" --Samuel Butler