title: How to download the Torvalds Linux Kernel master, (re)compile it, and boot it with QEMU?
body: <p>Since few days, I am working on a little project in order to discover the kernel programming. However, I read a lot on the internet and asked a question before about kernel compilation and I feel still lost at some point.</p>
  
  <p>If I need to do some kernel programming, I thought that use the Linus Torvalds's Linux sources would be the best point to start. So I did the following <em>(From MacOS High Sierra)</em>:</p>
  
  <ul>
  <li>Download kernel's sources: <a href="https://github.com/torvalds/linux" rel="nofollow noreferrer">https://github.com/torvalds/linux</a></li>
  <li>Unzipped it</li>
  <li>Launch a terminal and run:
  
  <ul>
  <li><code>vagrant init</code></li>
  <li><code>vagrant up</code></li>
  <li><code>vagrant ssh</code></li>
  </ul></li>
  <li>Once connected, I typed:
  
  <ul>
  <li><code>cd /vagrant/linux</code> <em>In order to get into the Linux sources unzipped folder</em></li>
  <li><code>make menuconfig</code> <em>I just pressed ok/save</em></li>
  <li><code>sudo make -j 4 &amp;&amp; sudo make modules_install -j 4 &amp;&amp; sudo make install -j 4</code></li>
  </ul></li>
  </ul>
  
  <p>Now, I just get a little error:</p>
  
  <pre><code>agrant @vagrant-ubuntu-trusty-64:/vagrant/Kernel-Programming/linx-kernel$ sudo make -j 4 &amp;&amp; sudo make modules_install -j 4 &amp;&amp; sudo make install -j 4
    CHK include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  SKIPPED include/generated/compile.h
  CC      my_syscalls/uptime.o
  AR      my_syscalls/built-in.o
  CC[M]  net/ipv4/netfilter/ipt_ECN.o
  In file included from net/ipv4/netfilter/ipt_ECN.c:20:0:
  net/ipv4/netfilter/ipt_ECN.c: In function 'set_ect_ip':
  ./include/uapi/linux/netfilter_ipv4/ipt_ECN.h:16:27: error: 'XT_DSCP_MASK' undeclared(first use in this function)
   #define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
                             ^
  net/ipv4/netfilter/ipt_ECN.c:33:18: note: in expansion of macro 'IPT_ECN_IP_MASK'
    if ((iph-&gt;tos &amp; IPT_ECN_IP_MASK) != (einfo-&gt;ip_ect &amp; IPT_ECN_IP_MASK)) {
                    ^
  ./include/uapi/linux/netfilter_ipv4/ipt_ECN.h:16:27: note: each undeclared identifier is reported only once for each function it appears in
   #define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
                             ^
  net/ipv4/netfilter/ipt_ECN.c:33:18: note: in expansion of macro 'IPT_ECN_IP_MASK'
    if ((iph-&gt;tos &amp; IPT_ECN_IP_MASK) != (einfo-&gt;ip_ect &amp; IPT_ECN_IP_MASK)) {
                    ^
  net/ipv4/netfilter/ipt_ECN.c: In function 'ecn_tg_check':
  ./include/uapi/linux/netfilter_ipv4/ipt_ECN.h:16:27: error: 'XT_DSCP_MASK' undeclared(first use in this function)
   #define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
                             ^
  net/ipv4/netfilter/ipt_ECN.c:105:23: note: in expansion of macro 'IPT_ECN_IP_MASK'
    if (einfo-&gt;ip_ect &amp; ~IPT_ECN_IP_MASK)
  {
                         ^
  make[3]: *** [net / ipv4 / netfilter / ipt_ECN.o] Error 1
  make[2]: *** [net / ipv4 / netfilter] Error 2
  make[1]: *** [net / ipv4] Error 2
  make: *** [net] Error 2
  make: ***Waiting for unfinished jobs....
  </code></pre>
  
  <p>However, I don't know if this error breaks everything at all or not. Also, even if the compilation is fully ok, how can I test my "new Linux compiled"? Because I added a syscall and I would like to test if it works or no ... I found something about <code>update-initramfs</code> but I don't see the link/point since my compiled kernel isn't an Ubuntu.</p>