Subversion Repositories livecd

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
36 beyerle@PS 1
# -------------------------------------------------------------------------------------------
2
#
3
# How to build for SMP and UP kernel
4
#
5
#  rpmbuild -ba --target i686   --define 'kernel 2.6.9-42.0.2.EL' squashfs.spec
6
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.9-42.0.2.EL' squashfs.spec
7
#
8
# or only for UP kernel
9
#
10
#  rpmbuild -ba --target i686   --define 'kernel 2.6.9-42.0.2.EL' --define 'buildsmp 0' squashfs.spec
11
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.9-42.0.2.EL' --define 'buildsmp 0' squashfs.spec
12
#
13
#
14
# for the running kernel:
15
#
16
#  rpmbuild -ba --target i686   squashfs.spec
17
#  rpmbuild -ba --target x86_64 squashfs.spec
18
#
19
# -------------------------------------------------------------------------------------------
20
 
21
%{!?buildsmp:%define buildsmp 1}
22
 
23
%{?!kernel:%define kernel %(rpm -q kernel-devel | tail -1 | sed -e 's|kernel-devel-||')}
24
 
25
%define kversion %(echo "%{kernel}" | sed -e 's|-.*||')
26
%define krelease %(echo "%{kernel}" | sed -e 's|.*-||')
27
 
28
%define kernel_src_path %{_usrsrc}/kernels/%{kernel}-%{_target_cpu}
29
%define kernel_smp_src_path %{_usrsrc}/kernels/%{kernel}-smp-%{_target_cpu}
30
 
31
%define kernel_moduledir /lib/modules/%{kernel}
32
%define kernel_smp_moduledir /lib/modules/%{kernel}smp
33
 
34
%define pkg_name squashfs
35
%define kmdl_name kernel-module-%{pkg_name}-%{kernel}
36
 
37
# -------------------------------------------------------------------------------------------
38
 
39
%define kernel_patch_version 	2.6.10
40
# this is for 3.1-r2
41
%define squashfs_release	2           
42
%define squashfs_version    	3.1
43
 
44
Summary: 	A Read-Only File System with Efficient Compression
45
Name: 		%{pkg_name}
46
Version: 	%{squashfs_version}.%{squashfs_release}
47
Release: 	1.sl4.psi
48
Epoch: 		0
49
Packager: 	Urs Beyerle <urs.beyerle@psi.ch>
50
License: 	GPL
51
Group: 		System Environment/Kernel
52
Source0: 	%{name}%{squashfs_version}-r%{squashfs_release}.tar.gz
53
URL: 		http://squashfs.sourceforge.net/
54
BuildRoot: 	%{_tmppath}/%{name}-%{version}-%{release}-buildroot
55
# Requires:       kernel-module-%{pkg_name} >= %{version}-%{release}
56
BuildRequires: 	kernel-devel = %{kernel}, 
57
%if %{buildsmp}
58
BuildRequires: 	kernel-smp-devel = %{kernel}
59
%endif
60
 
61
%description
62
Squashfs is a compressed read-only filesystem for Linux. 
63
Squashfs is intended for general read-only filesystem use.
64
This package contains the userland utilities to create and read
65
squashfs images.
66
 
67
Kernel modules for squashfs are in kernel-module-%{pkg_name} rpms.
68
 
69
 
70
%package -n %{kmdl_name}
71
Summary: 	kernel modules for %{name}.
72
Group: 		System Environment/Kernel
73
License: 	GPL
74
Provides:	kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
75
# Requires:	%{pkg_name}
76
 
77
%description -n %{kmdl_name}
78
Kernel modules for %{name}.
79
 
80
%if %{buildsmp}
81
 
82
%package -n %{kmdl_name}smp
83
Summary: 	smp kernel modules for %{name}.
84
Group: 		System Environment/Kernel
85
License: 	GPL
86
Provides:	kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
87
# Requires:	%{pkg_name}
88
 
89
%description -n %{kmdl_name}smp
90
SMP kernel modules for %{name}.
91
 
92
%endif
93
 
94
%prep
95
%setup -n %{name}%{squashfs_version}-r%{squashfs_release}
96
# %patch
97
 
