Difference between revisions of "Build TomElliott Kernel"

From FOG Project
Jump to: navigation, search
(drivers/scsi/storvsc_drv.c)
(Additional Patches)
 
(8 intermediate revisions by 2 users not shown)
Line 37: Line 37:
 
The below instructions are to build the TomElliott kernel.  There is an extra step involved compared to the normal kernel build as there are firmware's built directly into the kernels now.
 
The below instructions are to build the TomElliott kernel.  There is an extra step involved compared to the normal kernel build as there are firmware's built directly into the kernels now.
 
== Download the Kernel ==
 
== Download the Kernel ==
As of the time of this writing kernel 3.13 is the latest.  You can use previous, or future kernels as well though.
+
As of the time of this writing kernel 4.17 is the latest.  You can use previous, or future kernels as well though.
<pre>wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.tar.xz</pre>
+
<pre>wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.17.tar.xz</pre>
  
 
== Uncompress the kernel ==
 
== Uncompress the kernel ==
<pre>tar -xf linux-3.13.tar.xz</pre>
+
<pre>tar -xf linux-4.17.tar.xz</pre>
  
 
== Go into uncompressed linux kernel directory ==
 
== Go into uncompressed linux kernel directory ==
<pre>cd linux-3.13</pre>
+
<pre>cd linux-4.17</pre>
  
 
== Get the config file ==
 
== Get the config file ==
 
===To Build 32 bit Kernel===
 
===To Build 32 bit Kernel===
<pre>wget https://svn.code.sf.net/p/freeghost/code/trunk/kernel/TomElliott.config.32 -O .config</pre>
+
<pre>wget -O .config https://github.com/FOGProject/fos/raw/master/configs/kernelx86.config</pre>
 
===To Build 64 bit Kernel===
 
===To Build 64 bit Kernel===
<pre>wget https://svn.code.sf.net/p/freeghost/code/trunk/kernel/TomElliott.config.64 -O .config</pre>
+
<pre>wget -O .config https://github.com/FOGProject/fos/raw/master/configs/kernelx64.config</pre>
 
== Download the prerequisite package '''(THE EXTRA STEP IS HERE)''' ==
 
== Download the prerequisite package '''(THE EXTRA STEP IS HERE)''' ==
 
<pre>git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git</pre>
 
<pre>git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git</pre>
Line 56: Line 56:
 
== Prepare the build ==
 
== Prepare the build ==
 
===To Build 32 bit Kernel===
 
===To Build 32 bit Kernel===
<pre>make ARCH=i386 menuconfig</pre>
+
<pre>make ARCH=i386 oldconfig</pre>
 
===To Build 64 bit Kernel===
 
===To Build 64 bit Kernel===
 
'''NOTE: MUST BE ON A 64 BIT OS'''
 
'''NOTE: MUST BE ON A 64 BIT OS'''
<pre>make menuconfig</pre>
+
<pre>make oldconfig</pre>
Add any choices, or don't but when you exit, it will ask you to save the config, '''NEEDED'''.
 
  
NOTE: If it doesn't ask you to save the configuration, the easiest method to ensure all will work fine is to deselect an small item and reselect it.
+
In case you want to make changes to the config run:
 +
<pre>make ARCH=i386 menuconfig</pre>
 +
or
 +
<pre>make oldconfig</pre>
  
After you've saved the config.
+
Make sure to save when exiting the menuconfig.
  
 
== Build the bzImage ==
 
== Build the bzImage ==
Line 76: Line 78:
 
== Copy the built kernel to your FOG Server's kernel directory. ==
 
== Copy the built kernel to your FOG Server's kernel directory. ==
 
NOTE: In my example, the FOG Server is the same as my build system.
 
NOTE: In my example, the FOG Server is the same as my build system.
NOTE: Recommend to make a backup of the original /var/www/{html/fog,fog}/service/ipxe/bzImage before continuing just in case.
+
NOTE: Recommend to make a backup of the original /var/www/html/fog/service/ipxe/bzImage before continuing just in case.
 
<pre>cp arch/x86/boot/bzImage /var/www/html/fog/service/ipxe/bzImage</pre>
 
<pre>cp arch/x86/boot/bzImage /var/www/html/fog/service/ipxe/bzImage</pre>
 +
or
 +
<pre>cp arch/x86/boot/bzImage /var/www/html/fog/service/ipxe/bzImage32</pre>
  
 
= Additional Patches =
 
= Additional Patches =
 
Edit the files within the linux decompressed folder:
 
Edit the files within the linux decompressed folder:
 
== drivers/net/usb/r8152.c ==
 
== drivers/net/usb/r8152.c ==
Relevant to the r8152 network cards.
+
https://forums.fogproject.org/topic/12465/microsoft-surface-go-usb-c-to-ethernet-adapter-compatibility
Search VENDOR_ID_REALTEK
+
Search for <pre>REALTEK_USB_DEVICE(VENDOR_ID_REALTEK</pre> and add this line:
 
 
If you don't see VENDOR_ID_MICROSOFT add the line:  It should look like:
 
 
 
<pre>#define VENDOR_ID_MICROSOFT    0x045e</pre>
 
 
 
Search REALTEK_USB_DEVICE(VENDOR_ID_REALTEK
 
 
 
If you don't see VENDOR_ID_MICOSOFT add the lines:
 
 
<pre>
 
<pre>
     {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab)}
+
     {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927)}
    {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6)}
 
 
</pre>
 
</pre>
  
== drivers/mmc/card/block.c ==
+
== drivers/scsi/storvsc_drv.c ==
Relevant to MMC block devices to remove the RPMB drive from view
+
This is an important patch to help prevent from major performance issues in HyperV: https://forums.fogproject.org/topic/6695/performance-decrease-using-hyper-v-win10-clients
Search card->part[idx]
 
 
 
Right before the line add:
 
<pre>
 
    if (!card->part[idx].size || (card->part[idx].area_type & MMC_BLK_DATA_AREA_RPMB)) continue;
 
</pre>
 
  
== drivers/net/ethernet/intel/e1000e/netdev.c ==
+
Search for <pre>blk_queue_virt_boundary</pre>
Search er32(TIMINCA)
 
 
 
In the for loop find: rem = do_div(temp, incvalue);  Remove it and add in it's place:
 
<pre>
 
    rem = incvalue != 0 ? do_div(temp,incvalue) : 0;
 
</pre>
 
== drivers/scsi/storvsc_drv.c ==
 
Search blk_queue_virt_boundary.
 
  
 
Delete the line and add:
 
Delete the line and add:
 
<pre>
 
<pre>
     if (PAGE_SIZE - 1 < 0) blk_queue_virt_boundary(sdevice->request_queue, 0);
+
     if (PAGE_SIZE - 1 < 4096) {
     else blk_queue_virt_boundary(sdevice->request_queue, PAGE_SIZE - 1);
+
        blk_queue_virt_boundary(sdevice->request_queue, 4096);
</pre>
+
     } else {
 
+
        blk_queue_virt_boundary(sdevice->request_queue, PAGE_SIZE - 1);
== drivers/net/ethernet/intel/igb/e1000_82575.c
+
     }
Search E1000_STATUS_FUNC_SHIFT;
 
 
 
Directly after the line add:
 
<pre>
 
     igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, 0);
 
 
</pre>
 
</pre>

Latest revision as of 07:19, 16 December 2018

PRE BUILD ENVIRONMENT IS ASSUMED ALREADY INSTALLED ON THE SYSTEM YOU'RE BUILDING NOTE: It is assumed you have root access to the system you're building this on. It also assumes you know your CWD (Current Working Directory).

Build TomElliott Kernel for FOG 0.32 and earlier

The below instructions are to build the TomElliott kernel. There is an extra step involved compared to the normal kernel build as there are firmware's built directly into the kernels now.

Download the Kernel

As of the time of this writing kernel 3.13 is the latest. You can use previous, or future kernels as well though.

wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.tar.xz

Uncompress the kernel

tar -xf linux-3.13.tar.xz

Go into uncompressed linux kernel directory

cd linux-3.13

Get the config file

wget https://svn.code.sf.net/p/freeghost/code/trunk/kernel/TomElliott.config.32 -O .config

Download the prerequisite package (THE EXTRA STEP IS HERE)

git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

Prepare the build

make ARCH=i386 menuconfig

Add any choices, or don't but when you exit, it will ask you to save the config, NEEDED.

After you've saved the config.

Build the bzImage

make ARCH=i386 bzImage

This will take a while. Once successful, it will say bzImage created.

Copy the built kernel to your FOG Server's kernel directory.

NOTE: In my example, the FOG Server is the same as my build system. NOTE: Recommend to make a backup of the original /tftpboot/fog/kernel/bzImage before continuing just in case.

cp arch/x86/boot/bzImage /tftpboot/fog/kernel/bzImage

Build TomElliott Kernel for FOG 0.33b and newer

The below instructions are to build the TomElliott kernel. There is an extra step involved compared to the normal kernel build as there are firmware's built directly into the kernels now.

Download the Kernel

As of the time of this writing kernel 4.17 is the latest. You can use previous, or future kernels as well though.

wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.17.tar.xz

Uncompress the kernel

tar -xf linux-4.17.tar.xz

Go into uncompressed linux kernel directory

cd linux-4.17

Get the config file

To Build 32 bit Kernel

wget -O .config https://github.com/FOGProject/fos/raw/master/configs/kernelx86.config

To Build 64 bit Kernel

wget -O .config https://github.com/FOGProject/fos/raw/master/configs/kernelx64.config

Download the prerequisite package (THE EXTRA STEP IS HERE)

git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

Prepare the build

To Build 32 bit Kernel

make ARCH=i386 oldconfig

To Build 64 bit Kernel

NOTE: MUST BE ON A 64 BIT OS

make oldconfig

In case you want to make changes to the config run:

make ARCH=i386 menuconfig

or

make oldconfig

Make sure to save when exiting the menuconfig.

Build the bzImage

To Build 32 bit Kernel

make ARCH=i386 bzImage

To Build 64 bit Kernel

make bzImage

This will take a while. Once successful, it will say bzImage created.

Copy the built kernel to your FOG Server's kernel directory.

NOTE: In my example, the FOG Server is the same as my build system. NOTE: Recommend to make a backup of the original /var/www/html/fog/service/ipxe/bzImage before continuing just in case.

cp arch/x86/boot/bzImage /var/www/html/fog/service/ipxe/bzImage

or

cp arch/x86/boot/bzImage /var/www/html/fog/service/ipxe/bzImage32

Additional Patches

Edit the files within the linux decompressed folder:

drivers/net/usb/r8152.c

https://forums.fogproject.org/topic/12465/microsoft-surface-go-usb-c-to-ethernet-adapter-compatibility

Search for
REALTEK_USB_DEVICE(VENDOR_ID_REALTEK
and add this line:
    {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927)}

drivers/scsi/storvsc_drv.c

This is an important patch to help prevent from major performance issues in HyperV: https://forums.fogproject.org/topic/6695/performance-decrease-using-hyper-v-win10-clients

Search for
blk_queue_virt_boundary

Delete the line and add:

    if (PAGE_SIZE - 1 < 4096) {
        blk_queue_virt_boundary(sdevice->request_queue, 4096);
    } else {
        blk_queue_virt_boundary(sdevice->request_queue, PAGE_SIZE - 1);
    }