Seguridad Wireless - Wifi

Suite Seguridad Wireless => Live wifislax => Mensaje iniciado por: Algierd en 14-01-2017, 19:48 (Sábado)

Título: add patch to linux_updater script
Publicado por: Algierd en 14-01-2017, 19:48 (Sábado)
Hola,

I need to add a kernel patch for re-export MTRR functions to the script linux_updater.

http://www.flaterco.com/kb/video/kernel-MTRR-export.patch

it is necessary for my old PC to use the older driver for the video with new kernels. Could you help me with this and unpload a script?
Título: Re: add patch to linux_updater script
Publicado por: USUARIONUEVO en 14-01-2017, 20:12 (Sábado)
the best way is ... download tar.xz kernel archive
unconpress
patch
turn compress


then run the script ..if sources exist no download again the tar.xz file and use yours.



I see is a 4.3.x patch , and the last wifislax64 use a 4.8.x branch ...
Are you sure need this in 4.8.x ?
Título: Re: add patch to linux_updater script
Publicado por: Algierd en 14-01-2017, 20:22 (Sábado)
Yes, 32-bit system is supposed to work until the kernel 4.8.x.

I think that through this script would be more convenient to create a ready-made packages of new kernels, than to patch the source code manually :)
Título: Re: add patch to linux_updater script
Publicado por: USUARIONUEVO en 14-01-2017, 20:30 (Sábado)
but , not all people want this patch , then is your personally custom build.


the script is in the directory

Código: [Seleccionar]
/opt/wifislax-updaters/Sistema/
you can add , to automatically apply that patch.

in the script have at least one time to apply other patch for wireless, only see how..and add yours.


This is the wireless patch inside the script..then you can add something similar..down of the wireless patch.


patch generation
Código: [Seleccionar]
###################################
### Generamos parche wireless  ####
###################################
cat > Negative-channel-multi.patch << "EOF"
--- a/net/wireless/chan.c 2013-08-29 18:47:51.000000000 +0200
+++ b/net/wireless/chan.c 2013-08-31 22:20:45.014734447 +0200
@@ -441,4 +441,2 @@
  return -EOPNOTSUPP;
- if (!cfg80211_has_monitors_only(rdev))
- return -EBUSY;

--- a/net/mac80211/cfg.c Tue May 28 16:57:23 2013 -0400
+++ b/net/mac80211/cfg.c Tue May 28 17:16:15 2013 -0400
@@ -801,3 +801,4 @@
  }
- } else if (local->open_count == local->monitors) {
+ // Patch: Always allow channel change, even if a normal virtual interface is present
+ } else /*if (local->open_count == local->monitors)*/ {
  local->_oper_channel = chandef->chan;


--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3588,9 +3589,9 @@ static int ieee80211_cfg_get_channel
  if (chanctx_conf) {
  *chandef = chanctx_conf->def;
  ret = 0;
- } else if (local->open_count > 0 &&
+ } else /*if (local->open_count > 0 &&
    local->open_count == local->monitors &&
-   sdata->vif.type == NL80211_IFTYPE_MONITOR) {
+   sdata->vif.type == NL80211_IFTYPE_MONITOR)*/ {
  if (local->use_chanctx)
  *chandef = local->monitor_chandef;
  else

EOF

apply patch
Código: [Seleccionar]
# Aplicamos parche si hay error se parara el proceso ( exit 1 )
echo ""
echo ""$VERDE"Aplicando parche wireless para channel -1 "$BLANCO"..."$CIERRE""
sleep 1
patch -f -p1 < Negative-channel-multi.patch || exit 1
Título: Re: add patch to linux_updater script
Publicado por: Algierd en 14-01-2017, 20:43 (Sábado)
I added the following entry

Citar
cat > kernel-MTRR-export.patch << "EOF"
diff -ur linux-old/arch/x86/kernel/cpu/mtrr/main.c linux-4.3.3-P4EE/arch/x86/kernel/cpu/mtrr/main.c
--- linux-old/arch/x86/kernel/cpu/mtrr/main.c   2015-11-01 19:05:25.000000000 -0500
+++ linux-4.3.3-P4EE/arch/x86/kernel/cpu/mtrr/main.c   2016-01-03 10:43:45.274817305 -0500
@@ -449,6 +449,7 @@
               increment);
 }
 
+EXPORT_SYMBOL(mtrr_add);
 /**
  * mtrr_del_page - delete a memory type region
  * @reg: Register returned by mtrr_add
@@ -537,6 +538,7 @@
    return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
 }
 
+EXPORT_SYMBOL(mtrr_del);
 /**
  * arch_phys_wc_add - add a WC MTRR and handle errors if PAT is unavailable
  * @base: Physical base address
EOF

and
Citar
# Aplicamos parche si hay error se parara el proceso ( exit 1 )
echo ""
echo ""$VERDE"Aplicando parche wireless para channel -1 "$BLANCO"..."$CIERRE""
sleep 1
patch -f -p1 < Negative-channel-multi.patch || exit 1
patch -f -p1 < kernel-MTRR-export.patch || exit 1

this is the correct syntax?
Título: Re: add patch to linux_updater script
Publicado por: USUARIONUEVO en 14-01-2017, 20:51 (Sábado)
i think is good.

but better way to ensure is test  ;)


Now im playing linux-4.10-rc3 , i think 4.9 and 4.10 no need this patch , but not test for my side.  ;)


If you want better test a more big kernel branch , see in the iso file .. if you copy in to usb or cd , in the folder boot , see somthing like  "kernel_configs" , you have inside configs for 4.9 and 4.10" ...for more easy test.

Read , script stop in one point ..waiting to put a config ... or use the running kernel config but if press enter and get the running kernel ..need to manually config the new options.  ;)
Título: Re: add patch to linux_updater script
Publicado por: Algierd en 14-01-2017, 21:05 (Sábado)
It seems that it worked ^-^

Citar
Aplicando parche wireless para channel -1 ...
patching file net/wireless/chan.c
Hunk #1 succeeded at 859 (offset 418 lines).
patching file net/mac80211/cfg.c
Hunk #1 succeeded at 542 with fuzz 1 (offset -259 lines).
patching file net/mac80211/cfg.c
Hunk #1 succeeded at 3670 with fuzz 2 (offset 82 lines).
patching file arch/x86/kernel/cpu/mtrr/main.c

with this patch latest kernel 4.8 on which can run the nvidia 96.43.23 driver.
Título: Re: add patch to linux_updater script
Publicado por: Algierd en 14-01-2017, 22:28 (Sábado)
I do not have access to a GUI-interface as I can from the command line to install the kernel xzm-module?