Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
My irl name is Steve Yocto, inventer of Yocto Linux. I named it after myself, not very creative I know.

Anyhow, if you do a Linux I recommend Yocto Linux - it's the bees' nuts.

Poopernickel fucked around with this message at 22:27 on Nov 1, 2021

Adbot
ADBOT LOVES YOU

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Yocto's license management is legit if you want to make sure you're compliant and that your licenses don't change out from under you.

I like that I can set a "don't ever install gplv3" setting, and then be secure that it won't unless somebody intentionally forges license data on a package.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

DoomTrainPhD posted:

There has been a lot of discussion on how to implement this in Buildroot. It's a highly requested feature!
I have been poking at this kind of thing off and on for a while now!

Model it after Yocto's with some changes. Add a config option that enables a build step after patch. The step checks to see if a recipe's license hash matches the license hash in the source tree, to ensure the recipe info is still correct. Trust the recipe author to be accurate about the license name. Fail the step if the license matches a blacklisted value (or if it's not whitelisted). Make this different for host packages, where it generally doesn't matter.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
If you're a "gently caress it, the defaults are probably fine" kind of guy then Buildroot is your jam.

If you want to control everything then Yocto is what you want.

Yocto has a much steeper learning curve IMO and it takes more time to get started. But it's a lot more powerful. Sometimes that's the right tradeoff, sometimes not.

Also it has broad vendor support which is nice, because they can just ship a layer which will probably be a pain in the rear end for you to integrate.

Poopernickel fucked around with this message at 22:54 on Nov 1, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

I solved a similar problem (manage a build tool that manages its own deps) with some black fucken Yocto magic at my last job. I added a manually triggered recipe action that downloaded all deps using the custom tool, and then updated the .bb file's license and src_uri sections based on the result. The recipe action was called manually or by CI job whenever somebody wanted to update the package's contents.

It's nice having Python available to run arbitrary tasks, with full access to internal metadata. :)

Poopernickel fucked around with this message at 23:15 on Nov 1, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

hobbesmaster posted:

you know how every python installation is supposed to have certain modules available as part of the “core” language?

yocto doesn’t

agreed, splitting up the stdlib was a very questionable design choice on Yocto's part.

And by "questionable" I mean "dumb as hell"

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

Progressive JPEG posted:

i guess it depends on what made or didn't make the cut

like the tkinter stuff could probably be cut for example

a lot of the stdlib modules are split into different Yocto packages. Like if you just install "python3", you don't get some stdlib sections like multiprocessing, io, etc. Those all live in their own packages, or can all be installed with a meta-package called "python3-modules". Usually you find this out when you're working on some new Python script on-target, and then you find out that chunks of the stdlib are missing for no apparent reason.

Poopernickel fucked around with this message at 00:47 on Nov 2, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

Progressive JPEG posted:

btw how common is msdos in embedded environments these days

my most recent msdos experience was it controlling a building-sized telescope in 2007 or so. probably still trucking

pretty uncommon, Linux has mostly pushed it out.

I'm sure somebody's still rocking freedos on an industrial PC somewhere though.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

CRIP EATIN BREAD posted:

i never used any p-langs with yocto so i cant help

but built-in toolchain and debug symbol stripping made development/debugging suuuuuper easy

our application was just some kernel drivers and a c++ application, though.

This is controllable on a per-package basis in Yocto, if you ever find yourself having to deal with it again.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
the chip shortage is real, my friend

that said, digikey has a bunch of attiny parts in stock

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
No joke, I'm doing a Linux for a 10MHz CPU. Ten.

I rate the experience 0/10 would not do again.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
It's actually more usable than you'd think with a minimal kernel and a BusyBox rootfs. Target is an armv8 running in an emulator. RAM runs at a much faster clock rate.

Serial console is usable and feels "ok" but not great. Shell scripts are tolerable speed-wise. Boot time is around 90 seconds once the kernel has loaded.

Poopernickel fucked around with this message at 17:57 on Nov 2, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Yocto's bbappend/layer system is good, and Buildroot should emulate it. Make it easier for users to modify recipe behavior.

In today's world, you have to either:

1. jump through a bunch of hoops, or
2. fork Buildroot

if you don't like how a built-in recipe does something or other.

#2 is what I see most companies do, and it has a high long-term maintenance cost.

Adam Buildroot, make #1 easier for your users and minimize human suffering.

Do the needful T I A

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
As an example, I recently found a package that had a missing dependency when built with some config options.

My choices for how to add that dependency were:
1. Fork Buildroot just to add one missing dependency to a package.
2. Say "gently caress it who cares".
3. Dig into pkg-generic.mk to figure out what internal behavior I had to modify. Appending to ${PKG}_DEPENDENCIES doesn't work because it gets parsed during the recipe's call to pkg-generic.

Poopernickel fucked around with this message at 02:12 on Nov 3, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

DoomTrainPhD posted:

submit a patch upstream.

Cool, I guess that'll solve my today problem in 6 months when the next stable release comes out.

Poopernickel fucked around with this message at 02:54 on Nov 3, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Meanwhile in Yocto land, you can upstream your patch _and_ fix it locally for the release you're currently using via a bbappend.

Poopernickel fucked around with this message at 03:18 on Nov 3, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

DuckConference posted:

the only industry standard in embedded is that your poo poo is always different from everybody else in the industry.

Truuuuuuth son

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

sb hermit posted:

I see the reality of simply forking buildroot when a project starts, and keeping all development for a specific project on that fork, to be the industry standard. No one is going to update packages in the middle of development unless they're willing to spend a lot of real dollars to have qa go through all the testing, auditing, and qualification (not to mention pre-certification) steps when there's a material software change.

It would have likely been the same thing with yocto.

don't you have a raspberry pi running gentoo?

I worked on a product that took around 2 years to take to market. We upgraded Yocto versions shortly before beta. I had to bump three submodules, change a couple of config files, delete one .bbappend (fix got upstreamed), and tweak another. It took one workday. Yocto is great if you want to keep your customizations somewhere other than mixed with your upstream sources.

Poopernickel fucked around with this message at 05:41 on Nov 3, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

DoomTrainPhD posted:

In other news, I submitted a patch to bump OpenJDK 16 to 17 for Buildroot. This means Buildroot supports the last two LTS versions (11 and 17.) It's still crazy that the meta-java layer for Yocto still only supports 7 and 8 and kind of 14.

This is why community-provided and "maintained" recipes are bad. :v:

nothing stopping you from submitting a patch, my dude - there's no difference there. Just like in Buildroot land, it'll happen as soon as somebody wants it enough to do it. :)

Poopernickel fucked around with this message at 21:10 on Nov 4, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
just remember folks, the S in IoT stands for security

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

DoomTrainPhD posted:

And if I get hit by a bus then there's no core group of maintainers that will take over lol.

out of curiosity, what's your mental model of the yocto design team? It's pretty heavily funded by Intel and is part of the Linux Foundation.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Pretty much that, yeah. I'd love to use a BSD but the driver support is pretty lackluster

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
How do you folks package firmware updates? Swupdate? Or some competing/homeroll thing?

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
I do something similar usually. But how do you package the firmware for deployment? Just download a .img.gz? Do you ever have to deal with bootloader updates or extra support scripts?

I homerolled something similar to swupdate before I knew it existed, now I'm wondering what other solutions are out there.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

Phobeste posted:

oh, i take the image and zip up image, hashfile, hashfile sig and distribute that. on the shipping device it's a 384 meg image that zips down to about 100 which is basically the same size as the electron app lol.

This is essentially the problem that swupdate tries to solve, standardizing the way you package and install updates.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Never used QNX, but I've worked at two companies where somebody evaluated it and said "nah" for price and driver compatibility reasons.

It feels like Linux will displace it once PREEMPT_RT is all done being merged into mainline.

Poopernickel fucked around with this message at 21:12 on Nov 7, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Lol true, but it's Real Close This Time. The patch-set is growing smaller and smaller, and a bunch of prep work for it has been merged into mainline over the past few kernel versions.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Anybody ever try out Xenomai? I've been itching to experiment with it but never had a good opportunity yet

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

