Advertisement
Guest User

kernel_build

a guest
Apr 11th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. #! /bin/sh
  2.  
  3. # Build_Kernel Ver. .0000000001
  4. # Never run in /usr/src. Adjust <whatever-kernel>.
  5.  
  6. #Dependency Check...probably needs to be package adjusted since I wrote this 6 years ago...:)
  7. sudo apt-get install -y --force-yes build-essential bin86 kernel-package libqt3-headers libqt3-mt-dev wget libncurses5 libncurses5-dev
  8. #Wget the kernel
  9. wget https://www.kernel.org/pub/linux/kernel/v4.x/new_kernel
  10. #Untar the kernel0
  11. tar -xJf whatever_kernel.xz
  12. #Symbolic link the kernel directory
  13. ln -s /some/path linux
  14. #Apply any patches here. Repeat a Wget for the patch itself but they offer fully patched kernels now.
  15. #wget http://www.kernel.org/pub/linux/kernel//v2.6/snapshots/patch-2.6.37-git17.bz2
  16. #Apply patch
  17. #sudo bunzip2 patch-2.6.37-git17.bz2
  18. #sudo cp pat linux
  19. #sudo cp patch-2.6.37-git17 linux
  20. cd linux
  21. #Copy the previously used config for re-use in the new kernel.
  22. sudo cp /boot/config-??? .config
  23. #Apply any patches here. 'patch -p1 < <whatever-patch>'
  24. #sudo patch -p1 < patch-2.6.37-git17
  25. #sudo patch -p1 < xfs2.patch
  26. #Make the Menu. Adjust options -> Save.
  27. sudo make xconfig
  28. #Make it clean
  29. sudo make-kpkg clean
  30. #sleep 180
  31. #sleep 60
  32. #Build the new kernel.Adjust Concurrency to the CPU cores +1. Install if the build completed successfully.
  33. #Add a break here if the build didn't complete successfully or add '&& sudo dpkg -i *.deb' after the step below. We can just move out of the directory if the stage is successful.
  34. #Move files from /include/generated to /include/linux
  35. #sudo cp /usr/src/linux/incldue/generated/* /usr/src/linux/include/linux
  36. #Only builds image not headers which you will have to add if you need it. kernel_headers btw**
  37. sudo CONCURRENCY_LEVEL="NR_CPUS Plus one" make-kpkg --initrd kernel_image modules_image && cd ..
  38. #Back out of the linux directory
  39. #cd ..
  40. #Install the image and headers
  41. sudo dpkg -i linux*.deb
  42. #Remove the Kernel Directory and downloaded bz2s.
  43. #sleep 30
  44. ##sudo rm -rf /usr/src/linux-3.6.7 && sudo rm /usr/src/linux
  45. #Symbolic Link the *new* headers directory to /lib/modules/<whatever-kernel>/build & source
  46. #First remove bad links if there are any.
  47. #Move .deb
  48. #sudo mv linux*.deb /some/path
  49. #Only need ed if you instal headers
  50. #sudo rm /lib/modules/3.13.6/build && sudo rm /lib/modules/3.13.6/source
  51. #Now synbolic link the new header directory to build and source. Forget what this does!!
  52. #sudo ln -s /media/ubu/Stuff/stuff/linux /lib/modules/3.13.6/build && sudo ln -s /media/ubu/Stuff/stuff/linux /lib/modules/3.13.6/source
  53. #sudo ln -s /usr/src/linux-headers-3.1.0-rc10 /lib/modules/3.1.0-rc10/build && sudo ln -s /usr/src/linux-headers-3.1.0-rc10 /lib/modules/3.1.0-rc10/source
  54. #Reinstall any video,etc drivers after reboot or add a stage for envyng or something like that yourself.;)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement