Skip to content

Instantly share code, notes, and snippets.

@powareverb
Last active January 9, 2020 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save powareverb/5a59e4e68c7e56033ba0998ef3b53b94 to your computer and use it in GitHub Desktop.
Save powareverb/5a59e4e68c7e56033ba0998ef3b53b94 to your computer and use it in GitHub Desktop.
#==============================================================================
# Notes on building kernel / modules for ReadyNAS 6.5.1
# Not intended to be run as an actual script...
#==============================================================================
#Using ReadyNAS v6.5.1, checking details
cat /proc/version
# Linux version 4.1.21.x86_64.1 (jenkins@blocks) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Wed Jun 1 16:52:57 PDT 2016
cat /etc/*-release | grep VERSION
#VERSION_ID="7"
#VERSION="7 (wheezy)"
uname -a
#Linux nas-jones 4.1.21.x86_64.1 #1 SMP Wed Jun 1 16:52:57 PDT 2016 x86_64 GNU/Linux
#NETGEAR SRCS
#Always referenced here:
# http://kb.netgear.com/app/answers/detail/a_id/2649/~/gpl-open-source-code-for-programmers
# http://kb.netgear.com/app/answers/detail/a_id/30793/~/readynas-os-version-6.5.1
# http://www.downloads.netgear.com/files/GPL/ReadyNASOS_V6.5.1_WW_src.zip
#Need to dl kernel / sources
mkdir /data/Documents/NAS
cd /data/Documents/NAS
wget http://www.downloads.netgear.com/files/GPL/ReadyNASOS_V6.5.1_WW_src.zip
mkdir readynas-6.5.1
cp ReadyNASOS_V6.5.1_WW_src.zip readynas-6.5.1
cd readynas-6.5.1
unzip ReadyNASOS_V6.5.1_WW_src.zip
#Prereqs
sudo apt-get install build-essential libncurses5-dev
#Make Kernel / Modules:
sudo mkdir /data/kernel
sudo cp -R linux-4.1.21-x86_64/ /data/kernel/
sudo ln -s /data/kernel/linux-4.1.21-x86_64 /usr/src/linux
export KERN_DIR=/usr/src/linux
cd /usr/src/linux
#sudo cp .config .config-old
#Normal kernel build would be
#sudo cp arch/x86/configs/defconfig.x86 .config
#ReadyNAS build - ensure this file exists and you use it instead, using the default configs will get you an "invalid module format" error
sudo cp arch/x86/configs/readynas_defconfig .config
#Check and potentially move module dirs in
#ls /lib/modules
#Remove old - won't work if any modules are loaded
#sudo rm -Rf /lib/modules/
sudo make clean mrproper
sudo make ARCH=x86_64
sudo make modules_install ARCH=x86_64
#You should now be able to do a:
sudo modprobe configs
sudo cat /proc/config.gz | gunzip
#And get a list of the current kernel config
@didyouexpectthat
Copy link

Line 46 should come directly after line 51, since line 51 clears out the .config file that exists in the folder.

# make clean mrproper
  CLEAN   scripts/basic
  CLEAN   scripts/genksyms
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts
  CLEAN   include/config include/generated arch/x86/include/generated
  CLEAN   .config .version Module.symvers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment