Advertisement
cetex

packer-ec2-build-kernel.json

Mar 10th, 2023
794
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 2.48 KB | None | 0 0
  1. {
  2.   "builders": [
  3.     {
  4.       "name": "kernel-ami",
  5.       "region": "eu-west-1",
  6.       "type": "amazon-ebs",
  7.       "ami_name": "kernel-ami/images/hvm-ebs/kernel-ami--{{isotime \"20060102T150405\"}}",
  8.       "sriov_support" : true,
  9.       "instance_type": "c5.9xlarge",
  10.       "temporary_key_pair_type": "ed25519",
  11.       "skip_create_ami": true,
  12.       "subnet_filter": {
  13.         "most_free": true,
  14.         "random": true
  15.       },
  16.       "source_ami_filter": {
  17.         "filters": {
  18.           "architecture": "x86_64",
  19.           "name": "*ubuntu-*-22.04-amd64-server-*",
  20.           "root-device-type": "ebs",
  21.           "virtualization-type": "hvm",
  22.           "state": "available"
  23.         },
  24.         "owners": [ "099720109477" ],
  25.         "most_recent": true
  26.       },
  27.       "launch_block_device_mappings": [
  28.         {
  29.           "device_name": "/dev/sda1",
  30.           "volume_size": "100",
  31.           "volume_type": "gp2",
  32.           "delete_on_termination": true
  33.         }
  34.       ],
  35.       "shutdown_behavior": "terminate",
  36.       "ssh_username": "ubuntu",
  37.       "ssh_timeout": "5m"
  38.     }
  39.   ],
  40.  
  41.   "provisioners": [
  42.     {
  43.       "type": "shell",
  44.       "inline": [
  45.         "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done"
  46.       ]
  47.     },
  48.     {
  49.       "type": "shell",
  50.       "inline": [
  51.         "sudo sed -i '/deb-src/s/^# //' /etc/apt/sources.list",
  52.         "sudo apt-get update",
  53.         "sudo apt-get -y dist-upgrade",
  54.         "sudo apt-get -y build-dep linux",
  55.         "sudo apt-get -y install wget",
  56.         "wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.2.2.tar.xz",
  57.         "tar -xf linux-6.2.2.tar.xz"
  58.       ]
  59.     },
  60.     {
  61.       "type": "file",
  62.       "source": "disable-dbg-deb.patch",
  63.       "destination": "disable-dbg-deb.patch"
  64.     },
  65.     {
  66.       "type": "file",
  67.       "source": "linux-6.2.2/.config",
  68.       "destination": "linux-6.2.2/.config"
  69.     },
  70.     {
  71.       "type": "file",
  72.       "source": "kernel-signing.key",
  73.       "destination": "linux-6.2.2/certs/signing_key.pem"
  74.     },
  75.     {
  76.       "type": "shell",
  77.       "inline": [
  78.         "patch -p1 < disable-dbg-deb.patch",
  79.         "cd linux-6.2.2",
  80.         "ls -la .",
  81.         "make clean",
  82.         "make -j 128 deb-pkg",
  83.         "ls -la ../",
  84.         "mkdir ../deb/",
  85.         "mv ../*.deb ../deb/"
  86.       ]
  87.     },
  88.     {
  89.       "type": "file",
  90.       "source": "./deb/",
  91.       "destination": "./",
  92.       "direction": "download"
  93.     }
  94.   ]
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement