You are not logged in.

#1 2009-12-03 16:11:47

Aedit
Member
Registered: 2009-10-29
Posts: 138

hdparm recompilation

hdparm has been flagged out of date in the repos (not yet updated though). I just tried to compile it myself (while tracking down a bug which may or may not be related).

Weirdly Arch is on version 9.27, but the 9.27 from http://sourceforge.net/projects/hdparm/ has a different md5sum from the Arch PKGBUILD.

Sourceforge 9.27: e652dabb6c9233fb8a23ef60a17a1829
Arch PKGBUILD 9.27: 3cf69b270f49f651851889a0787934d1

Simply changing the md5sum in the PKGBUILD isn's sufficient for it to compile:

cc -s -o hdparm hdparm.o identify.o sgio.o sysfs.o geom.o fallocate.o fibmap.o fwdownload.o dvdspeed.o
sgio.o: In function `scsi_command_size':
sgio.c:(.text+0x26): undefined reference to `scsi_command_size_tbl'
collect2: ld returned 1 exit status
make: *** [hdparm] Error 1
==> ERROR: Build Failed.
    Aborting...

After removing the scsi.h include it does compile:

diff -Naur sgio.c.orig sgio.c 
--- sgio.c.orig 2009-12-03 15:53:07.257130033 +0000
+++ sgio.c      2009-12-03 16:01:36.891227175 +0000
@@ -9,7 +9,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#include <scsi/scsi.h>
 #include <scsi/sg.h>
 
 #include "sgio.h"

Not sure that's right yet. Perhaps this thread is relevant: http://lkml.org/lkml/2009/6/28/21

Looking at the changelog, it looks like the hdparm devs REreleased 9.27 without changing the version number.

Changelog:
hdparm-9.27
        - repackaged again with wiper-2.5
        - wiper.sh updated to wiper-2.3
        - fix definition of reg_flags in sgio.h to work with old IDE drivers again

Btw, hdparm has dependencies on some kernel header files. At least <linux/fs.h> has changed since hdparm was last compiled for Arch.

Any thoughts?

Offline

#2 2009-12-04 16:00:16

Aedit
Member
Registered: 2009-10-29
Posts: 138

Re: hdparm recompilation

Here's a working PKGBUILD

# $Id: PKGBUILD 51328 2009-09-07 15:58:27Z tpowa $
# Maintainer: Paul Mattal <paul@archlinux.org>

pkgname=hdparm
pkgver=9.27
pkgrel=2
pkgdesc="A shell utility for manipulating Linux IDE drive/driver parameters"
arch=(i686 x86_64)
depends=('glibc')
optdepends=('sh: required by idectl and ultrabayd')
groups=('base')
source=(http://downloads.sourceforge.net/sourceforge/hdparm/${pkgname}-${pkgver}.tar.gz)
license=('BSD')
url="http://sourceforge.net/projects/hdparm/"
options=('emptydirs')
md5sums=('e652dabb6c9233fb8a23ef60a17a1829')

build() {
  cd ${srcdir}/${pkgname}-${pkgver} || return 1

  #patch
  mv sgio.c sgio.c.orig
  grep -v "#include <scsi/scsi.h>" sgio.c.orig > sgio.c

  # build
  make || return 1

  # install
  mkdir -p ${pkgdir}/{usr,sbin} || return 1
  make DESTDIR=${pkgdir} install || return 1
  install -m755 contrib/idectl ${pkgdir}/sbin || return 1
  install -m755 contrib/ultrabayd ${pkgdir}/sbin || return 1

  #install license file
  install -D -m 644 LICENSE.TXT $pkgdir/usr/share/licenses/hdparm/LICENSE.TXT
}

Offline

#3 2009-12-06 12:43:58

Aedit
Member
Registered: 2009-10-29
Posts: 138

Re: hdparm recompilation

It seems there is a mess in /usr/include/scsi/scsi.h and it's not (entirely) of Arch's making.

The kernel and glibc _both_ export /usr/include/scsi/scsi.h. In the LKML thread I referenced above, it was pointed out that the scsi.h exported by the kernel is not usable by userspace because userspace
cannot use scsi_command_size_tbl, COMMAND_SIZE and scsi_device_type defined in kernel.

The solution suggested is to put "#ifdef __KERNEL__" around the offending lines so that the header can be used by userspace. AFAICS this has not been implemented, even in 2.6.32.

This thread is also relevant: http://lkml.org/lkml/2009/7/29/224

The glibc header is here:
http://sourceware.org/git/?p=glibc.git; … .h;hb=HEAD

Since 2009-10-19, the Arch glibc PKGBUILD has a line which deletes the scsi.h exported by glibc. So the one we see in Arch is the (unusable) kernel-headers one.

$ pacman -Qo /usr/include/scsi/*
/usr/include/scsi/scsi.h is owned by kernel-headers 2.6.31.5-1
/usr/include/scsi/scsi_bsg_fc.h is owned by kernel-headers 2.6.31.5-1
/usr/include/scsi/scsi_ioctl.h is owned by glibc 2.11-1
/usr/include/scsi/scsi_netlink.h is owned by kernel-headers 2.6.31.5-1
/usr/include/scsi/scsi_netlink_fc.h is owned by kernel-headers 2.6.31.5-1
/usr/include/scsi/sg.h is owned by glibc 2.11-1
/usr/include/scsi/sg_cmds.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_cmds_basic.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_cmds_extra.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_cmds_mmc.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_io_linux.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_lib.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_lib_data.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_linux_inc.h is owned by sg3_utils 1.28-1
/usr/include/scsi/sg_pt.h is owned by sg3_utils 1.28-1

http://repos.archlinux.org/wsvn/package … &rev=56088

So... Allan broke it  ;-) .

Offline

#4 2009-12-06 15:38:24

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: hdparm recompilation

File a bug report.

Offline

#5 2009-12-06 15:49:32

Aedit
Member
Registered: 2009-10-29
Posts: 138

Re: hdparm recompilation

See also http://bbs.archlinux.org/viewtopic.php?id=83451

In the kernel-headers build Arch already has a patch for scsi.h (scsi.patch)
http://repos.archlinux.org/wsvn/package … core-i686/
which is the patch here:
http://lkml.org/lkml/2009/7/29/106

I guess scsi.patch could be expanded to include the patch from here:
http://lkml.org/lkml/2009/6/27/125

Don't know if the kernel devs are actually going to commit these patches in the kernel or if something else is planned.

Offline

#6 2009-12-06 16:00:39

Aedit
Member
Registered: 2009-10-29
Posts: 138

Re: hdparm recompilation

falconindy wrote:

File a bug report.

I already did: http://bugs.archlinux.org/task/17383

Offline

#7 2009-12-06 18:01:29

Aedit
Member
Registered: 2009-10-29
Posts: 138

Re: hdparm recompilation

The latest info I have found on this is the patchset starting here:
http://lkml.indiana.edu/hypermail/linux … 01637.html

Offline

Board footer

Powered by FluxBB