├── .github └── workflows │ └── build.yml ├── .gitignore ├── 1.py ├── Install-deb.sh ├── LICENSE ├── README.md ├── auto_sign_deb.sh ├── build_action.sh ├── config ├── config-x ├── .config-ok ├── Opensuse │ ├── Leap5.14 │ │ └── config-5.14.21-150500.53-default │ └── Tumbleweed6.4 │ │ └── config ├── RHEL │ ├── config-4.18.0-477.10.1.el8_8.x86_64 │ ├── config-5.14.0-284.11.1.el9_2.x86_64 │ ├── config6.1.42el9 │ └── config6.4.7el9 ├── arch │ └── config-6.4.7-arch1 ├── debian │ └── debian12 ├── deepin │ ├── config-5.15.45-amd64-desktop │ ├── config-6.1.32-amd64-desktop-hwe │ ├── config-6.4.7-amd64-desktop-hwe │ ├── config-6.5.9 │ ├── deepin-6.1.11.config │ ├── deepin-6.1.32.config │ └── deepin-6.4.7.config ├── fedora │ ├── config-6.2.9-300.fc38.x86_64 │ ├── config6.4.6-200.fc38 │ └── config6.5.0-0.rc4.30.fc39 ├── mint │ ├── config-6.2.0-26-generic │ └── mint-6.1.0.config ├── ok │ ├── config-6.1.0-3-generic │ ├── ok-5.15.config │ └── ok-6.1.0.config ├── pve │ ├── config-6.2.16-10-pve.config │ ├── config-6.2.16-8-pve.config │ ├── config-6.5.3-1-pve │ ├── pve-6.2.16-4.config │ └── pve-6.2.16-5.config ├── uos │ ├── uos-4.19.config │ └── uos-5.10.config └── 银河麒麟 │ └── config-5.10.0-8-generic ├── config_setup.sh ├── create_file.sh ├── get-newest-version.py ├── get_latest_kernel.py ├── get_latest_kernel.txt ├── get_latest_kernel2.py ├── get_latest_kernel3.py ├── image ├── LinuxKernelBuilder-logo.png └── README │ └── 1689432126348.png ├── install_kernel ├── install_kernel.cpp ├── install_kernel2.cpp ├── install_kernel3.cpp ├── installandremove.py ├── patch.d └── redmi_book_air_13_acpi.sh ├── script.sh ├── time.py ├── time.txt └── txt ├── longterm.txt ├── longtermurl.txt ├── mainline.txt ├── mainlineurl.txt ├── stable.txt └── stableurl.txt /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build kernel deb packages 2 | on: 3 | push: 4 | schedule: 5 | # * is a special character in YAML so you have to quote this string 6 | - cron: '30 5 1 * *' 7 | 8 | jobs: 9 | build: 10 | name: Build kernel 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Maximize build space 14 | uses: easimon/maximize-build-space@master 15 | with: 16 | # 这个值是保留给系统的空间大小,之前设置太小,总会在安装依赖或者编译过程中报设备空间不足的错误而导致编译失败 17 | root-reserve-mb: 4096 18 | swap-size-mb: 512 19 | remove-dotnet: 'true' 20 | remove-android: 'true' 21 | 22 | - name: Checkout 23 | uses: actions/checkout@main 24 | - uses: actions/setup-node@v3 25 | with: 26 | node-version: '20' 27 | - name: install dep 28 | run: | 29 | sudo apt-get update 30 | sudo apt-get install -y curl jq gpg python3-pyquery wget xz-utils make gcc flex bison dpkg-dev bc rsync kmod cpio libssl-dev git lsb vim libelf-dev neofetch python3-pip python3-tk debhelper zstd dpkg-sig mmdebstrap qemu-user-static usrmerge binfmt-support systemd-container 31 | 32 | - name: Build 33 | run: bash build_action.sh 34 | 35 | 36 | - name: Artifact 37 | uses: actions/upload-artifact@v3 38 | with: 39 | name: artifact 40 | path: ${{ github.workspace }}/artifact/ 41 | 42 | - name: Compare files 43 | id: compare 44 | run: | 45 | cmp --silent txt/longterm.txt /tmp/longterm.txt && cmp --silent txt/mainline.txt /tmp/mainline.txt && cmp --silent txt/stable.txt /tmp/stable.txt && echo "skip=true" >> $GITHUB_OUTPUT || echo "skip=false" >> $GITHUB_OUTPUT 46 | - name: Commit and Push Changes 47 | env: 48 | GITHUB_TOKEN: ${{ secrets.TOKEN }} 49 | if: ${{ steps.compare.outputs.skip != 'true' }} 50 | run: | 51 | git config user.name "XXTXTOP" 52 | git config user.email "xxtxtop@gmail.com" 53 | ls -al 54 | pwd 55 | cp /tmp/mainline.txt txt/mainline.txt 56 | cp /tmp/mainlineurl.txt txt/mainlineurl.txt 57 | cp /tmp/stable.txt txt/stable.txt 58 | cp /tmp/stableurl.txt txt/stableurl.txt 59 | cp /tmp/longterm.txt txt/longterm.txt 60 | cp /tmp/longtermurl.txt txt/longtermurl.txt 61 | git pull 62 | git add txt/ 63 | git commit -m "Create file with kernel version" 64 | git push 65 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode/ 2 | *.DS_Store -------------------------------------------------------------------------------- /1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | import requests 4 | import re 5 | import time 6 | import os 7 | import tkinter as tk 8 | from tkinter import Menu, messagebox 9 | import subprocess 10 | 11 | def get_latest_kernel(): 12 | global latest_kernel_label 13 | global current_kernel_label 14 | latest_kernel = None 15 | try: 16 | response = requests.get("https://www.kernel.org/") 17 | latest_kernel = re.search(r"\d+\.\d+\.\d+", response.text).group() 18 | latest_kernel_label.config(text=f"Latest mainline-Linux kernel version: {latest_kernel}") 19 | except requests.exceptions.RequestException as e: 20 | latest_kernel_label.config(text=f"Failed to fetch kernel info: {e}") 21 | except AttributeError as e: 22 | latest_kernel_label.config(text=f"Failed to match kernel version: {e}") 23 | 24 | try: 25 | with open("get_latest_kernel.txt", "w") as f: 26 | f.write(str(latest_kernel)) 27 | print(f"Latest mainline-Linux kernel version exported to get_latest_kernel.txt") 28 | except IOError as e: 29 | latest_kernel_label.config(text=f"Failed to write to file: {e}") 30 | 31 | current_kernel = None 32 | try: 33 | current_kernel = re.search(r"\d+\.\d+\.\d+", os.popen("uname -r").read()).group() 34 | current_kernel_label.config(text=f"Current mainline-Linux kernel version: {current_kernel}") 35 | except OSError as e: 36 | current_kernel_label.config(text=f"Failed to get kernel version: {e}") 37 | except AttributeError as e: 38 | current_kernel_label.config(text=f"Failed to match kernel version: {e}") 39 | 40 | if latest_kernel and current_kernel: 41 | if latest_kernel > current_kernel: 42 | latest_kernel_label.config(text=f"New kernel version available: **{latest_kernel}**", fg="red") 43 | elif latest_kernel <= current_kernel: 44 | latest_kernel_label.config(text="Current kernel version is up to date", fg="green") 45 | 46 | def execute_script(): 47 | try: 48 | os.system("chmod +x script.sh") 49 | os.system("./script.sh") 50 | print("script.sh executed successfully") 51 | except Exception as e: 52 | print(f"Failed to execute script.sh: {e}") 53 | 54 | def execute_time_script(): 55 | try: 56 | subprocess.run(["python3", "time.py"], check=True) 57 | except subprocess.CalledProcessError as e: 58 | print(f"Script execution failed: {e}") 59 | latest_kernel_label.config(text=f"Script execution failed: {e}") 60 | 61 | def about(): 62 | tk.messagebox.showinfo("About", "This program was created by Kernel-Builder SIG.\nKernel versions are sourced from https://www.kernel.org/.") 63 | 64 | window = tk.Tk() 65 | window.title("Get Latest Linux Kernel Version") 66 | window.geometry("600x400") 67 | 68 | button1 = tk.Button(window, text="Get Latest Kernel Version", command=get_latest_kernel) 69 | button1.pack(pady=10) 70 | 71 | button2 = tk.Button(window, text="Execute script.sh", command=execute_script) 72 | button2.pack(pady=10) 73 | 74 | execute_button = tk.Button(window, text="Execute time.py script", command=execute_time_script) 75 | execute_button.pack(pady=10) 76 | 77 | latest_kernel_label = tk.Label(window, text="Latest mainline-Linux kernel version: ") 78 | latest_kernel_label.pack(pady=5) 79 | 80 | current_kernel_label = tk.Label(window, text="Current mainline-Linux kernel version: ") 81 | current_kernel_label.pack(pady=5) 82 | 83 | author_label = tk.Label(window, text="Author: Kernel-Builder SIG") 84 | author_label.pack(side=tk.LEFT, padx=10) 85 | 86 | source_label = tk.Label(window, text="Kernel version source: https://www.kernel.org/") 87 | source_label.pack(side=tk.RIGHT, padx=10) 88 | 89 | # Menu Bar 90 | menu_bar = Menu(window) 91 | window.config(menu=menu_bar) 92 | 93 | # About Menu 94 | about_menu = Menu(menu_bar, tearoff=0) 95 | menu_bar.add_cascade(label="About", menu=about_menu) 96 | about_menu.add_command(label="Info", command=about) 97 | 98 | window.mainloop() 99 | -------------------------------------------------------------------------------- /Install-deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 定义 deb 包的后缀 4 | suffix=".deb" 5 | 6 | # 进入 artifact 目录 7 | cd artifact 8 | 9 | # 获取所有 deb 包的文件名,用空格分隔 10 | DEBS=$(ls *.deb) 11 | 12 | # 用 for 循环依次处理每个 deb 包 13 | for DEB in $DEBS; do 14 | # 判断文件名是否以 .deb 结尾,如果不是,跳过 15 | if [[ "$DEB" != *"$suffix" ]]; then 16 | echo "file type must be deb!" 17 | continue 18 | fi 19 | # 提示开始解压 deb 包 20 | echo "Extract $DEB from the archive" 21 | # 使用 ar 命令解压 deb 包,生成三个文件:debian-binary,control.tar.zst 和 data.tar.zst 22 | ar x $DEB 23 | # 提示开始转换压缩格式 24 | echo "Uncompress zstd $DEB and re-compress them using xz" 25 | # 使用 zstd 命令解压 control.tar.zst 文件,然后使用 xz 命令压缩它,生成 control.tar.xz 文件 26 | zstd -d < control.tar.zst | xz > control.tar.xz 27 | # 使用 zstd 命令解压 data.tar.zst 文件,然后使用 xz 命令压缩它,生成 data.tar.xz 文件 28 | zstd -d < data.tar.zst | xz > data.tar.xz 29 | # 提示开始重新打包 deb 包 30 | echo "Re-create the Debian package in /tmp/$DEB" 31 | # 使用 ar 命令重新打包 deb 包,将 debian-binary,control.tar.xz 和 data.tar.xz 三个文件合并为一个 deb 包,并保存在 /tmp 目录下,文件名与原来的 deb 包相同 32 | ar -m -c -a sdsd /tmp/$DEB debian-binary control.tar.xz data.tar.xz 33 | # 提示开始清理临时文件 34 | echo 'Clean up' 35 | # 使用 rm 命令删除解压和转换过程中生成的临时文件 36 | rm debian-binary control.tar.xz data.tar.xz control.tar.zst data.tar.zst 37 | # 提示开始执行 ~/installDeb.sh 脚本 38 | # echo "Execute ~/installDeb.sh $DEB" 39 | # 执行 ~/installDeb.sh 脚本,传入 deb 包的文件名作为参数 40 | #sudo ~/Install-deb.sh $DEB 41 | done 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kernel_deb_builder 2 | 3 | 利用 GitHub Actions 自动编译 Linux 内核为 deb 包。 4 | 5 | ![1689432126348](image/README/1689432126348.png) 6 | 7 | 此架构图已经不适应目前的情况,后续需要对其进行修改,建议以代码逻辑为准。 8 | 9 | #### 备忘录: 10 | 11 | 使用install_kernel.cpp文件通过执行 12 | 13 | ``g++ -o install_kernel install_kernel.cpp -lstdc++fs -static-libstdc++ `` 14 | 15 | 来编译出install_kernel 文件,并实现本地的编译(尝试使用静态链接库而不是动态链接库),目前还未测试通过 16 | 17 | # 如何使用 18 | 19 | 如果您想要利用我的这个自动化脚本根据自己的需求编译内核,请参考如下步骤: 20 | 21 | #### 1. Fork 仓库 22 | 23 | 访问 [XXTX-TOP/Linux-kernel_deb_builder (github.com)](https://github.com/XXTX-TOP/Linux-kernel_deb_builder),点击右上角的 `Fork` 按钮,并 clone 到本地 24 | 25 | #### 2. 更新 config 文件 26 | 27 | - 在本地将您获取的 config 文件替换根目录下的 `config`,可以从您系统的 `/boot/config*` 文件复制,或者手动编辑 28 | - 本项目提供了部分config,处于config-x文件夹中、可任意选择使用,同时也欢迎各位贡献config 29 | 30 | 31 | #### 3. 编写自定义修改脚本 32 | 33 | 当前 `/patch.d/` 目录下的修改脚本是只针对我自己的需求编写的,建议您先将其删掉,然后编写自己的脚本放在这个目录下,在脚本执行过程中会自动应用该目录下的所有脚本 34 | 35 | #### 4. 推送修改 36 | 37 | 推送后,action 自动触发,可以在您的仓库页面的 `Actions` 选项卡查看进度详情。 38 | 39 | #### 5.下载解压安装 40 | 41 | 在您的仓库页面的 `Actions`里面下载[artifact](https://github.com/XXTX-TOP/Linux-kernel_deb_builder/suites/13914141709/artifacts/774503646) 【示例】,然后解压安装后通过sudo dpkg -i +包名 即可 42 | 43 | #### 6、自动编译流程 44 | 45 | 流程大概是: 46 | 一、自动化处理流程,二十四小时检测Linux内核官网有没有发布新版本的内核,发布新版本的内核就和之前一个版本进行对比,新的化,就自动开始编译并打包。 47 | 二、手动触发流程,我手动点击获取按钮、如果检测到内核比我本机的内核新,那么就自动开始编译,编译完成后自动进行下载、安装、重启。PS:本机特指我用来测试的机器和虚拟机。 48 | 49 | 三、预计通过由openkylin-rootfs生成的openkylin-docker预制内核编译环境,来进行内核的编译,提升内核编译相关性。 50 | 51 | 后续待实现流程:定制化编译、多架构编译、测试完成后一件进行签名并发布至apt源,并更新内核说明,供大家进行下载测试。 52 | 53 | #### 7、后续发展计划 54 | 55 | 备忘录:写一个管理我方内核的工具,至少包括安装卸载指定版本,以及删除所有我方内核、删除所有除我方内核。 56 | 57 | #### 8、依赖 58 | 59 | | 组件 | 官网 | 60 | | ----------- | ------------------------------------------------------------------------------------------------------------------------------ | 61 | | wget | [Wget - GNU Project - Free Software Foundation](https://www.gnu.org/software/wget/) | 62 | | xz-utils | [XZ Utils (tukaani.org)](https://tukaani.org/xz/) | 63 | | make | [Make - GNU Project - Free Software Foundation](https://www.gnu.org/software/make/) | 64 | | gcc | [GCC, the GNU Compiler Collection - GNU Project](https://gcc.gnu.org/) | 65 | | flex | [westes/flex: The Fast Lexical Analyzer - scanner generator for lexing in C and C++ (github.com)](https://github.com/westes/flex) | 66 | | bison | [Bison - GNU Project - Free Software Foundation](https://www.gnu.org/software/bison/) | 67 | | dpkg-dev | [Dpkg — Debian Package Manager](https://www.dpkg.org/) | 68 | | bc | [bc - GNU Project - Free Software Foundation](https://www.gnu.org/software/bc/) | 69 | | rsync | [rsync (samba.org)](https://rsync.samba.org/) | 70 | | kmod | | 71 | | cpio | [Cpio - GNU Project - Free Software Foundation](https://www.gnu.org/software/cpio/) | 72 | | libssl-dev | [openssl/openssl: TLS/SSL and crypto library (github.com)](https://github.com/openssl/openssl) | 73 | | git | [Git - Downloading Package (git-scm.com)](https://git-scm.com/download/win) | 74 | | lsb | [LSB Specifications (linuxfoundation.org)](https://refspecs.linuxfoundation.org/lsb.shtml) | 75 | | vim | [welcome home : vim online](https://www.vim.org/) | 76 | | libelf-dev | | 77 | | python3-pip | [pip · PyPI](https://pypi.org/project/pip/) | 78 | | python3-tk | [tkinter — Python interface to Tcl/Tk — Python 3.11.4 documentation](https://docs.python.org/3/library/tkinter.html) | 79 | | debhelper | [debhelper(7) — debhelper — Debian jessie — Debian Manpages](https://manpages.debian.org/jessie/debhelper/debhelper.7.en.html) | 80 | 81 | # 本项目由JetBrains提供编程软件支持: 82 | 83 | ![JetBrains Logo (Main) logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png) 84 | Copyright © 2000-2023 JetBrains s.r.o. JetBrains and the JetBrains logo are registered trademarks of JetBrains s.r.o. 85 | -------------------------------------------------------------------------------- /auto_sign_deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 设置变量 4 | PASSWORD="your_password" # gpg密钥的密码 5 | KEYID="your_key_id" # gpg密钥的ID 6 | DIR="your_directory" # deb包所在的目录 7 | 8 | # 定义一个函数,用于清理临时文件 9 | cleanup() { 10 | # 删除所有的.sig文件 11 | rm -f $DIR/*.sig 12 | # 删除所有的.deb.asc文件 13 | rm -f $DIR/*.deb.asc 14 | } 15 | 16 | # 定义一个函数,用于处理错误或中断 17 | error() { 18 | # 输出错误信息 19 | echo "An error occurred. Cleaning up..." 20 | # 调用清理函数 21 | cleanup 22 | # 退出脚本 23 | exit 1 24 | } 25 | 26 | # 使用trap命令,捕获可能发生的错误或中断 27 | trap error ERR INT TERM 28 | 29 | # 遍历目录下的所有deb包,使用find命令 30 | find $DIR -name "*.deb" -print0 | while read -d $'\0' file 31 | do 32 | # 对deb包进行签名,使用dpkg-sig --sign命令 33 | # 使用--pinentry-mode loopback --batch --passphrase参数来免交互输入密码 34 | dpkg-sig --sign builder --gpg-options "--pinentry-mode loopback --batch --passphrase $PASSWORD --default-key $KEYID" $file 35 | # 检查签名是否成功,使用dpkg-sig --verify命令 36 | dpkg-sig --verify $file 37 | # 如果成功,输出文件名和签名信息 38 | if [ $? -eq 0 ]; then 39 | echo "Signed $file successfully." 40 | dpkg-sig --list $file 41 | # 如果失败,输出错误信息 42 | else 43 | echo "Failed to sign $file." 44 | fi 45 | done 46 | 47 | # 调用清理函数 48 | cleanup 49 | 50 | -------------------------------------------------------------------------------- /build_action.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | python3 get-newest-version.py 0 4 | python3 get-newest-version.py 1 5 | python3 get-newest-version.py 2 6 | mainline=`cat /tmp/mainline.txt` 7 | mainlineurl=`cat /tmp/mainlineurl.txt` 8 | MAINVERSION=`expr substr mainline 1 1` 9 | SHOWVERSION=mainline 10 | 11 | # add deb-src to sources.list 12 | sed -i "/deb-src/s/# //g" /etc/apt/sources.list 13 | 14 | pip3 install requests wget ttkthemes 15 | 16 | sudo apt build-dep -y linux 17 | neofetch 18 | 19 | 20 | # change dir to workplace 21 | cd "${GITHUB_WORKSPACE}" || exit 22 | 23 | wget $mainlineurl 24 | if [[ -f linux-"$mainline".tar.xz ]]; then 25 | tar -xvf linux-"$mainline".tar.xz 26 | fi 27 | if [[ -f linux-"$mainline".tar.gz ]]; then 28 | tar -xvf linux-"$mainline".tar.gz 29 | fi 30 | if [[ -f linux-"$mainline".tar ]]; then 31 | tar -xvf linux-"$mainline".tar 32 | fi 33 | if [[ -f linux-"$mainline".bz2 ]]; then 34 | tar -xvf linux-"$mainline".tar.bz2 35 | fi 36 | cd linux-"$mainline" || exit 37 | 38 | 39 | 40 | # download kernel source 41 | # wget http://www.kernel.org/pub/linux/kernel/v6.x/linux-6.4.tar.gz 42 | # tar -xf linux-"$VERSION".tar.gz 43 | # cd linux-"$VERSION" || exit 44 | 45 | # copy config file 46 | cp ../config .config 47 | 48 | #利用scripts/config对内核进行修改,之后需要写个注释对上述提到的所以东西进行讲解 49 | scripts/config --disable DEBUG_INFO_X86 50 | scripts/config --disable DEBUG_INFO_VMCORE 51 | scripts/config --disable DEBUG_INFO_SPLIT 52 | scripts/config --disable DEBUG_INFO_BTF_MODULES 53 | scripts/config --disable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT 54 | scripts/config --disable DEBUG_INFO_PERF 55 | scripts/config --disable DEBUG_INFO_BTF 56 | scripts/config --disable DEBUG_INFO_DWARF4 57 | scripts/config --disable DEBUG_INFO_REDUCED 58 | scripts/config --set-str SYSTEM_TRUSTED_KEYS "" 59 | scripts/config --set-str SYSTEM_REVOCATION_KEYS "" 60 | scripts/config --undefine DEBUG_INFO 61 | scripts/config --undefine DEBUG_INFO_COMPRESSED 62 | scripts/config --undefine DEBUG_INFO_REDUCED 63 | scripts/config --undefine DEBUG_INFO_SPLIT 64 | scripts/config --undefine GDB_SCRIPTS 65 | scripts/config --set-val DEBUG_INFO_DWARF5 n 66 | scripts/config --set-val DEBUG_INFO_NONE y 67 | 68 | 69 | 70 | # build deb packages 71 | CPU_CORES=$(($(grep -c processor < /proc/cpuinfo)*2)) 72 | sudo make bindeb-pkg -j"$CPU_CORES" 73 | 74 | # move deb packages to artifact dir 75 | cd .. 76 | 77 | 78 | stable=`cat /tmp/stable.txt` 79 | 80 | # change dir to workplace 81 | cd "${GITHUB_WORKSPACE}" || exit 82 | 83 | stableurl=`cat /tmp/stableurl.txt` 84 | 85 | wget $stableurl 86 | if [[ -f linux-"$stable".tar.xz ]]; then 87 | tar -xvf linux-"$stable".tar.xz 88 | fi 89 | if [[ -f linux-"$stable".tar.gz ]]; then 90 | tar -xvf linux-"$stable".tar.gz 91 | fi 92 | if [[ -f linux-"$stable".tar ]]; then 93 | tar -xvf linux-"$stable".tar 94 | fi 95 | if [[ -f linux-"$stable".bz2 ]]; then 96 | tar -xvf linux-"$stable".tar.bz2 97 | fi 98 | cd linux-"$stable" || exit 99 | 100 | 101 | # copy config file 102 | cp ../config .config 103 | 104 | #利用scripts/config对内核进行修改,之后需要写个注释对上述提到的所以东西进行讲解 105 | scripts/config --disable DEBUG_INFO_X86 106 | scripts/config --disable DEBUG_INFO_VMCORE 107 | scripts/config --disable DEBUG_INFO_SPLIT 108 | scripts/config --disable DEBUG_INFO_BTF_MODULES 109 | scripts/config --disable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT 110 | scripts/config --disable DEBUG_INFO_PERF 111 | scripts/config --disable DEBUG_INFO_BTF 112 | scripts/config --disable DEBUG_INFO_DWARF4 113 | scripts/config --disable DEBUG_INFO_REDUCED 114 | scripts/config --set-str SYSTEM_TRUSTED_KEYS "" 115 | scripts/config --set-str SYSTEM_REVOCATION_KEYS "" 116 | scripts/config --undefine DEBUG_INFO 117 | scripts/config --undefine DEBUG_INFO_COMPRESSED 118 | scripts/config --undefine DEBUG_INFO_REDUCED 119 | scripts/config --undefine DEBUG_INFO_SPLIT 120 | scripts/config --undefine GDB_SCRIPTS 121 | scripts/config --set-val DEBUG_INFO_DWARF5 n 122 | scripts/config --set-val DEBUG_INFO_NONE y 123 | 124 | # build deb packages 125 | CPU_CORES=$(($(grep -c processor < /proc/cpuinfo)*2)) 126 | sudo make bindeb-pkg -j"$CPU_CORES" 127 | 128 | # move deb packages to artifact dir 129 | cd .. 130 | 131 | :< USB HID transport layer 24 | scripts/config -e CONFIG_USB_HID 25 | # 提高桌面响应速度 26 | # (X) Preemptible Kernel (Low-Latency Desktop) [CONFIG_PREEMPT] 27 | scripts/config -e CONFIG_PREEMPT 28 | # (X) Idle dynticks system (tickless idle) [CONFIG_NO_HZ_IDLE] 29 | scripts/config -e CONFIG_NO_HZ_IDLE 30 | # (X) Simple tick based cputime accounting [CONFIG_TICK_CPU_ACCOUNTING] 31 | scripts/config -e CONFIG_TICK_CPU_ACCOUNTING 32 | # 桌面系统的“鸡血补丁”,开启后能显著降低操作延迟、提升程序响应速度 33 | # [*] Automatic process group schedulin [CONFIG_SCHED_AUTOGROUP] 34 | scripts/config -e CONFIG_SCHED_AUTOGROUP 35 | EOF -------------------------------------------------------------------------------- /create_file.sh: -------------------------------------------------------------------------------- 1 | echo "6.4.3" > temp_file.txt 2 | echo "6.4.3" > temp_file.txt 3 | echo "6.4.3" > temp_file.txt 4 | echo "6.4.3" > temp_file.txt 5 | echo "6.4.3" > temp_file.txt 6 | echo "6.4.3" > temp_file.txt 7 | echo "6.4.3" > temp_file.txt 8 | echo "6.4.3" > temp_file.txt 9 | echo "6.4.3" > temp_file.txt 10 | echo "6.4.3" > temp_file.txt 11 | echo "6.4.3" > temp_file.txt 12 | echo "6.4.3" > temp_file.txt 13 | echo "6.4.3" > temp_file.txt 14 | echo "6.4.3" > temp_file.txt 15 | echo "6.4.3" > temp_file.txt 16 | echo "6.4.3" > temp_file.txt 17 | echo "6.4.3" > temp_file.txt 18 | echo "6.4.3" > temp_file.txt 19 | echo "6.4.3" > temp_file.txt 20 | echo "6.4.3" > temp_file.txt 21 | echo "6.4.3" > temp_file.txt 22 | echo "6.4.3" > temp_file.txt 23 | echo "6.4.3" > temp_file.txt 24 | echo "6.4.3" > temp_file.txt 25 | -------------------------------------------------------------------------------- /get-newest-version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | import pyquery 6 | mainVersion = int(sys.argv[1]) 7 | programVersionList = pyquery.PyQuery(url=f"https://www.kernel.org/") 8 | #release = pyquery.PyQuery() 9 | temp = 0 10 | newestVersion = "0.0.0" 11 | newestUrl = "" 12 | for i in programVersionList(f"#releases tr :nth-child(2)").items(): 13 | version = i("td strong").text() 14 | if temp == mainVersion: 15 | #print(version) 16 | newestVersion = version 17 | break 18 | temp += 1 19 | 20 | temp = 0 21 | for i in programVersionList(f"#releases tr :nth-child(4)").items(): 22 | url = i("td a").attr.href 23 | if temp == mainVersion: 24 | newestUrl = url 25 | break 26 | temp += 1 27 | 28 | 29 | print(f"Version:{newestVersion}") 30 | print(f"Url:{newestUrl}") 31 | 32 | 33 | if mainVersion == 0: # mainline 34 | with open("/tmp/mainline.txt", "w") as file: 35 | file.write(newestVersion) 36 | with open("/tmp/mainlineurl.txt", "w") as file: 37 | file.write(newestUrl) 38 | elif mainVersion == 1: # stable 39 | with open("/tmp/stable.txt", "w") as file: 40 | file.write(newestVersion) 41 | with open("/tmp/stableurl.txt", "w") as file: 42 | file.write(newestUrl) 43 | elif mainVersion == 2: # longterm 44 | with open("/tmp/longterm.txt", "w") as file: 45 | file.write(newestVersion) 46 | with open("/tmp/longtermurl.txt", "w") as file: 47 | file.write(newestUrl) 48 | -------------------------------------------------------------------------------- /get_latest_kernel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 获取最新的Linux内核版本 4 | import requests 5 | import re 6 | import time 7 | import os 8 | import tkinter as tk 9 | import subprocess 10 | 11 | # 定义一个函数,用于获取最新的内核版本,并且和当前的内核版本进行比较 12 | def get_latest_kernel(): 13 | global latest_kernel_label # 使用全局变量 14 | global current_kernel_label 15 | latest_kernel = None # 给 latest_kernel 赋一个初始值 16 | try: 17 | response = requests.get("https://www.kernel.org/") 18 | # 修改正则表达式,匹配以数字开头并且包含小数点的字符串 19 | latest_kernel = re.search(r"\d+\.\d+\.\d+", response.text).group() 20 | print(f"最新的mainlineLinux-内核版本是{latest_kernel}") 21 | latest_kernel_label.config(text=f"最新的mainline-Linux内核版本是:{latest_kernel}") # 更新标签上的文本 22 | except requests.exceptions.RequestException as e: 23 | print(f"请求内核官网失败:{e}") 24 | latest_kernel_label.config(text=f"请求内核官网失败:{e}") # 更新标签上的文本 25 | except AttributeError as e: 26 | print(f"匹配内核版本失败:{e}") 27 | latest_kernel_label.config(text=f"匹配内核版本失败:{e}") # 更新标签上的文本 28 | # 将最新的内核版本写入到文件中 29 | try: 30 | with open("get_latest_kernel.txt", "w") as f: # 以写入模式打开文件 31 | f.write(str(latest_kernel)) # 写入最新的内核版本,转换为字符串类型 32 | print(f"已将最新的mainline-Linux内核版本导出到 get_latest_kernel.txt 文件中") 33 | except IOError as e: 34 | print(f"写入文件失败:{e}") 35 | latest_kernel_label.config(text=f"写入文件失败:{e}") # 更新标签上的文本 36 | # 获取当前的Linux内核版本 37 | current_kernel = None # 给 current_kernel 赋一个初始值 38 | try: 39 | # 修改正则表达式,匹配以数字开头并且包含小数点的字符串 40 | current_kernel = re.search(r"\d+\.\d+\.\d+", os.popen("uname -r").read()).group() 41 | print(f"当前的mainline-Linux内核版本是:{current_kernel}") 42 | current_kernel_label.config(text=f"当前的mainline-Linux内核版本是:{current_kernel}") # 更新标签上的文本 43 | except OSError as e: 44 | print(f"获取内核版本失败:{e}") 45 | current_kernel_label.config(text=f"获取内核版本失败:{e}") # 更新标签上的文本 46 | except AttributeError as e: 47 | print(f"匹配内核版本失败:{e}") 48 | current_kernel_label.config(text=f"匹配内核版本失败:{e}") # 更新标签上的文本 49 | 50 | # 比较最新的内核版本和当前的内核版本,如果有更新,提示用户 51 | if latest_kernel and current_kernel: # 如果两个变量都不为空 52 | if latest_kernel > current_kernel: # 如果最新的内核版本大于当前的内核版本 53 | latest_kernel_label.config(text=f"有新的内核版本可用:**{latest_kernel}**", fg="red") # 更新标签上的文本,并显示最新的内核版本,用红色字体 54 | elif latest_kernel <= current_kernel: # 如果最新的内核版本等于或小于当前的内核版本 55 | latest_kernel_label.config(text=f"当前的内核版本已经是最新的", fg="green") # 更新标签上的文本,用绿色字体 56 | 57 | def execute_script(): 58 | try: 59 | os.system("chmod +x script.sh") # 添加执行权限 60 | os.system("./script.sh") # Execute the script.sh file 61 | print("script.sh 执行成功") 62 | except Exception as e: 63 | print(f"执行 script.sh 失败:{e}") 64 | 65 | # 定义一个函数,用于执行time.py脚本 66 | def execute_time_script(): 67 | try: 68 | subprocess.run(["python3", "time.py"], check=True) 69 | except subprocess.CalledProcessError as e: 70 | print(f"执行脚本失败:{e}") 71 | latest_kernel_label.config(text=f"执行脚本失败:{e}") # 更新标签上的文本 72 | 73 | 74 | # 创建一个窗口 75 | window = tk.Tk() 76 | window.title("获取最新的Linux内核版本") # 设置窗口标题 77 | window.geometry("600x350") # 设置窗口大小 78 | 79 | # 创建一个按钮,点击时调用get_latest_kernel函数 80 | button1 = tk.Button(window, text="获取最新的内核版本", command=get_latest_kernel) 81 | button1.pack() # 将按钮添加到窗口中 82 | 83 | # 创建一个按钮,点击时执行 script.sh 脚本 84 | button2 = tk.Button(window, text="执行 script.sh", command=execute_script) 85 | button2.pack() # 将按钮添加到窗口中 86 | 87 | # 创建一个按钮,用于执行time.py脚本 88 | execute_button = tk.Button(window, text="执行time.py脚本", command=execute_time_script) 89 | execute_button.pack() # 将按钮添加到窗口中 90 | 91 | # 创建两个标签,用于显示最新的内核版本和当前的内核版本 92 | latest_kernel_label = tk.Label(window, text="最新的mainline-Linux内核版本是:") 93 | latest_kernel_label.pack() # 将标签添加到窗口中 94 | current_kernel_label = tk.Label(window, text="当前的Linux内核版本是:") 95 | current_kernel_label.pack() # 将标签添加到窗口中 96 | 97 | # 创建两个标签,用于显示作者信息和内核版本来源 98 | author_label = tk.Label(window, text="作者:Kernel-Builder SIG") 99 | author_label.pack(side=tk.LEFT) # 将标签添加到窗口中,并放在左边 100 | source_label = tk.Label(window, text="内核版本来源:https://www.kernel.org/") 101 | source_label.pack(side=tk.RIGHT) # 将标签添加到窗口中,并放在右边 102 | 103 | # 进入主循环,等待用户操作 104 | window.mainloop() -------------------------------------------------------------------------------- /get_latest_kernel.txt: -------------------------------------------------------------------------------- 1 | 6.6.1 -------------------------------------------------------------------------------- /get_latest_kernel2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | import os 4 | import tkinter as tk 5 | from tkinter import Menu, messagebox 6 | 7 | def get_latest_kernel(branch): 8 | global latest_kernel_label 9 | global current_kernel_label 10 | 11 | # Define the file path based on the specified branch 12 | file_path = f"txt/{branch}.txt" 13 | 14 | try: 15 | with open(file_path, "r") as f: 16 | latest_kernel = f.read().strip() 17 | latest_kernel_label.config(text=f"Latest {branch.capitalize()} kernel version: {latest_kernel}") 18 | except FileNotFoundError: 19 | latest_kernel_label.config(text=f"File not found: {file_path}") 20 | except Exception as e: 21 | latest_kernel_label.config(text=f"Error reading file: {e}") 22 | 23 | current_kernel = None 24 | try: 25 | current_kernel = os.popen("uname -r").read().strip() 26 | current_kernel_label.config(text=f"Current {branch.capitalize()} kernel version: {current_kernel}") 27 | except Exception as e: 28 | current_kernel_label.config(text=f"Failed to get kernel version: {e}") 29 | 30 | if latest_kernel and current_kernel: 31 | if latest_kernel > current_kernel: 32 | latest_kernel_label.config(text=f"New kernel version available: **{latest_kernel}**", fg="red") 33 | elif latest_kernel <= current_kernel: 34 | latest_kernel_label.config(text=f"Current kernel version is up to date", fg="green") 35 | 36 | def execute_script(): 37 | try: 38 | os.system("chmod +x script.sh") 39 | os.system("./script.sh") 40 | print("script.sh executed successfully") 41 | except Exception as e: 42 | print(f"Failed to execute script.sh: {e}") 43 | 44 | def execute_install_kernel(): 45 | try: 46 | os.system("chmod +x install_kernel") 47 | os.system("./install_kernel") 48 | print("install_kernel executed successfully") 49 | except Exception as e: 50 | print(f"Failed to execute install_kernel: {e}") 51 | 52 | def execute_time_script(): 53 | try: 54 | os.system("python3 time.py") 55 | except Exception as e: 56 | print(f"Script execution failed: {e}") 57 | latest_kernel_label.config(text=f"Script execution failed: {e}") 58 | 59 | def about(): 60 | tk.messagebox.showinfo("About", "This program was created by Kernel-Builder SIG.\nKernel versions are sourced from txt files in the current directory.") 61 | 62 | window = tk.Tk() 63 | window.title("Get Latest Linux Kernel Version") 64 | window.geometry("600x400") 65 | 66 | button_longterm = tk.Button(window, text="Get Latest Longterm Kernel Version", command=lambda: get_latest_kernel("longterm")) 67 | button_longterm.pack(pady=10) 68 | 69 | button_mainline = tk.Button(window, text="Get Latest Mainline Kernel Version", command=lambda: get_latest_kernel("mainline")) 70 | button_mainline.pack(pady=10) 71 | 72 | button_stable = tk.Button(window, text="Get Latest Stable Kernel Version", command=lambda: get_latest_kernel("stable")) 73 | button_stable.pack(pady=10) 74 | 75 | button2 = tk.Button(window, text="Execute script.sh", command=execute_script) 76 | button2.pack(pady=10) 77 | 78 | execute_install_kernel_button = tk.Button(window, text="Execute install_kernel", command=execute_install_kernel) 79 | execute_install_kernel_button.pack(pady=10) 80 | 81 | execute_button = tk.Button(window, text="Execute time.py script", command=execute_time_script) 82 | execute_button.pack(pady=10) 83 | 84 | latest_kernel_label = tk.Label(window, text="Latest kernel version: ") 85 | latest_kernel_label.pack(pady=5) 86 | 87 | current_kernel_label = tk.Label(window, text="Current kernel version: ") 88 | current_kernel_label.pack(pady=5) 89 | 90 | author_label = tk.Label(window, text="Author: Kernel-Builder SIG") 91 | author_label.pack(side=tk.LEFT, padx=10) 92 | 93 | source_label = tk.Label(window, text="Kernel version source: txt files in the current directory") 94 | source_label.pack(side=tk.RIGHT, padx=10) 95 | 96 | # Menu Bar 97 | menu_bar = Menu(window) 98 | window.config(menu=menu_bar) 99 | 100 | # About Menu 101 | about_menu = Menu(menu_bar, tearoff=0) 102 | menu_bar.add_cascade(label="About", menu=about_menu) 103 | about_menu.add_command(label="Info", command=about) 104 | 105 | window.mainloop() 106 | -------------------------------------------------------------------------------- /get_latest_kernel3.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tkinter as tk 3 | from tkinter import Menu, messagebox 4 | 5 | def center_window(window): 6 | window.update_idletasks() 7 | width = window.winfo_width() 8 | height = window.winfo_height() 9 | 10 | screen_width = window.winfo_screenwidth() 11 | screen_height = window.winfo_screenheight() 12 | 13 | x = (screen_width - width) // 2 14 | y = (screen_height - height) // 2 15 | 16 | window.geometry(f"{width}x{height}+{x}+{y}") 17 | 18 | def get_latest_kernel(branch): 19 | global latest_kernel_label 20 | global current_kernel_label 21 | 22 | # Define the file path based on the specified branch 23 | file_path = f"txt/{branch}.txt" 24 | 25 | try: 26 | with open(file_path, "r") as f: 27 | latest_kernel = f.read().strip() 28 | latest_kernel_label.config(text=f"Latest {branch.capitalize()} kernel version: {latest_kernel}") 29 | except FileNotFoundError: 30 | latest_kernel_label.config(text=f"File not found: {file_path}") 31 | except Exception as e: 32 | latest_kernel_label.config(text=f"Error reading file: {e}") 33 | 34 | current_kernel = None 35 | try: 36 | current_kernel = os.popen("uname -r").read().strip() 37 | current_kernel_label.config(text=f"Current {branch.capitalize()} kernel version: {current_kernel}") 38 | except Exception as e: 39 | current_kernel_label.config(text=f"Failed to get kernel version: {e}") 40 | 41 | if latest_kernel and current_kernel: 42 | if latest_kernel > current_kernel: 43 | latest_kernel_label.config(text=f"New kernel version available: **{latest_kernel}**", fg="red") 44 | elif latest_kernel <= current_kernel: 45 | latest_kernel_label.config(text=f"Current kernel version is up to date", fg="green") 46 | 47 | def execute_script(): 48 | try: 49 | os.system("chmod +x script.sh") 50 | os.system("./script.sh") 51 | print("script.sh executed successfully") 52 | except Exception as e: 53 | print(f"Failed to execute script.sh: {e}") 54 | 55 | def execute_time_script(): 56 | try: 57 | os.system("python3 time.py") 58 | except Exception as e: 59 | print(f"Script execution failed: {e}") 60 | latest_kernel_label.config(text=f"Script execution failed: {e}") 61 | 62 | def about(): 63 | tk.messagebox.showinfo("About", "This program was created by Kernel-Builder SIG.\nKernel versions are sourced from txt files in the current directory.") 64 | 65 | def update_window_size(event): 66 | window.update_idletasks() 67 | width = window.winfo_width() 68 | height = window.winfo_height() 69 | window_size_label.config(text=f"Window Size: {width} x {height}") 70 | 71 | window = tk.Tk() 72 | window.title("Get Latest Linux Kernel Version") 73 | window.geometry("1000x420") 74 | 75 | # Center the window 76 | center_window(window) 77 | 78 | # Logo 79 | logo_path = "image/LinuxKernelBuilder-logo.png" 80 | if os.path.exists(logo_path): 81 | logo = tk.PhotoImage(file=logo_path) 82 | window.iconphoto(True, logo) 83 | 84 | button_longterm = tk.Button(window, text="Get Latest Longterm Kernel Version", command=lambda: get_latest_kernel("longterm")) 85 | button_longterm.pack(pady=10) 86 | 87 | button_mainline = tk.Button(window, text="Get Latest Mainline Kernel Version", command=lambda: get_latest_kernel("mainline")) 88 | button_mainline.pack(pady=10) 89 | 90 | button_stable = tk.Button(window, text="Get Latest Stable Kernel Version", command=lambda: get_latest_kernel("stable")) 91 | button_stable.pack(pady=10) 92 | 93 | button2 = tk.Button(window, text="Execute script.sh", command=execute_script) 94 | button2.pack(pady=10) 95 | 96 | execute_button = tk.Button(window, text="Execute time.py script", command=execute_time_script) 97 | execute_button.pack(pady=10) 98 | 99 | latest_kernel_label = tk.Label(window, text="Latest kernel version: ") 100 | latest_kernel_label.pack(pady=5) 101 | 102 | current_kernel_label = tk.Label(window, text="Current kernel version: ") 103 | current_kernel_label.pack(pady=5) 104 | 105 | window_size_label = tk.Label(window, text="Window Size: 0 x 0") 106 | window_size_label.pack(side=tk.BOTTOM, pady=5) 107 | 108 | author_label = tk.Label(window, text="Author: Kernel-Builder SIG") 109 | author_label.pack(side=tk.LEFT, padx=10) 110 | 111 | source_label = tk.Label(window, text="Kernel version source: txt files in the current directory") 112 | source_label.pack(side=tk.RIGHT, padx=10) 113 | 114 | # Menu Bar 115 | menu_bar = Menu(window) 116 | window.config(menu=menu_bar) 117 | 118 | # About Menu 119 | about_menu = Menu(menu_bar, tearoff=0) 120 | menu_bar.add_cascade(label="About", menu=about_menu) 121 | about_menu.add_command(label="Info", command=about) 122 | 123 | # Bind window resize event 124 | window.bind("", update_window_size) 125 | 126 | window.mainloop() 127 | -------------------------------------------------------------------------------- /image/LinuxKernelBuilder-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XXTX-TOP/Linux-kernel_deb_builder/4eaf338bb5752fa14a9e44e4bd5600538ceba100/image/LinuxKernelBuilder-logo.png -------------------------------------------------------------------------------- /image/README/1689432126348.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XXTX-TOP/Linux-kernel_deb_builder/4eaf338bb5752fa14a9e44e4bd5600538ceba100/image/README/1689432126348.png -------------------------------------------------------------------------------- /install_kernel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XXTX-TOP/Linux-kernel_deb_builder/4eaf338bb5752fa14a9e44e4bd5600538ceba100/install_kernel -------------------------------------------------------------------------------- /install_kernel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace fs = std::filesystem; 8 | 9 | bool fileExists(const std::string& fileName) { 10 | return std::filesystem::exists(fileName); 11 | } 12 | 13 | int main() { 14 | // 执行 Python 脚本获取最新版本和 URL 15 | for (int i = 0; i <= 2; ++i) { 16 | std::string pythonScript = "python3 get-newest-version.py " + std::to_string(i); 17 | int pythonExitCode = system(pythonScript.c_str()); 18 | if (pythonExitCode != 0) { 19 | std::cerr << "Error: Failed to run Python script" << std::endl; 20 | return 1; 21 | } 22 | } 23 | 24 | // 从文件读取内核下载链接 25 | std::ifstream file("/tmp/longtermurl.txt"); 26 | if (!file.is_open()) { 27 | std::cerr << "Error: Unable to open /tmp/longtermurl.txt" << std::endl; 28 | return 1; 29 | } 30 | 31 | std::string kernelUrl; 32 | std::getline(file, kernelUrl); 33 | file.close(); 34 | 35 | // 获取下载文件名 36 | size_t lastSlash = kernelUrl.find_last_of('/'); 37 | std::string fileName = kernelUrl.substr(lastSlash + 1); 38 | 39 | // 检查文件是否已经存在 40 | if (!fileExists(fileName)) { 41 | // 文件不存在,进行下载 42 | // 下载内核源代码 43 | std::string downloadCommand = "curl -O " + kernelUrl; 44 | int downloadResult = system(downloadCommand.c_str()); 45 | if (downloadResult != 0) { 46 | std::cerr << "Error: Unable to download kernel source code" << std::endl; 47 | return 1; 48 | } 49 | } else { 50 | // 文件已经存在,输出提示信息 51 | std::cout << "Kernel source code file already exists: " << fileName << std::endl; 52 | } 53 | 54 | // ... 其余代码不变 ... 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /install_kernel2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace fs = std::filesystem; 8 | 9 | int compileKernel(const std::string& versionFolder, const std::string& versionFileName) { 10 | // 构建文件路径 11 | std::string fullPath = versionFolder + "/" + versionFileName; 12 | 13 | // 从文件读取内核下载链接 14 | std::ifstream file(fullPath); 15 | if (!file.is_open()) { 16 | std::cerr << "Error: Unable to open " << fullPath << std::endl; 17 | return 1; 18 | } 19 | 20 | std::string kernelUrl; 21 | std::getline(file, kernelUrl); 22 | file.close(); 23 | 24 | // 下载内核源代码 25 | std::string downloadCommand = "curl -O " + kernelUrl; 26 | int downloadResult = system(downloadCommand.c_str()); 27 | if (downloadResult != 0) { 28 | std::cerr << "Error: Unable to download kernel source code" << std::endl; 29 | return 1; 30 | } 31 | 32 | // 获取下载文件名 33 | size_t lastSlash = kernelUrl.find_last_of('/'); 34 | std::string fileName = kernelUrl.substr(lastSlash + 1); 35 | 36 | // 输出一些信息以便调试 37 | std::cout << "Downloaded kernel source code: " << fileName << std::endl; 38 | 39 | // 解压缩内核源代码 40 | std::string extractCommand = "tar -xvf " + fileName; 41 | int extractResult = system(extractCommand.c_str()); 42 | if (extractResult != 0) { 43 | std::cerr << "Error: Unable to extract kernel source code" << std::endl; 44 | return 1; 45 | } 46 | 47 | // 输出一些信息以便调试 48 | std::string kernelDir = fileName.substr(0, fileName.find_last_of('.')); 49 | std::cout << "Extracted kernel source code: " << kernelDir << std::endl; 50 | 51 | // 进入解压缩后的目录 52 | chdir(kernelDir.c_str()); 53 | 54 | // 拷贝启动目录到源代码目录 55 | system("cp -v /boot/config-$(uname -r) .config"); 56 | 57 | // 额外的配置命令 58 | system("scripts/config --set-str SYSTEM_TRUSTED_KEYS \"\""); 59 | system("scripts/config --set-str SYSTEM_REVOCATION_KEYS \"\""); 60 | system("scripts/config --undefine DEBUG_INFO"); 61 | system("scripts/config --undefine DEBUG_INFO_COMPRESSED"); 62 | system("scripts/config --undefine DEBUG_INFO_REDUCED"); 63 | system("scripts/config --undefine DEBUG_INFO_SPLIT"); 64 | system("scripts/config --undefine GDB_SCRIPTS"); 65 | system("scripts/config --set-val DEBUG_INFO_DWARF5 n"); 66 | system("scripts/config --set-val DEBUG_INFO_NONE y"); 67 | 68 | // 使用 CPU 核心数量进行并行编译 69 | int cpuCores = std::atoi(std::getenv("CPU_CORES")); 70 | std::string compileCommand = "sudo make bindeb-pkg -j" + std::to_string(cpuCores); 71 | int compileResult = system(compileCommand.c_str()); 72 | if (compileResult != 0) { 73 | std::cerr << "Error: Compilation failed" << std::endl; 74 | return 1; 75 | } 76 | 77 | // 安装当前目录下所有的 Debian 包 78 | for (const auto& entry : fs::directory_iterator(".")) { 79 | if (entry.path().extension() == ".deb") { 80 | std::string installCommand = "sudo dpkg -i " + entry.path().filename().string(); 81 | int installResult = system(installCommand.c_str()); 82 | if (installResult != 0) { 83 | std::cerr << "Error: Installation of Debian packages failed" << std::endl; 84 | return 1; 85 | } 86 | } 87 | } 88 | 89 | // 更新引导 90 | system("sudo update-grub"); 91 | 92 | return 0; 93 | } 94 | 95 | int main() { 96 | // 执行 Python 脚本获取最新版本和 URL 97 | for (int i = 0; i <= 2; ++i) { 98 | std::string pythonScript = "python3 get-newest-version.py " + std::to_string(i); 99 | int pythonExitCode = system(pythonScript.c_str()); 100 | if (pythonExitCode != 0) { 101 | std::cerr << "Error: Failed to run Python script" << std::endl; 102 | return 1; 103 | } 104 | } 105 | 106 | const std::vector versionFileNames = { 107 | "longtermurl.txt", 108 | "mainlineurl.txt", 109 | "stableurl.txt" 110 | }; 111 | 112 | for (const auto& versionFileName : versionFileNames) { 113 | int compileResult = compileKernel("/tmp", versionFileName); 114 | if (compileResult != 0) { 115 | std::cerr << "Error: Compilation failed for version: " << versionFileName << std::endl; 116 | return 1; 117 | } 118 | } 119 | 120 | return 0; 121 | } 122 | -------------------------------------------------------------------------------- /install_kernel3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace fs = std::filesystem; 9 | 10 | std::string find_kernel_directory(const fs::path& search_path) { 11 | for (const auto& entry : fs::recursive_directory_iterator(search_path)) { 12 | if (entry.is_directory()) { 13 | // 检查目录中是否有Makefile和Kconfig文件 14 | if (fs::exists(entry.path() / "Makefile") && fs::exists(entry.path() / "Kconfig")) { 15 | return entry.path().filename().string(); 16 | } 17 | } 18 | } 19 | return std::string(); // 如果没有找到,返回空字符串 20 | } 21 | 22 | int main() { 23 | std::string url; 24 | std::ifstream file("txt/longterm.txt"); 25 | 26 | // 从txt/longterm.txt中读取URL 27 | if (file.is_open() && std::getline(file, url)) { 28 | file.close(); 29 | 30 | // 使用wget下载文件 31 | std::string wget_command = "wget -q " + url + " -O kernel.tar.xz"; 32 | std::system(wget_command.c_str()); 33 | 34 | // 解压文件 35 | std::system("tar -xf kernel.tar.xz"); 36 | 37 | // 获取解压后的内核目录名 38 | std::string kernel_dir = find_kernel_directory("."); 39 | if (kernel_dir.empty()) { 40 | std::cerr << "Kernel directory not found." << std::endl; 41 | return 1; // 错误处理 42 | } 43 | 44 | // 进入解压后的目录并执行配置命令 45 | std::string config_command = "cd " + kernel_dir + " && " + 46 | "scripts/config --set-str SYSTEM_TRUSTED_KEYS \"\" && " + 47 | "scripts/config --set-str SYSTEM_REVOCATION_KEYS \"\" && " + 48 | "scripts/config --undefine DEBUG_INFO && " + 49 | "scripts/config --undefine DEBUG_INFO_COMPRESSED && " + 50 | "scripts/config --undefine DEBUG_INFO_REDUCED && " + 51 | "scripts/config --undefine DEBUG_INFO_SPLIT && " + 52 | "scripts/config --undefine GDB_SCRIPTS && " + 53 | "scripts/config --set-val DEBUG_INFO_DWARF5 n && " + 54 | "scripts/config --set-val DEBUG_INFO_NONE y"; 55 | std::system(config_command.c_str()); 56 | 57 | // 获取CPU核心数 58 | unsigned int numCPU = std::thread::hardware_concurrency(); 59 | unsigned int halfCPU = numCPU / 2; // 使用一半的CPU核心 60 | 61 | // 编译内核 62 | std::string make_command = "cd " + kernel_dir + " && " + 63 | "make -j" + std::to_string(halfCPU) + " bindeb-pkg"; 64 | std::system(make_command.c_str()); 65 | 66 | // 安装所有.deb包 67 | std::string install_command = "cd " + kernel_dir + " && " + 68 | "sudo dpkg -i ../*.deb"; 69 | std::system(install_command.c_str()); 70 | } else { 71 | std::cerr << "Unable to open txt/longterm.txt or read URL." << std::endl; 72 | return 1; 73 | } 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /installandremove.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | 4 | print('您输入的密码是', sys.argv[1]) 5 | print('内核:', sys.argv[2]) 6 | print('头文件:', sys.argv[3]) 7 | print('安装', sys.argv[4]) 8 | echo = subprocess.Popen(['echo',sys.argv[1]], 9 | stdout=subprocess.PIPE, 10 | ) 11 | if sys.argv[4] == 'install': 12 | sudo = subprocess.Popen(['sudo','-S','apt','install',sys.argv[2],sys.argv[3],'-y'], 13 | stdin=echo.stdout, 14 | stdout=subprocess.PIPE, 15 | ) 16 | else: 17 | sudo = subprocess.Popen(['sudo','-S','apt','purge',sys.argv[2],sys.argv[3],'-y'], 18 | stdin=echo.stdout, 19 | stdout=subprocess.PIPE, 20 | ) 21 | 22 | for line in iter(sudo.stdout.readline, b''): 23 | line = line.decode('utf-8') 24 | sys.stdout.write(line) 25 | sys.stdout.flush() 26 | 27 | sudo.wait() -------------------------------------------------------------------------------- /patch.d/redmi_book_air_13_acpi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # reduce ACPI_MAX_LOOP_TIMEOUT value 4 | sed -i "/ACPI_MAX_LOOP_TIMEOUT/s/30/3/g" include/acpi/acconfig.h 5 | 6 | # make kernel version to 5.xx.0 7 | sed -i '/SUBLEVEL =/s/[0-9].*/0/g' Makefile 8 | -------------------------------------------------------------------------------- /script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | current_time=$(date +"%Y-%m-%d %H:%M:%S") 3 | 4 | git config user.name "XXTXTOP" 5 | git config user.email "xxtxtop@gmail.com" 6 | 7 | # 追加当前时间到文件 8 | echo "$current_time" >> time.txt 9 | 10 | # 删除第一行 11 | sed -i '1d' time.txt 12 | 13 | 14 | git add *.txt create_file.sh get_latest_kernel.py script.sh time.py time.txt 15 | 16 | # 从time.txt文件中获取最后一行 17 | commit_message=$(tail -n 1 time.txt) 18 | 19 | # 设置GIT_EDITOR环境变量为"true",以避免打开编辑器 20 | export GIT_EDITOR=true 21 | 22 | # 提交代码并添加提交消息 23 | echo "$commit_message" | git commit -F - --no-edit 24 | 25 | # 推送提交到远程仓库 26 | git pull 27 | echo "$commit_message" | git commit -F - --no-edit 28 | git push 29 | # 检查git命令的返回状态 30 | if [ $? -eq 0 ]; then 31 | echo "Git push successful." 32 | else 33 | echo "Git push failed." 34 | fi 35 | -------------------------------------------------------------------------------- /time.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import time 4 | 5 | current_directory = os.getcwd() 6 | 7 | while True: 8 | subprocess.call([f'{current_directory}/script.sh']) 9 | time.sleep(5) 10 | -------------------------------------------------------------------------------- /time.txt: -------------------------------------------------------------------------------- 1 | 2023-07-11 16:42:33 2 | 2023-07-11 16:43:11 3 | 2023-07-11 16:43:49 4 | 2023-07-11 16:44:27 5 | 2023-07-11 16:45:05 6 | 2023-07-11 16:45:43 7 | 2023-07-11 16:46:21 8 | 2023-07-11 16:46:59 9 | 2023-07-11 16:47:37 10 | 2023-07-11 16:48:15 11 | 2023-07-11 16:48:53 12 | 2023-07-11 16:49:31 13 | 2023-07-15 18:30:47 14 | 2023-07-15 18:37:03 15 | 2023-07-15 18:39:15 16 | 2023-07-15 18:39:50 17 | 2023-07-15 18:40:26 18 | 2023-07-15 18:40:36 19 | 2023-07-15 18:41:44 20 | 2023-07-15 18:42:27 21 | 2023-07-15 18:43:03 22 | 2023-07-15 18:43:38 23 | 2023-07-15 18:44:14 24 | 2023-07-15 18:59:45 25 | 2023-07-15 19:00:29 26 | 2023-07-15 19:01:05 27 | 2023-07-15 19:01:40 28 | 2023-07-15 19:02:16 29 | 2023-08-04 22:30:03 30 | 2023-07-16 11:22:25 31 | 2023-07-16 11:23:02 32 | 2023-07-16 11:25:05 33 | 2023-08-04 22:31:33 34 | 2023-08-04 22:32:14 35 | 2023-08-04 22:32:54 36 | 2023-08-04 22:33:14 37 | 2023-08-16 20:40:20 38 | 2023-08-16 20:40:41 39 | 2023-08-16 20:42:02 40 | 2023-09-30 23:34:55 41 | 2023-09-30 23:37:56 42 | 2023-09-30 23:38:29 43 | 2023-10-01 14:33:10 44 | 2023-10-01 14:33:24 45 | 2023-10-01 14:33:36 46 | 2023-10-01 14:33:50 47 | 2023-10-01 14:34:05 48 | 2023-10-01 14:36:09 49 | 2023-10-01 14:36:24 50 | 2023-10-01 14:36:39 51 | 2023-10-01 14:36:53 52 | 2023-11-02 22:09:30 53 | 2023-11-02 22:09:44 54 | 2023-11-02 22:09:57 55 | 2023-11-02 22:10:11 56 | 2023-11-02 22:10:25 57 | 2023-11-11 22:48:59 58 | 2023-11-11 22:49:34 59 | 2023-11-11 22:49:47 60 | 2023-11-11 22:50:00 61 | 2023-11-11 22:50:05 62 | 2023-11-11 22:50:14 63 | 2023-11-11 22:50:15 64 | 2023-11-11 22:50:16 65 | -------------------------------------------------------------------------------- /txt/longterm.txt: -------------------------------------------------------------------------------- 1 | 6.6.71 -------------------------------------------------------------------------------- /txt/longtermurl.txt: -------------------------------------------------------------------------------- 1 | https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.71.tar.xz -------------------------------------------------------------------------------- /txt/mainline.txt: -------------------------------------------------------------------------------- 1 | 6.13-rc7 -------------------------------------------------------------------------------- /txt/mainlineurl.txt: -------------------------------------------------------------------------------- 1 | https://git.kernel.org/torvalds/t/linux-6.13-rc7.tar.gz -------------------------------------------------------------------------------- /txt/stable.txt: -------------------------------------------------------------------------------- 1 | 6.12.9 -------------------------------------------------------------------------------- /txt/stableurl.txt: -------------------------------------------------------------------------------- 1 | https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.9.tar.xz --------------------------------------------------------------------------------