98
# turn patch into plain sources :-/
99
patch -f -p2 < linux-%{kernel_patch_version}/squashfs3.1-patch || true
100
mv linux squashfs/.
101
echo '#define CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE 3' >> squashfs/squashfs.h
102
 
103
%build
104
 
105
echo -e "\nDriver version: %{version}\nKernel version: %{kernel}\n"
106
 
107
### build the squashfs-tools
108
make -C squashfs-tools \
109
	CFLAGS="-I. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS"
110
 
111
### prepare source
112
rm -rf obj
113
mkdir obj
114
cp -r squashfs obj
115
cd obj/squashfs
116
# point to right header files
117
sed -i 's|#include <linux/squashfs_fs.h>|#include "linux/squashfs_fs.h"|' *.c
118
sed -i 's|#include <linux/squashfs_fs_sb.h>|#include "linux/squashfs_fs_sb.h"|' *.c
119
sed -i 's|#include <linux/squashfs_fs_i.h>|#include "linux/squashfs_fs_i.h"|' *.c
120
sed -i 's|#include <linux/squashfs_fs.h>|#include "squashfs_fs.h"|' linux/*.h
121
sed -i 's|#include <linux/squashfs_fs_sb.h>|#include "squashfs_fs_sb.h"|' linux/*.h
122
sed -i 's|#include <linux/squashfs_fs_i.h>|#include "squashfs_fs_i.h"|' linux/*.h
123
 
124
export CONFIG_SQUASHFS=m
125
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
126
export INSTALL_MOD_DIR=kernel/fs
127
 
128
### UP kernel module
129
make -C %{kernel_src_path} M=$PWD clean
130
rm -f *.o *.ko
131
make -C %{kernel_src_path} M=$PWD modules
132
mkdir -p $RPM_BUILD_ROOT/%{kernel_moduledir}/kernel/fs/squashfs
133
cp -a squashfs.ko $RPM_BUILD_ROOT/%{kernel_moduledir}/kernel/fs/squashfs/
134
 
135
### SMP kernel module
136
%if %{buildsmp}
137
make -C %{kernel_smp_src_path} M=$PWD clean
138
rm -f *.o *.ko
139
make -C %{kernel_smp_src_path} M=$PWD modules
140
mkdir -p $RPM_BUILD_ROOT/%{kernel_smp_moduledir}/kernel/fs/squashfs
141
cp -a squashfs.ko $RPM_BUILD_ROOT/%{kernel_smp_moduledir}/kernel/fs/squashfs/
142
%endif
143
 
144
 
145
%install
146
mkdir -p $RPM_BUILD_ROOT/usr/bin
147
cp -p squashfs-tools/*squashfs $RPM_BUILD_ROOT/usr/bin
148
 
149
%clean
150
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
151
 
152
%postun -n %{kmdl_name}
153
depmod -a %{kernel} >/dev/null 2>&1 || :	
154
 
155
%post -n %{kmdl_name}
156
depmod -a %{kernel} >/dev/null 2>&1 || :
157
 
158
%if %{buildsmp}
159
%postun -n %{kmdl_name}smp
160
depmod -a %{kernel}smp >/dev/null 2>&1 || :
161
 
162
%post -n %{kmdl_name}smp
163
depmod -a %{kernel}smp >/dev/null 2>&1 || :
164
%endif
165
 
166
%files 
167
%defattr(-,root,root,-)
168
%doc README README-3.1 PERFORMANCE.README COPYING CHANGES ACKNOWLEDGEMENTS INSTALL
169
/usr/bin/mksquashfs
170
/usr/bin/unsquashfs
171
 
172
%files -n %{kmdl_name}
173
%defattr(-,root,root,-)
174
%{kernel_moduledir}/kernel/fs/squashfs
175
 
176
%if %{buildsmp}
177
%files -n %{kmdl_name}smp
178
%defattr(-,root,root,-)
179
%{kernel_smp_moduledir}/kernel/fs/squashfs
180
%endif
181
 
182
%changelog
183
* Sun Oct 15 2006 Urs Beyerle <urs.beyerle@psi.ch>  3.1.r2-1.sl4.psi
184
- #include <linux/squash...> -> #include "squash..."
185
- #define CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE 3 (the default)
186
- no patching of do_mounts, so no initrd support
187
- build for RHEL kernel 2.6.9