hobbesmaster posted:

a blackberry recruiter reached out to me with a job that’s actually decent pay for remote and my location but… does qnx have a future outside of automotive?

Nope. Don't make plans that expect it to be popular 3 years from now. Go for it if you don't give a gently caress about the company's long-term prospects.

Maybe RIM could make it work if they open-sourced it again and sold consulting services though.

Poopernickel fucked around with this message at 21:21 on Nov 7, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Just don't get paid in stonks unless you can sell them quarterly.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
This ain't stonk chat buddy!!! This is where we out-graybeard each other about our Linux janitoring

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

sb hermit posted:

Sure, just give me a beaglebone and I'll get right on it

:q:

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
agreed, systemd is a Good Thing on embedded systems.

It's a poo poo project maintained by the worst company imaginable (IBM), and easily 50% of it are bad and dumb things.

But the other 50% really kicks rear end, and systemd-init is miles above every competitor when it comes to making a good embedded system. Really nice to have an init system that can express things like:

- Service A can only run if service B running. Shut it down if Service B crashes.
- Service B depends on a USB device being present and active (such as a USB microcontroller that looks like a USB UART).
- Service A can't write to anything outside of /tmp, and can't exec anything.
- Service C and Service A share a common /tmp, but service B can't see it.
- Service C will get auto-restarted if it doesn't kick the watchdog every so often.
- Service C will restart up to 10 times with a 0.5 second delay before eventually giving up.
- Service A and all children can only run on CPU cores 5 and 6.
- Service B is granted setcap to change its own process priority, even though it's running as a non-root user.

Poopernickel fucked around with this message at 22:00 on Nov 10, 2021

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

sb hermit posted:

I'm just gonna make my main process be the init and install a kernel watchdog to hard reboot the system if poo poo happens

no room for systemd at that point, get that poo poo outta here

hope you don't like being able to log in with ssh or a serial-console

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

DoomTrainPhD posted:

perché non entrambe? Why not have a bash script call your app and then exec systemd?

jeezus that's the worst of every possible world, you'll have a mystery floating process that systemd isn't monitoring. And if it crashes, the kernel won't restart it like it does with PID1.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Been playing with qemu a bit over the past couple of days. The riscv emulator is surprisingly fast. Kernel boots to a login prompt in around 2 seconds.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
somebody should make a BSD that runs on Linux and call it Linux Subsystem for BSD (LSB for short)

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
that sounds nightmarish

ooc, why selinux instead of systemd sandboxing?

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

sb hermit posted:

selinux provides very very strong type enforcement of a ton of resources. So if you want to make sure that a constellation of apps only access certain files or directories, or if you want to enforce the ability to only listen to certain network ports, and so on, then selinux is the tool for you.

systemd does both of these things on a per-service basis and it's super easy

filesystem limiting: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#ReadWritePaths=
port limiting: https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html#SocketBindAllow=bind-rule

rather than go the selinux route, I've had really good luck with this approach:

1. run all network-accessible services as an unprivileged user
2. very limited setcap for things like changing process niceness
3. systemd sandboxing to enforce access control. Read access to /bin, /sbin, /usr/bin, /usr/sbin was blocked on all services except the firmware update service.
4. Read-only rootfs.
5. Noexec on all writeable paths.

6. For the firmware updater, put the root-needing parts into something you can wrap with passwordless sudo. Use a sudo policy that only lets the thing be launched in very specific ways, and let your non-root service launch it as-needed.

Steps 1-5 were all deadass easy with systemd. Also easy to maintain going forward.

Poopernickel fucked around with this message at 09:50 on Dec 10, 2021

Adbot
ADBOT LOVES YOU

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Afaik nobody's managed to hack that line of products, although admittedly the stakes are low if they do - just some stolen software unlocks and maybe some secret sauce binaries

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply