Kernel 5.8.-rc6升级分享
Tofloor
poster avatar
mmlmonkey
deepin
2020-07-25 22:27
Author
本帖最后由 mmlmonkey 于 2020-7-25 14:29 编辑

今日有兴趣升级一下最新内核尝鲜按照 @kirin2018 大佬的帖子
https://bbs.deepin.org/post/194265#
和这两篇blog
https://www.kpromise.top/update-deepin-linux-kernel-to-latest/
https://www.htcp.net/4824.html
成功编译出来内核的deb 我传了蓝奏云
地址是https://wws.lanzous.com/inWjxez1hif   https://wws.lanzous.com/iecvQez1hgd   https://wws.lanzous.com/iRGs5ez1hfcsudo dpkg -i *deb 即可


但是发现deepin-anything bcmwl dkms会有error 简单看了一看 做了以下更改 可以成功生成module
1.Deepin-anything的 sudo dedit /usr/src/deepin-anything-0.0/vfs_change.c
第一处是 大概128行位置
  1. time_t shifted_secs = vc->ts.tv_sec + hour_shift*3600;
Copy the Code
这里我google好一会 发现都是说time_t修改来解决2038年问题的新闻 但是没有人说怎么改这个类型  就交给编译器自己玩吧
所以直接放进函数
  1.   //time_t shifted_secs = vc->ts.tv_sec + hour_shift*3600;
  2.                 struct tm ts;
  3. #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0)
  4.                 time_to_tm(vc->ts.tv_sec + hour_shift*3600, 0, &ts);
  5. #else
  6.                 time64_to_tm(vc->ts.tv_sec + hour_shift*3600, 0, &ts);
  7. #endif
Copy the Code

第二处
大概334行之后 这个是因为 file_operations的弃用 现在更改为了 procfs_ops
我们给他套上条件即可
  1. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  2. static struct proc_ops procfs_ops = {
  3.         //.owner = THIS_MODULE,
  4.         .proc_open = open_vfs_changes,
  5.         .proc_read = read_vfs_changes,
  6.         .proc_ioctl = ioctl_vfs_changes,
  7.         .proc_lseek = no_llseek,
  8.         //.llseek = generic_file_llseek,
  9.         .proc_release = release_vfs_changes,
  10. };
  11. #else

  12. static struct file_operations procfs_ops = {
  13.         .owner = THIS_MODULE,
  14.         .open = open_vfs_changes,
  15.         .read = read_vfs_changes,
  16.         .unlocked_ioctl = ioctl_vfs_changes,
  17.         .proc_lseek = no_llseek,
  18.         //.llseek = generic_file_llseek,
  19.         .release = release_vfs_changes,
  20. };
  21. #endif
Copy the Code
deepin-anything的就这么多

2.bcmwl这个其实吧我是不想管的 直接sudo apt remove bcmwl-kernel-source 就可以眼不见心不烦了
本着送佛送到西的原则 搜了一搜 大概是两个问题 ioremap_nocache 被弃用 ioremap可有替代 还有就是 file_operations
sudo dedit /usr/src/bcmwl-6.30.223.271+bdcom/src/wl/sys/wl_linux.c
在第583行之后
  1. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  2.         if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
  3.                 WL_ERROR(("wl%d: ioremap() failed\n", unit));
  4.                 goto fail;
  5.         }
  6. #else
  7.         if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
  8.                 WL_ERROR(("wl%d: ioremap() failed\n", unit));
  9.                 goto fail;
  10.         }

  11. #endif
Copy the Code
在781行之后
  1. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  2.                 bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
  3.                         bar1_size);
  4. #else
  5.                 bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
  6.                         bar1_size);
  7. #endif
Copy the Code
在3348行之后
  1. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  2. static const struct proc_ops wl_fops = {
  3.         //.owner        = THIS_MODULE,
  4.         .proc_read        = wl_proc_read,
  5.         .proc_write        = wl_proc_write,
  6. };
  7. #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
  8. static const struct file_operations wl_fops = {
  9.         .owner        = THIS_MODULE,
  10.         .read        = wl_proc_read,
  11.         .write        = wl_proc_write,
  12. };
  13. #endif
Copy the Code
保存后再修改sudo dedit /usr/src/bcmwl-6.30.223.271+bdcom/src/shared/linux_osl.c
在943行之后
  1. void *
  2. osl_reg_map(uint32 pa, uint size)
  3. {
  4.         
  5. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
  6.         return (ioremap((unsigned long)pa, (unsigned long)size));
  7. #else
  8.         return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
  9. #endif

  10. }
Copy the Code


最后 重新sudo dpkg -i *deb 即可 结果如下

  1. astrali@astrali-PC:~/ker$ dkms status
  2. bcmwl, 6.30.223.271+bdcom, 5.3.0-3-amd64, x86_64: installed
  3. bcmwl, 6.30.223.271+bdcom, 5.4.46, x86_64: installed
  4. bcmwl, 6.30.223.271+bdcom, 5.8.0-rc6, x86_64: installed
  5. deepin-anything, 0.0, 5.3.0-3-amd64, x86_64: installed
  6. deepin-anything, 0.0, 5.4.46, x86_64: installed
  7. deepin-anything, 0.0, 5.8.0-rc6, x86_64: installed
  8. nvidia, 450.57, 5.3.0-3-amd64, x86_64: installed
  9. nvidia, 450.57, 5.4.46, x86_64: installed
  10. nvidia, 450.57, 5.8.0-rc6, x86_64: installed
Copy the Code




不保证work  如bug请找专门负责人去修
enjoy

Reply Favorite View the author
All Replies
avatar
T***7@outlook.com
deepin
2023-02-22 19:21
#1
It has been deleted!