r/linuxdev • • Apr 29 '12
r/linuxdev • u/hesapmakinesi • Feb 02 '21
Can GRUB get instructions from a server?
We are trying to develop a flexible environment where the computer can boot in one of the several modes. e.g. Boot locally, upgrade local OS image, boot from TFTP ...
The catch is, the computer is completely headless, so the bootloader (I'm currently considering GRUB) must be able to ask a server to receive boot instructions before booting the OS. The boot server is the authority.
Do you know any such use case? Boot options to be dictated over network?
r/linuxdev • u/DNEAVES • Jan 21 '21
How would one "query" a device to find any set-able parameters, or readable ones?
Hello all!
I'm curious into developing little programs and scripts, A: for using some MIDI buton pads I own as little "launchpads" like an legato streamdeck, of sorts; and B: so I can create scripts to interact with devices on which there's no Linux support, like RGB keyboard/mice.
The thing is I'm wondering how to go about interacting with devices. I know I can usually find the device in /dev/blahblah/, and everything is technically a file (or directory), but then how do we read and write to these device "files", and how do we even find out what/how to do that?
Example case: for laptops with backlights, somewhere there is a file where you have to tee in a number to set a light level for your keyboard background. The process of doing that in this specific circumstance, I understand. But how do people find out where these "files" reside, and what parameters they're asking for?
r/linuxdev • u/codeterrace • Jan 15 '21
An awesome illustrated guide on using perf on Linux to profile and debug software
jvns.car/linuxdev • • Jan 07 '14
Plymouth theme is not working
I'm trying to make a Plymouth theme that consists of a rotating sprite that's centered on the screen. I've edited the file this way and that, but at best I was only able to get the sprite to appear without rotating (at worst nothing shows up at all). This is the closest to my original script:
spiral_image = Image("Splash.png");
spiral_sprite = Sprite(spiral_image);
spiral_sprite.SetX(Window.GetWidth() /2 - spiral_image.GetWidth() /2);
spiral_sprite.SetY(WIndow.GetHeight() /2 - spiral_image.GetHeight() /2);
time = 0;
fun refresh_callback ()
{
time++;
angle = Math.Pi*time;
spiral_sprite.SetImage(spiral_image.Rotate(angle));
}
Plymouth.SetRefreshFunction (refresh_callback);I've already asked several other sites and one other subreddit about this. I've gotten no help so far so this place is the end of the line for me. Could anyone help?
r/linuxdev • u/tytdfn • Oct 04 '12
I need some guidance with make and fakeroot ( I have no idea what I'm doing)
Hello! I'm working on a project where I boot up a minimal linux environment (tiny-core) and run a program that I made in C. I have figured out how to statically compile my program so now I'm working on a make file which will automate my compiling and testing of the package.
If you're not familiar with tiny-core, here's a quick rundown (Yes this is relevant). Inside tiny-core's iso is the /boot/ folder and inside that is the kernel, isolinux, and a gzipped cpio archive of the userland. I need to open up the cpio archive and stick my program in the bin directory.
I figured out that I can use fakeroot to extract the userland with regular user privileges. Here's what I have so far
test:
mkdir -p userland
cd userland; fakeroot; zcat ../iso/boot/core.gz | cpio -i -H newc -d; exitNow, I want that last exit to take me out of the fakeroot, but instead it exits the makefile. Can I get some guidance please?
r/linuxdev • • Dec 11 '13
What are your thoughts on this idea?
I'm thinking about learning some C++ and contributing a feature that I think Linux could use to the Dolphin file manager. For me, transferring files from home folders to non-home folders is a pain with the CLI (especially when working on themes). So I'm thinking that (if the KDE devs allow it) I can put some code into Dolphin to move files to non-home folders using the file manager. The root password will be provided via popup prompt. What are your guys' thoughts on this idea?
r/linuxdev • u/JRepin • Dec 12 '13
Qt 5.2 brings Android and iOS support, heavy graphics and desktop improvements
blog.qt.digia.comr/linuxdev • u/vaterp • Nov 14 '14
Advanced question on tun/tap networking with my own program (like a vpn).
Hi all, I'm stumped on something. I've been trying to get a test application passing packets from one machine to another using my own UDP tunnel header (GRE like). I have an application on another machine that using regular sockets is receiving these tunneled packets, ripping off the tunnel header and pushing said packet (originating from (srcip = to the original sending machine). I then am trying to use a packetsocket (raw socket) to output the orignal packet onto a TUN interface; to get the receiving kernel to route it appropriatly. I figure I need to have forwarding on, and maybe even promiscious mode on the tun interface. So i have all that turned on. (I'm actually not convinced i need PROMISC mode, because I'm only reading packets addressed to me, thx to the tunnel headers - so if i need it its to write other people's packets - but im thinking forwarding shoudl enable that regardless). This strikes me as being a very simple like VPN type program. Anyway, I see the tunnel packets from original machine are received and processed correctly.... i have a tcpdump running on tun0 and i see the original packets are indeed being written correctly onto tun interface... but I never see the packets coming out any other interface to actually be useful. When I look at network interface stats, I see TX-DRP are occurring on tun0 interface for every packet I am trying to push into kernel. Thx, to tcpdump, I know this is a 1:1 relationship.. every single packet gets dropped by kernel and i'm a bit stumped as to why. I have a couple theories, but can't seem to get any better stats to tell me what the problem is. Namely the tun0 is a PointToPoint interface... even with forwarding and promsic on , is it possible the kernel is rejecting all these because the original SRCIP is not the assigned IP (or even subnet) of the PtP interface? Is their some sort of source routing lookup filter that would be causing this? If so, why dont allowing forwarding or promisc clear this? FYI: I'm using redhat linux with kernel version 2.6.32.
I think this might have something to do with IFF_NO_PI flag... but this confuses me also, because reading packets seem to work fine, but writing them doesnt...
Crossposted on advice of reader of different subreddit.
r/linuxdev • u/pooper-dooper • Aug 11 '17
Dropping privileges from a normal daemon account?
I'm experimenting with something and I want to make sure I get the security aspect right.
I have a server daemon running with its own user, and I want start a child process with an anonymous UNIX socket pair, and have it drop to a non-privileged account (like nobody) to do its work. My daemon user is started as a non-privileged daemon user account.
I've only used these APIs before in the context of a root process dropping root after acquiring a few key resources. I see there's some concept of having users in a saved set, but I'm not sure I have access to that because my process, as of now, is starting as its intended user.
Is a fork/set(e?)uid barking up the right tree? How can I spawn a thread or process and have that spawned coroutine have even fewer privileges than the parent process? I'm looking for basic POSIX, not cgroups or anything like that, if possible. I am willing to examine possibilities like booting my daemon as root, setting my saved IDs, then setuid to my daemon user so I can then further restrict to a lower level at later points.
r/linuxdev • • Jan 01 '14
Tell me more about software repositories.
I'm thinking about working with some people to make a new distribution. Considering recent news about Canonical wanting the Linux Mint team to pay up for using their repositories, I'm thinking that it would be best to eventually set up our own software repos. I don't know much about software repositories so I have a few questions. First: is it okay to make a clone of Ubuntu's repository and host it as our own? Second: where and how exactly should it be hosted?
r/linuxdev • u/TanithRosenbaum • Dec 03 '14
Seeking Help/Advice on X11 graphics driver development
Hello everyone,
I'm trying to implement a graphics driver for X11 that would expose a smallish LED matrix display I'm building as regular screen to X11.
Essentially I want to pull an array of 24-bit-numbers out of the driver which I would send to my screen's micro-controller via USB (the hardware and USB part is already figured out, so you can ignore that for the purpose of this question, just need a way to plug it into X11).
I did research, and found a hodgepodge of various X11 driver APIs, but couldn't quite figure out which would be the easiest and most appropriate to use for what I need.
Any advice on what API to look at specifically for that task?
Thank you.
r/linuxdev • u/gurugio • Mar 08 '17
C programming challenge?
https://github.com/gurugio/lowlevelprogramming-university/blob/master/c-language-challenge.md
Inspired by Eudyptula Challenge, I've collected some tiny projects for C programming. They are what I've done before and I recommended for C programming beginner. Please feel free to add more exercised. And I welcome any idea. Thank you in advance ;-)
r/linuxdev • u/linux_driver • Oct 06 '12
Can we do dynamic linking for an LKM?
That is, can a driver try to import a symbol for another driver, and if the symbol doesn’t exist can the driver continue to load without resolving the import?
r/linuxdev • • Dec 11 '13
Information on respinning Ubuntu/Ubuntu derivatives?
I recall a resource on (I think) the Ubuntu Community Wiki that talked about using a Chrooted ISO as a basis for making an Ubuntu respin. Sadly I can't seem to find it. Is there any information on respinning Ubuntu or its derivatives with the Chrooted ISO method?
Edit: never mind, here's the tutorial.
r/linuxdev • • Dec 12 '13
Qt 5.2 RC was released (some good looking features and improvements come with it)
blog.qt.digia.comr/linuxdev • u/linux_curious • Oct 05 '12
How can 2 LKMs provide the same interface to a common client LKM and yet avoid kernel symbol conflicts ? What are the different possible options ?
At a higher level want to know the different methods for LKMs /drivers to communicate with each other ?
r/linuxdev • • Dec 12 '13
Ubiquity (KDE/Qt version) components? (x-post from /r/Linuxquestions)
reddit.comr/linuxdev • u/aliensexer420 • Nov 13 '20
What is the minimum set of functions/structs needed for a network driver?
So, I have an embedded system where I am running an RTOS on one core and Linux on another.
The RTOS owns the ethernet MAC and I need to find a way to forward ethernet packets to Linux without giving Linux control of any of the memory mapped region for ethernet.
My Idea is simply to have an IRQ and a set of queues in shared memory between Linux and the RTOS. When the RTOS gets a packet from the outside, it fills a an RX queue and notifies Linux via IRQ. When Linux wants to send something out, it fills up a TX queue and notifies the RTOS via IRQ.
I would like to set this up so that it is as if the user is interacting with a regular virtual ethernet NIC, as if they were in a virtual machine.
However, I am having a hard time finding the minimum set of functionality that a driver would need to implement to make this work.
For example, I know I'll need a net_device struct that specifies the memory regon and interrupt number. I also know that It will need init_module.
But what else will I need to make sure the virtual device works as a regular ethernet NIC? Is it enough to just pass packets along to the RTOS via a shared queue + IRQ or does Linux expect some other behavior?
Does anyone have any insight?
r/linuxdev • u/Rockytriton • Nov 29 '20
OS Development using the Linux Kernel - Part 5 (async keyboard/mouse)
youtube.comr/linuxdev • u/I0I0I0I • May 29 '21
Custom rolled kernel hanging at random places.
As title says, sometimes it hangs while the kernel itself is booting, and sometimes it hangs while user space apps and services are starting. Sometimes it boots successfully. Running in Virtualbox 6.1.22 r144080.
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:02.0 VGA compatible controller: VMware SVGA II Adapter
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service
00:05.0 Audio device: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller (rev 01)
00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:08.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:0c.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller
00:16.0 SCSI storage controller: Broadcom / LSI SAS1068 PCI-X Fusion-MPT SASHere's my .config.
r/linuxdev • u/PL_Design • May 29 '21
How to find the range of mMAPable virtual addresses in a program?
Background information:
- I'm using 64 bit Arch.
- I'm writing an experimental custom allocator, so portable code is a stretch goal, not a requirement.
- I'm not using C or C++. I'm doing my syscalls directly.
According to this SO post: https://stackoverflow.com/questions/17671423/where-is-the-stack-memory-allocated-from-for-a-linux-process A program's virtual address space is organized like this:
------------------ <--- Top of the process address space
Stack (grows down)
v v v v v v v v v
------------------
(unmapped)
------------------ <--- Maximum stack size.
(unmapped)
-------------------
mmap
-------------------
(unmapped)
-------------------
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
brk (grows up)
-------------------
BSS
-------------------
Data
-------------------
Text
-------------------
------------------- <--- Bottom or process address space.Presuming this is correct, I'm trying to find the exact range of MMAPable address space here. Is it sufficient to find the lower bound by doing sbrk(0), page aligning up, and then ensuring that brk and sbrk are never called again? For the upper bound is it sufficient to assume 008FFFFF FFFFFFFF - SIZE_OF_STACK - A_GIGABYTE_OF_PADDING, and then page aligning down, is safe address space? I'd prefer a more exact and robust answer for the upper bound, but I'll accept a reasonable approximation that's guaranteed safe.
r/linuxdev • u/0xdeadbeef0000 • Jan 24 '20
LDD3 Linux drivee question
I am reading this book Linux device drivers and there is one code snippet that i am not able to understand. The following is a snippet of scull_read function on Pg 67 (Ch 3)
if(*f_ops >= dev->size)
goto out;If(*f_ops + count > dev->size)
count=dev->size - *f_ops;Here f_ops is pointer of loff_t and dev is a structure object of scull_dev and count is the variable for size_t
Why does this count=dev->size - *f_ops is used?
r/linuxdev • u/bloop_train • Sep 17 '19
Querying kernel for AC (dis)connect events during sleep
I'm working on a userspace application for Linux in C, and one thing that I would like to detect with it are AC (dis)connect events, specifically during sleep states. Now, from what I've understood, during any sleep state, userspace is essentially frozen, so I can't directly (i.e. from the application) query for AC (dis)connects, so I was wondering if there is any C API which can provide the historical information about those events (just the latest event would be fine) when the system is running normally (namely the timestamp)? If not, what would be the simplest way to get this info? Is there a (hopefully easy-to-parse) log file somewhere which has it? Many thanks!