On 07/14/2012 06:44 PM, Bruce Dubbs wrote:
Armin K. wrote:
On 07/14/2012 10:51 AM, Armin K. wrote:
On 07/14/2012 01:30 AM, Bruce Dubbs wrote:
OK, here is my first trial build of udev from systemd.

These are the instructions:

wget http://www.freedesktop.org/software/systemd/systemd-186.tar.xz
tar -xf systemd-186.tar.xz
cd systemd-186

tar -xf ../udev-lfs-186.tar.bz2

make -f udev-lfs-186/Makefile.lfs
make -f udev-lfs-186/Makefile.lfs DESTDIR=/tmp/udev install

The build time on my system is about 10 seconds.  It builds in chroot
for a fresh system I built a couple of days ago, but I have not actually
tried to boot with it yet.

I'll keep testing, but would appreciate feedback.

      -- Bruce



Hi there. I just got to test it. It ends up with an error:

$ make -f udev-lfs-186/Makefile.lfs
CC src/shared/util.c
src/shared/util.c: In function ‘parse_bytes’:
src/shared/util.c:2867:17: error: overflow in implicit constant
conversion [-Werror=overflow]
src/shared/util.c:2868:17: error: overflow in implicit constant
conversion [-Werror=overflow]
src/shared/util.c:2869:17: error: overflow in implicit constant
conversion [-Werror=overflow]
src/shared/util.c: In function ‘format_bytes’:
src/shared/util.c:5441:17: error: overflow in implicit constant
conversion [-Werror=overflow]
src/shared/util.c:5442:17: error: overflow in implicit constant
conversion [-Werror=overflow]
src/shared/util.c:5443:17: error: overflow in implicit constant
conversion [-Werror=overflow]
cc1: some warnings being treated as errors
make: *** [build/util.o] Error 1

It's x86 LFS.

I looked at the code and it's wrong for 32 bit systems.  They use off_t
where it needs to use uint64_t.  The error cascades, but we don't use
the two functions in udev anyway.

Other thing that I dislike is shipping .la file. Those files are
UNNECESARY in every context. You are not building udev with libtool so
that file is pointless. Just look at files that don't use autotools,
they don't have .la files, but they work very great. BLFS talloc, mysql,
most packages that use cmake don't have .la files, but work  very well.

I thought about that a little, but don't know enough about libtool to
make a change.  I was just emulation upstream for this.

Also, shipping rules in the archive is really nice, avoids having 2
archives. I would suggest you look at Debian's write_dev_root_rule. That
one had to be started before udevadm settle and after udevd. It symlinks
/dev/root to whatever partition that is set as root partition (/). I had
some problems with grub-install without that one. Also with
grub-mkconfig ...



I found the error. It's 32bit specific problem only. You need to add
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to CFLAGS. See
http://comments.gmane.org/gmane.comp.sysutils.systemd.devel/4897

OK, does just adding those to the defines in the Makefile.lfs fix it for
you?

Yup.


Another stuff

         -DUSB_DATABASE=0                  \
         -DPCI_DATABASE=0                  \

You can safely add here path to usb.ids and pci.ids ... It won't fail in
building, nor at runtime. It will just print a warning if they don't
exist. That was the requirement of pciutils and usbutils, just to find
the location of such files.

I'll do that.  I'll check to see if the full path is needed.


I would recommend you use /usr/share/misc/usb.ids and /usr/share/misc/pci.ids for that. I'll change pciutils and usbutils instructions accordingly. Or if you like, we can ship pci.ids and usb.ids with udev (ArchLinux has seperate package only for those two files) and disable their installation in {usb,pci}utils. That way we can ensure they are newer by updating them from upstream rather than relying on those that are in the tarballs and are possibly outdated.

    -- Bruce





I've taken some time and wrote rules to build udev's keymap feature. I used the same way upstream does. But, I think it would be better for us to skip generation targets and ship generated files in our tarball, so we would drop need for gperf and could happily build keymap tool in LFS. Sorry, I could not find cleaner way to build it with all those generation rules. It's good start however. keymaps and keymaps-force-release are taken from udev's (systemd's) Makefile.am. Would you mind to take a look? Also, I guess we could use some kind of checking for x86 before we add -DLARGEFILE ... stuff into cflags. What do you think? I will take a look on how to build gudev and gir data for now. If I can make your life easier with my current changes, just ask.
diff -Naur udev-lfs.orig/Makefile.lfs udev-lfs/Makefile.lfs
--- udev-lfs.orig/Makefile.lfs	2012-07-14 01:11:56.000000000 +0200
+++ udev-lfs/Makefile.lfs	2012-07-14 19:09:38.504889012 +0200
@@ -23,7 +23,7 @@
 -Werror=overflow -Wp,-D_FORTIFY_SOURCE=2 -Wno-long-long 
 
 OPTIONS = -O2 -pipe -ffast-math -fno-common -fdiagnostics-show-option \
--fno-strict-aliasing -ffunction-sections -fdata-sections -fPIC
+-fno-strict-aliasing -ffunction-sections -fdata-sections -fPIC  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 
 OPTIONS2 := $(OPTIONS) -fvisibility=hidden
 
@@ -123,6 +123,74 @@
 
 LFS_RULES = 55-lfs.rules
 
+KEYMAPS = \
+	keymaps/acer \
+	keymaps/acer-aspire_5720 \
+	keymaps/acer-aspire_8930 \
+	keymaps/acer-aspire_5920g \
+	keymaps/acer-aspire_6920 \
+	keymaps/acer-travelmate_c300 \
+	keymaps/asus \
+	keymaps/compaq-e_evo \
+	keymaps/dell \
+	keymaps/dell-latitude-xt2 \
+	keymaps/everex-xt5000 \
+	keymaps/fujitsu-amilo_li_2732 \
+	keymaps/fujitsu-amilo_pa_2548 \
+	keymaps/fujitsu-amilo_pro_edition_v3505 \
+	keymaps/fujitsu-amilo_pro_v3205 \
+	keymaps/fujitsu-amilo_si_1520 \
+	keymaps/fujitsu-esprimo_mobile_v5 \
+	keymaps/fujitsu-esprimo_mobile_v6 \
+	keymaps/genius-slimstar-320 \
+	keymaps/hewlett-packard \
+	keymaps/hewlett-packard-2510p_2530p \
+	keymaps/hewlett-packard-compaq_elitebook \
+	keymaps/hewlett-packard-pavilion \
+	keymaps/hewlett-packard-presario-2100 \
+	keymaps/hewlett-packard-tablet \
+	keymaps/hewlett-packard-tx2 \
+	keymaps/ibm-thinkpad-usb-keyboard-trackpoint \
+	keymaps/inventec-symphony_6.0_7.0 \
+	keymaps/lenovo-3000 \
+	keymaps/lenovo-ideapad \
+	keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \
+	keymaps/lenovo-thinkpad_x6_tablet \
+	keymaps/lenovo-thinkpad_x200_tablet \
+	keymaps/lg-x110 \
+	keymaps/logitech-wave \
+	keymaps/logitech-wave-cordless \
+	keymaps/logitech-wave-pro-cordless \
+	keymaps/maxdata-pro_7000 \
+	keymaps/medion-fid2060 \
+	keymaps/medionnb-a555 \
+	keymaps/micro-star \
+	keymaps/module-asus-w3j \
+	keymaps/module-ibm \
+	keymaps/module-lenovo \
+	keymaps/module-sony \
+	keymaps/module-sony-old \
+	keymaps/module-sony-vgn \
+	keymaps/olpc-xo \
+	keymaps/onkyo \
+	keymaps/oqo-model2 \
+	keymaps/samsung-other \
+	keymaps/samsung-90x3a \
+	keymaps/samsung-sq1us \
+	keymaps/samsung-sx20s \
+	keymaps/toshiba-satellite_a100 \
+	keymaps/toshiba-satellite_a110 \
+	keymaps/toshiba-satellite_m30x \
+	keymaps/zepto-znote
+
+KEYMAPS_FR = \
+	keymaps-force-release/dell-touchpad \
+	keymaps-force-release/dell-xps \
+	keymaps-force-release/hp-other \
+	keymaps-force-release/samsung-other \
+	keymaps-force-release/samsung-90x3a \
+	keymaps-force-release/common-volume-keys
+
 VPATH = src/login          src/udev          src/udev/accelerometer \
         src/udev/scsi_id   src/udev/cdrom_id src/udev/v4l_id        \
         src/udev/mtd_probe src/udev/collect  src/udev/ata_id        \
@@ -140,7 +208,9 @@
       build/scsi_id              \
       build/v4l_id               \
       build/mtd_probe            \
-      build/collect
+      build/collect              \
+      build/keymap               \
+      build/keyboard-force-release.sh
 
 build:
 	@mkdir -p build
@@ -148,6 +218,25 @@
 cfg.h:
 	cp udev-lfs-$(VERSION)/cfg.h .
 
+gen-keymap-src:
+	@echo GEN src/udev/keymap/keys.txt
+	$(VB)awk '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' \
+	/usr/include/linux/input.h | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > src/udev/keymap/keys.txt $<
+	@echo GEN src/udev/keymap/keys-from-name.gperf
+	$(VB)awk 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' \
+	src/udev/keymap/keys.txt > src/udev/keymap/keys-from-name.gperf $<
+	@echo GEN src/udev/keymap/keys-from-name.h
+	$(VB)gperf -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C \
+	src/udev/keymap/keys-from-name.gperf > src/udev/keymap/keys-from-name.h $<
+	@echo GEN src/udev/keymap/keys-to-name.h
+	$(VB)awk 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' \
+	src/udev/keymap/keys.txt > src/udev/keymap/keys-to-name.h $<
+
+build/keyboard-force-release.sh: src/udev/keymap/keyboard-force-release.sh.in
+	@echo GEN $@
+	$(VB)sed -e 's|@udevlibexecdir@|/lib/udev|g' $< > $@
+	$(VB)chmod 0755 $@
+
 build/%o: %c
 	@echo CC $<
 	$(VB)gcc -c $(WARN) $(OPTIONS2) $(INCLUDE) $(DEF) -o $@ $<
@@ -225,8 +314,14 @@
 	$(VB)gcc build/collect.o -o $@ build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS)
 	$(VB)strip --strip-unneeded $@
 
