On August 25th, 2021, the Linux kernel celebrated its 30th anniversary. Since then, it's changed a lot. We changed too. Nowadays, the Linux kernel is a huge project used by millions. We checked the kernel 5 years ago. So, we can't miss this event and want to look at the code of this epic project again.
Development for Linux *
Developing for *nix
- New
- Top
- All
- ≥0
- ≥10
- ≥25
- ≥50
- ≥100
Creating and using your own deb repository (not mirroring)
Tested on the following configuration:
Server: ubuntu 20.04
Clients: ubuntu 16.04, 18.04, 20.04
It doesn’t require a lot of software to create it.
Finding Typos in the GTK 4 Project by PVS-Studio
You may have already read a recent article about the first PVS-Studio run and filtration of warnings. We used the GTK 4 project as an example. It's about time we worked with the received report in more detail. Our regular readers may have already guessed that this article will be a description of errors found in the code.
Configuring FT4232H using the ftdi_eeprom
The FT4232H is USB 2.0 High speed to UART IC converter. The FT4232H has four UART ports and one USB port.
By connecting EEPROM memory to this chip, you can set specific operating modes or change the manufacturer's data.
Let's look at the example and configure FT4232H directly on a system running GNU/Linux. We will do this using the ftdi_eeprom
.
Confusing extensions in Swift
Example with JSONDecoder
What would happen if we run the following piece of code?
struct Test<T>: Codable where T: Codable {
enum CodingKeys: String, CodingKey {
case value
}
let value: T
let info: String
}
extension Test {
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.value = try container.decode(T.self, forKey: .value)
self.info = "Default init(from decoder:)"
}
}
extension Test where T == String {
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.value = try container.decode(T.self, forKey: .value)
self.info = "Custom init(from decoder:)"
}
}
let data = #"{"value":"Hello, World!"}"#.data(using: .utf8)!
let object = try? JSONDecoder().decode(Test<String>.self, from: data)
print(object.debugDescription)
Try thinking for 5 seconds about the result.
Optional(
Test<String>(
value: "Hello, World!",
info: "Default init(from decoder:)"
)
)
Using kconfig for own projects
Intro
Every Linux professional write scripts. Someеimes light, linear. Sometimes complex script with functions and libs(yes, you can write your bash-library for use in other scripts).
But some of the scripts need a configuration file to work. For instance, I wrote a script that builds the ubuntu image for pxe, and I need to change the build process without build-script changes. The best way to resolve this task is to add configuration files.
Boot Ubuntu via http/ftp server with pxe(diskless boot)
Intro
PXE is a great solution for booting a diskless computer (or a computer without an OS installed). This method is often used for terminal stations and OS mass installation.
Stock ubuntu (16.04) in pxe-mode can mount rootfs only from NFS. But this is not a great idea: any difficulties with the network/NFS server and the user gets problems.
In my opinion, it's best to use other protocols, such as http/ftp. Once booting, you will have an independent system
How to find errors in a C# project working under Linux and macOS
PVS-Studio is a well-known static code analyzer that allows you to find a lot of tricky errors hidden in the source code. Beta testing of the new version has recently finished. It provides the possibility to analyze C# projects under Linux and macOS. The tool can also be integrated into the cross-platform IDE from JetBrains — Rider. This article will help you to get acquainted with these features using the example of checking the open source RavenDB project.
Single line code or check of Nethermind using PVS-Studio C# for Linux
This article coincides with the beta testing start of PVS-Studio C# for Linux, as well as the plugin for Rider. For such a wonderful reason, we checked the source code of the Nethermind product using these tools. This article will cover some distinguished and, in some cases, funny errors.
Porting packages to buildroot using the Zabbix example
The basics of porting
Originally, Buildroot offers a limited number of packages. It makes sense — there is everything you need, but any other packages can be added.
To add a package, create 2 description files, an optional checksum file, and add a link to the package in the general package list. There are hooks at different stages of the build. At the same time, Buildroot can recognize the needed type of packages:
How I fix cups-printing in Buildroot
Intro
Like I said earlier in previos articles, Buildroot is a great system for embedded Linux development. But sometimes strange things can happen.
Once upon a workday, I got the following task: add printing system in firmware (Kraftway terminal Linux next generation). Ok, so I had to add cups + cups filter and to build firmware. I set a postscript-printer and got an error "Filter failed". Trivial tasks turned into serious work.
In this article, I wrote my own way of solving this problem. It may be useful for other developers and IT-specialist and, also, for a deeper understanding of the Buildroot.
If you are a Buildroot beginner, I recommend reading my previous articles.
Update 1 may 2020
Revisioned versions of this patches applied to master.
Beta testing of the PVS-Studio C# analyzer on Linux and macOS
More and more users of the PVS-Studio C# analyzer get interested in the possibility to utilize it for checking C# code on Linux and macOS. Today we have some good news.
buildroot — my own experience with multi-platform distro creation
Introduction
In my previous article (Monitor linux) I wrote, what is this distro and how it works. Now i will write how to do it. It's may be interesting for everyone, who want to study buildroot.
Target goals
The result we get from article is the following:
- Firmware (non-volatile image with restorable config)
- Easy management via web-interface
- Cross-platform (qemu x86_64, arm-based SBC like rasberry 4, beagle bone black and asus tinker board)
- Support without extra effort
Monitor linux — cross platform firmware with zabbix server
About
This is small cross-platform linux-distro with zabbix server. It's a simple way to deploy powerful monitoring system on ARM platfornms and x86_64.
Worked as firmware (non-changeable systemd image with config files), have web-interface for system management like network settings, password and other.
Who is interested
- System admins/engineers who need to fast deploy of zabbix server.
- Everyone, who want to deploy zabbix on ARM.
- Enthusiasts
A Brief Comparison of the SDS Architectures for Virtualization
The search for a suitable storage platform: GlusterFS vs. Ceph vs. Virtuozzo Storage
This article outlines the key features and differences of such software-defined storage (SDS) solutions as GlusterFS, Ceph, and Virtuozzo Storage. Its goal is to help you find a suitable storage platform.
Gluster
Let’s start with GlusterFS that is often used as storage for virtual environments in open-source-based hyper-converged products with SDS. It is also offered by Red Hat alongside Ceph.
GlusterFS employs a stack of translators, services that handle file distribution and other tasks. It also uses services like Brick that handle disks and Volume that handle pools of bricks. Next, the DHT (distributed hash table) service distributes files into groups based on hashes.
Note: We’ll skip the sharding service due to issues related to it, which are described in linked articles.
When a file is written onto GlusterFS storage, it is placed on a brick in one piece and copied to another brick on another server. The next file will be placed on two or more other bricks. This works well if the files are of about the same size and the volume consists of a single group of bricks. Otherwise the following issues may arise:
Writing a laptop driver for fun and profit, or How to commit to kernel even if you're not that smart
Where it all began
Let’s start with our problem statement. We have 1 (one) laptop. A new, gamer laptop. With some RGB-backlight on its keyboard. It looks like this:
Picture taken from lenovo.com
There’s also a program installed on this laptop. That’s the thing that controls our backlight.
One problem – the program runs under Windows, and we want everything to work on our favourite Linux. Want LEDs to flash and those pretty colours to blink on and off and such. A natural question arises, can we do all that without reverse-engineering and writing our own drivers?
A natural answer arises, no. Let’s open IDA and get cracking.
Cool WSL (Windows Subsystem for Linux) tips and tricks
Look at all this cool stuff you can do when you mix your peanut butter and chocolate!
Apply Nix-Shell environment in Visual Studio Code
A lot of developers faced a problem with packages hell on their workstation. After a couple of months with experiments, including different languages and toolchains, I installed Elixir, Haskell-stack, Node.js/NVM, and other various stuff. Most exciting things happen when you need different versions of the same package for different projects. Humanity already invented a different solution for creating an isolated environment and switch them when needed. We are using NVM to manage Node.js versions, Python Virtual Env for selecting Python stuff versions or Docker for creating OS inside an OS. But none of the solutions satisfy all my requirements for the isolated development environment.
Stylish Avalonia
Regular Avalonia
In this article we will see how you can wrap Regex in cross-platform graphics and create a simple application for testing regular expressions.
Authors' contribution
-
dlinyj 838.6 -
Seleditor 640.0 -
Andrey2008 636.2 -
m1rko 537.2 -
maisvendoo 425.0 -
olegator99 335.0 -
redhatrussia 309.0 -
saipr 263.0 -
it_man 256.0 -
temujin 251.0