Kernelnotes/mike

Материал из ALT Linux Wiki

kernel-image.git

Наброски mike@ по части сборки kernel-image из git-репозитория (точнее, gear-).

Локально в /pub/git/linux-2.6.27.y автоматически синхронизируется master с git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.27.y.git и рядом поддерживаются бранчи с приложенными базовыми патчами.

t-hard:~/git> mkdir kernel-image
t-hard:~/git> cd kernel-image
t-hard:~/git/kernel-image> git init
Initialized empty Git repository in /home/mike/git/kernel-image/.git/
t-hard:~/git/kernel-image> git fetch /pub/git/linux-2.6.27.y master:kernel-source
[...]
t-hard:~/git/kernel-image> git fetch /pub/git/linux-2.6.27.y fix-core-syslog:fix-core-syslog
[...]
t-hard:~/git/kernel-image> git fetch /pub/git/linux-2.6.27.y fix-core--init:fix-core--init
[...]
# NB: в 2.6.27.26 исправление getline уже включено
t-hard:~/git/kernel-image> git fetch /pub/git/linux-2.6.27.y fix-core-getline:fix-core-getline
t-hard:~/git/kernel-image> git branch 
  fix-core--init
  fix-core-getline
  fix-core-syslog
  kernel-source
t-hard:~/git/kernel-image> mkdir .gear
t-hard:~/git/kernel-image> cp -a ~/git/_kernel-image/.gear/rules .gear/rules
t-hard:~/git/kernel-image> cat .gear/rules
copy: config-*
diff: v2.6.27:. v2.6.27.25:. name=linux-2.6.27.25.patch
diff: v2.6.27.25:. fix-vm_deadlock:. name=fix-vm_deadlock.patch
diff: v2.6.27.25:. fix-core-getline:. name=fix-core-getline.patch
t-hard:~/git/kernel-image> cp -a ~/git/_kernel-image/kernel-image.spec .    
t-hard:~/git/kernel-image> cp -a ~/git/_kernel-image/config-i586 .      
t-hard:~/git/kernel-image> git add kernel-image.spec config-i586 .gear/
t-hard:~/git/kernel-image> git commit -m 'initial gear rules' .gear/rules                     
t-hard:~/git/kernel-image> git commit -m 'initial kernel config' config-i586                  
t-hard:~/git/kernel-image> git commit -m 'initial specfile' kernel-image.spec                 
t-hard:~/git/kernel-image> git fetch ~/git/_kernel-image fix-vm_deadlock:fix-vm_deadlock
t-hard:~/git/kernel-image> for i in fix-vm_deadlock fix-core-syslog fix-core--init fix-core-getline; do git merge -s ours $i; done                                                                                                  
Merge made by ours.
Merge made by ours.
Merge made by ours.
Merge made by ours.
t-hard:~/git/kernel-image> git status
# On branch master
nothing to commit (working directory clean)
t-hard:~/git/kernel-image> gear-update-tag -avc
gear-update-tag: Added tag "v2.6.27"
gear-update-tag:   for 4b5127df968616dee2f4775d795198878ef1638b
gear-update-tag: Added tag "v2.6.27.25"
gear-update-tag:   for 53ddfb015122de4e0bbb9aae8b41cec07d3dd631
gear-update-tag: Added tag "fix-vm_deadlock"
gear-update-tag:   for 575def1e5ba41a910a8271c6b285f8c10b33dc6c
gear-update-tag: Added tag "fix-core-getline"
gear-update-tag:   for d0add4b4d130c07690d22422de0790623116b8cf
gear-update-tag: Added .gear/tags/4b5127df968616dee2f4775d795198878ef1638b
gear-update-tag: Added .gear/tags/53ddfb015122de4e0bbb9aae8b41cec07d3dd631
gear-update-tag: Updated .gear/tags/list
t-hard:~/git/kernel-image> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   .gear/tags/26163318ff75a2dc3c3cdfdb1656a6bac7bfd59d
#       new file:   .gear/tags/4b5127df968616dee2f4775d795198878ef1638b
#       new file:   .gear/tags/list
#
t-hard:~/git/kernel-image> git commit -am 'gear-update-tag'                  
[master 50c518d] gear-update-tag                              
 3 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 .gear/tags/26163318ff75a2dc3c3cdfdb1656a6bac7bfd59d
 create mode 100644 .gear/tags/4b5127df968616dee2f4775d795198878ef1638b
 create mode 100644 .gear/tags/list
t-hard:~/git/kernel-image> nice time gear --hasher -- hsh --target=i586 --apt-conf=/etc/apt/apt.conf-i586 ~/hasher/tmpfs
Wrote: /usr/src/RPM/SRPMS/kernel-image-tc-2.6.27-alt1.src.rpm
Wrote: /usr/src/RPM/RPMS/i586/kernel-image-tc-2.6.27-alt1.i586.rpm
Wrote: /usr/src/RPM/RPMS/i586/kernel-modules-alsa-tmc-tc-2.6.27-alt1.i586.rpm
Wrote: /usr/src/RPM/RPMS/i586/kernel-modules-drm-tmc-tc-2.6.27-alt1.i586.rpm
Wrote: /usr/src/RPM/RPMS/i586/kernel-modules-v4l-tmc-tc-2.6.27-alt1.i586.rpm
Wrote: /usr/src/RPM/RPMS/i586/kernel-headers-tmc-tc-2.6.27-alt1.i586.rpm
Wrote: /usr/src/RPM/RPMS/i586/kernel-headers-modules-tmc-tc-2.6.27-alt1.i586.rpm
1176.36user 213.42system 8:53.89elapsed 260%CPU (0avgtext+0avgdata 0maxresident)k
11544inputs+0outputs (16major+36433044minor)pagefaults 0swaps

При обновлении делаем rebase всех topic branch'ей на kernel-source и затем merge -s ours в основной бранч (в данном разе fix-core-getline стал уже неактуален -- merged upstream):

ver=2.6.27.42
git fetch /pub/git/linux-2.6.27.y master:kernel-source
for i in fix-core-syslog fix-core--init feat-fs-squashfs fix-vm_deadlock; do git rebase kernel-source $i; done; git checkout kernel-image-tmc-tc
for i in kernel-source fix-core-syslog fix-core--init feat-fs-squashfs fix-vm_deadlock; do git merge -s ours $i; done
subst "s,2.6.27.[0-9]\+,$ver,g" .gear/rules
git commit -am "$ver"
gear-update-tag -avc && git commit -am 'gear-update-tag'
vim config-i586
git commit -am '...config changes...'
vim kernel-image.spec
gear-commit -a

PS: разглядывая updatemodules, дошло, что бранч master стоило называть kernel-image-tmc-tc. Поправил.

Соответственно модули:

buildmodules --target=i586 --hsh-options='--apt-conf=/etc/apt/apt.conf-i586' --hsh-workdir=$TMP/tmpfs -k tmc-tc