view main.yml @ 8:b0ed6906392e

fix comments
author kono
date Sun, 17 Dec 2017 22:29:08 +0900
parents 93892172f7fb
children 42be4c53efc5
line wrap: on
line source

#  build Feora Linux kernel from sourcr
#      kono@ie.u-ryukyu.ac.jp
#
# old.config generates non address randomize kernel for gdb
#
# prepare at least 30GB of file space
#    ( Fedora default is 15GB, no matter how HDD big size )
#
#   rsync -av -e 'ssh -p 2222' ~/.ssh/id_rsa.pub xxx@localhost:.ssh/authorized_keys
#   screen -L  ansible-playbook -i hosts main.yml --ask-become-pass
#   ssh localhost -p 2222  -l root 'cd /usr/src/kernels ; tar czf - fedora' | dd of=fedora26-kernel.tgz

- hosts: all
  remote_user: xxxxx
  become: yes
  become_method: sudo
  tasks:

  - name: install kernel dev packages
    dnf: name={{ item }} state=present
    with_items: 
    - fedpkg
    - fedora-packager
    - rpmdevtools
    - ncurses-devel
    - pesign
    - libselinux-python

  - name: fedpkg clone
    command: fedpkg clone -a kernel
    args:
      chdir: /usr/src/
      creates: /usr/src/kernel

#     we need not to this as root
#
#     this should be   cd /usr/src/kernel ; git checkout     
  - name: git clone kernel
    git: >
      repo=git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git
      dest=/usr/src/kernels/fedora

#   this does not work and unnecessary
#  - name: authorize user script
#    shell: /usr/libexec/pesign/pesign-authorize-users

#
#  this does not work, we have to chdir to /usr/src/kernel
#  - name: install kernel dev packages
#    dnf: name={{ item }} state=present
#    with_items:
#    - builddep
#    - kernel.spec
#
#    args:
#      chdir: /usr/src/kernels/fedora
#   use shell command instead
#
  - name: dnf builddep kernel.spec 
    command:  dnf -y builddep kernel.spec 
    args:
      chdir: /usr/src/kernel
      creates: /bin/gcc

  # olddefconfig requires old config file
  - name: copy old  .config
    copy:  
      src: old.config
      dest: /usr/src/kernels/fedora/.config

  - name: make olddefconfig
    shell: "{{ item }}"
    with_items:
    - make olddefconfig 
    args:
      chdir: /usr/src/kernels/fedora

  - name: make kernel
    shell: "{{ item }}"
    with_items:
    - make -j8
    args:
      chdir: /usr/src/kernels/fedora

  - name: make bzImage 
    shell: "{{ item }}"
    with_items:
    - make bzImage
    args:
      chdir: /usr/src/kernels/fedora

  - name: make modules
    shell: "{{ item }}"
    with_items:
    - make -j8 modules
    - make -j8 modules_install
    args:
      chdir: /usr/src/kernels/fedora

  - name: install kernel
    shell: "{{ item }}"
    with_items:
    - make install
    args:
      chdir: /usr/src/kernels/fedora