= 準備 =
apt-get update
sudo apt-get build-dep linux-image-$(uname -r)
mkdir build
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git
git checkout -b Ubuntu-4.15.0-36.39
chmod a+x debian/rules
chmod a+x debian/scripts/*
chmod a+x debian/scripts/misc/*
fakeroot debian/rules clean
vi debian.master/changelog
= Build & Error あとはこれが通るまで繰り返す。
fakeroot debian/rules binary-headers binary-generic binary-perarch
fakeroot debian/rules binary
make[2]: Entering directory `/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/build/tools-perarch/tools/usb/usbip/libsrc'
CC libusbip_la-names.lo
In file included from names.c:41:0:
usbip_common.h:19:25: fatal error: linux/usbip.h: No such file or directory
#include <linux/usbip.h>
^
compilation terminated.
make[2]: *** [libusbip_la-names.lo] Error 1
make[2]: Leaving directory `/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/build/tools-perarch/tools/usb/usbip/libsrc'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/build/tools-perarch/tools/usb/usbip'
make: *** [/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/stamps/stamp-build-perarch] Error 2
include pathが足らないのか。
linux/usbip.h
は、build treeのinclue pathにあるので、それを足す
samu.matsumoto@gcp-performance-test2:~/rebuild-kernel/ubuntu-bionic$ git diff
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index aaf3d43..f8d2c9d 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -623,7 +623,7 @@ ifeq ($(do_tools_usbip),true)
cd $(builddirpa)/tools/usb/usbip && ./autogen.sh
chmod 755 $(builddirpa)/tools/usb/usbip/configure
cd $(builddirpa)/tools/usb/usbip && ./configure --prefix=$(builddirpa)/tools/usb/usbip/bin
- cd $(builddirpa)/tools/usb/usbip && make install CFLAGS="-g -O2 -static" CROSS_COMPILE=$(CROSS_COMPILE)
+ cd $(builddirpa)/tools/usb/usbip && make install CFLAGS="-g -O2 -static -I$(headers_dir)/usr/include" CROSS_COMPILE=$(CROSS_COMPILE)
endif
ifeq ($(do_tools_acpidbg),true)
cd $(builddirpa)/tools/power/acpi && make clean && make CFLAGS="-g -O2 -static -I$(builddirpa)/include" CROSS_COMPILE=$(CROSS_COMPILE) acpidbg
diff --git a/debian/scripts/sub-flavour b/debian/scripts/sub-flavour
old mode 100644
new mode 100755
解決
UPD include/config/kernel.release
Using /home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic as source for kernel
/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic is not clean, please run 'make mrproper'
in the '/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic' directory.
make[3]: *** [prepare3] Error 1
make[2]: *** [__build_one_by_one] Error 2
make[2]: Leaving directory `/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/build/build-generic'
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic'
make: *** [/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/stamps/stamp-prepare-tree-generic] Error 2
エラーにしたがって、make mproperすると、 ./debianが消される。。。
いっかい上からやり直す。
chmod a+x debian/rules
chmod a+x debian/scripts/*
chmod a+x debian/scripts/misc/*
fakeroot debian/rules clean
次のエラー
Using /home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic as source for kernel
Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make[3]: *** [prepare-compiler-check] Error 1
make[2]: *** [__build_one_by_one] Error 2
make[2]: Leaving directory `/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/build/build-generic'
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic'
make: *** [/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/stamps/stamp-prepare-tree-generic] Error 2
configで、現世代でサポートされてないオプションが入ってるらしい。
osamu.matsumoto@gcp-performance-test2:~/rebuild-kernel/ubuntu-bionic$ git diff
diff --git a/debian.master/config/config.common.ubuntu b/debian.master/config/config.common.ubuntu
index 2a0a4c1..de817b2 100644
--- a/debian.master/config/config.common.ubuntu
+++ b/debian.master/config/config.common.ubuntu
@@ -1262,7 +1262,7 @@ CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
# CONFIG_CC_STACKPROTECTOR_NONE is not set
# CONFIG_CC_STACKPROTECTOR_REGULAR is not set
-CONFIG_CC_STACKPROTECTOR_STRONG=y
+CONFIG_CC_STACKPROTECTOR_STRONG=n
CONFIG_CDROM=y
CONFIG_CDROM_PKTCDVD_BUFFERS=8
# CONFIG_CDROM_PKTCDVD_WCACHE is not set
diff --git a/debian/scripts/sub-flavour b/debian/scripts/sub-flavour
old mode 100644
new mode 100755
sed -e 's/.*\/\([^\/]*\)\.ko/\1/' | sort > /home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian.master/abi/4.15.0-34.37/amd64/generic.modules
II: Checking modules for generic...
reading new modules...read 5151 modules.
reading old modules...
MISS: icp
MISS: spl
MISS: splat
MISS: zavl
MISS: zcommon
MISS: zfs
MISS: znvpair
MISS: zpios
MISS: zunicode
read 5160 modules : new(0) missing(9)
EE: Missing modules (start begging for mercy)
make: *** [module-check-generic] Error 1
./debian/scripts/module-check
このスクリプトが、 debian/rules.d/4-checks.mk
ここから
過去のmodule lisと比べて抜けがないかcheckしてるが、しなくていいよということで、、、
skipmoduleという変数がある。その辺いっかつしてやるやつが、 do_mainline_build=true
これっぽい (from debian/rules)
# Being used to build a mainline build -- turn off things which do not work.
ifeq ($(do_mainline_build),true)
do_extras_package=false
do_tools=false
no_dumpfile=1
do_zfs=false
skipabi=true
skipmodule=true
skipretpoline=true
endif
んで `` fakeroot debian/rules do_mainline_build=true binary-headers binary-generic binary-perarc
通る
ln -sf /home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/linux-modules-4.15.0-34-generic/lib/modules/4.15.0-34-generic/kernel/drivers/video/vesafb.ko \
/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/linux-modules-4.15.0-34-generic/lib/modules/4.15.0-34-generic/initrd/; \
fi
echo "interest linux-update-4.15.0-34-generic" >"debian/linux-image-unsigned-4.15.0-34-generic.triggers"
install -d /home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/linux-modules-4.15.0-34-generic/usr/share/doc/linux-image-unsigned-4.15.0-34-generic
cat debian.master/changelog debian.master/changelog.historical |
gzip -9 >/home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/linux-modules-4.15.0-34-generic/usr/share/doc/linux-image-unsigned-4.15.0-34-generic/changelog.Debian.old.gz
cat: debian.master/changelog.historical: No such file or directory
chmod 644 /home/osamu.matsumoto/rebuild-kernel/ubuntu-bionic/debian/linux-modules-4.15.0-34-generic/usr/share/doc/linux-image-unsigned-4.15.0-34-generic/changelog.Debian.old.gz
for sub in ; do
if ! (TO=$sub FROM=generic ABI_RELEASE=4.15.0-34 /bin/bash -e
debian/scripts/sub-flavour); then exit 1; fi;
/sbin/depmod -b debian/linux-image-unsigned-4.15.0-34-$sub
-ea -F debian/linux-image-unsigned-4.15.0-34-$sub/boot/System.map-4.15.0-34-generic
4.15.0-34-generic;
;
done
/bin/bash: -c: line 6: syntax error near unexpected token `;'
make: *** [install-generic] Error 2
シェルスクリプトまちがっとる? `For sub in `が間違ってそう、そこの変数が展開されてない。
よくわからんけども、スキップ!
debian/rules.d/2-binary-arch.mk
``
fakeroot debian/rules skipsub=true do_mainline_build=true binary-headers binary-generic binary-perarch
``
debできたので、インストール。
あがってこない。kernel panic。。vfsマウントのところで。sdaが見えてない。
gcpのvirt環境で動くためのdisk device driverが足らんのかな。
gcp config意識しなすぎたので、やり直し
https://launchpad.net/ubuntu/+source/linux-gcp
= 参考
* https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
* https://wiki.ubuntu.com/Kernel/Dev/KernelGitGuide