+build/keymap: src/udev/keymap/keymap.c build/$(COMMON_LIB) gen-keymap-src
+	@echo LINK $@
+	$(VB)gcc $< -o $@ -I src/udev/keymap $(WARN) $(OPTIONS2) $(INCLUDE) $(DEF) build/$(COMMON_LIB) $(LDFLAGS)
+	$(VB)strip --strip-unneeded $@
+
 install: udev
 	@mkdir -pv $(DESTDIR)/lib/udev/devices/pts $(DESTDIR)/lib/udev/rules.d \
+              $(DESTDIR)/lib/udev/keymaps/force-release                   \
               $(DESTDIR){,/usr}/lib/firmware  $(DESTDIR)/sbin             \
               $(DESTDIR)/usr/lib/pkgconfig    $(DESTDIR)/etc/udev/rules.d \
               $(DESTDIR)/usr/share/doc/udev/lfs                           \
@@ -247,6 +342,14 @@
 	@ln -svfn $(DESTDIR)/usr/lib/$(LIBUDEV_REAL_NAME) $(LIBUDEV_SONAME)
 	@ln -svfn $(DESTDIR)/usr/lib/$(LIBUDEV_REAL_NAME) $(LIBUDEV_LINK_NAME)
 
+   # Copy udev keymaps data
+	@cp -v $(KEYMAPS) $(DESTDIR)/lib/udev/keymaps
+	@cp -v $(KEYMAPS_FR) $(DESTDIR)/lib/udev/keymaps/force-release
+
+	@cp -v build/keyboard-force-release.sh $(DESTDIR)/lib/udev
+	@cp -v src/udev/keymap/findkeyboards $(DESTDIR)/lib/udev
+	@cp -v src/udev/keymap/*.rules $(DESTDIR)/lib/udev/rules.d
+
    # Create null device and copy rules
 	@rm -f                                $(DESTDIR)/lib/udev/devices/null
 	@mknod -m0666                         $(DESTDIR)/lib/udev/devices/null c 1 3
@@ -264,6 +367,10 @@
 clean:
 	rm -rf build
 	rm -f  cfg.h
+	rm -f  src/udev/keymap/keys.txt
+	rm -f  src/udev/keymap/keys-from-name.gperf
+	rm -f  src/udev/keymap/keys-from-name.h
+	rm -f  src/udev/keymap/keys-to-name.h
 
 .PHONY: clean 
 
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to