Kernel defconfig in buildroot (arm target) - linux-kernel

Debian 8 x64, buildroot 2016.02 / 2016-05-07 / 2016-05-13.
After make menuconfig and set some settings I run make. There is an error appears:
linux/linux.mk:424: *** No kernel defconfig name specified, check your
BR2_LINUX_KERNEL_DEFCONFIG setting. Stop.
This answer does not help: my arch/arm/configs/ folder does not exist in every release/snapshot I've tried. There is only arch folder with this content:
-rw-r--r-- 1 user user 11K May 12 19:21 Config.in
-rw-r--r-- 1 user user 176 May 12 19:21 Config.in.aarch64
-rw-r--r-- 1 user user 1.7K May 12 19:21 Config.in.arc
-rw-r--r-- 1 user user 15K May 12 19:21 Config.in.arm
-rw-r--r-- 1 user user 2.2K May 12 19:21 Config.in.bfin
-rw-r--r-- 1 user user 735 May 12 19:21 Config.in.m68k
-rw-r--r-- 1 user user 279 May 12 19:21 Config.in.microblaze
-rw-r--r-- 1 user user 2.1K May 12 19:21 Config.in.mips
-rw-r--r-- 1 user user 70 May 12 19:21 Config.in.nios2
-rw-r--r-- 1 user user 5.5K May 12 19:21 Config.in.powerpc
-rw-r--r-- 1 user user 693 May 12 19:21 Config.in.sh
-rw-r--r-- 1 user user 617 May 12 19:21 Config.in.sparc
-rw-r--r-- 1 user user 7.5K May 12 19:21 Config.in.x86
-rw-r--r-- 1 user user 1.5K May 12 19:21 Config.in.xtensa
I've tried to create arch/arm/configs/ folder and put there arch/Config.in.arm file (renamed to arm_defconfig/whatever) or empty file (renamed).
Whatever Kernel - Defconfig name I set, it does not helps.
make BR2_LINUX_KERNEL_DEFCONFIG also does not helps. Option is not documented in Buildroot user manual.
make linux-menuconfig returns same error if no Kernel - Defconfig name seted or
Can't find default configuration "arch/arm/configs/name_defconfig"!
where name is Kernel - Defconfig name variable. I've tried to set this to arm, BR2_LINUX_KERNEL_DEFCONFIG and many other names.
Can you help me, how to set default kernel configuration from buildroot developers?

The kernel defconfig is a configuration file in the kernel tree, not the buildroot tree. You have to look in arch/arm/configs in the kernel. Find the defconfig there that is appropriate for your target CPU. If you are not using an upstream kernel, you'll have to check with the vendor which defconfig to use. Remember to remove the _defconfig part of the name.
If you really have no idea at all, multi_v5 and multi_v7 are safe options: they include support for all possible processors with an ARMv5 resp. ARMv7 architecture.
You will probably encounter the same issue with the device tree. You can find the device trees (the .dts files) in arch/arm/boot/dts in the kernel tree. This one does have to match exactly with your board.

Related

Cannot give myself root my permissions

I am trying to give myself root access to all the file in this folder and not have to sudo everything I want to run a command.
The file I am concerned with is pro
When I enter ls -l I get :
drwxr-xr-x+ 12 Guest _guest 384 13 Jan 14:56 Guest
drwxrwxrwt 9 root wheel 288 13 Jan 14:30 Shared
drwxr-xr-x+ 148 Santi staff 4736 1 Apr 17:13 pro
then I enter chmod 775 pro/
It doesnt seem to change the permssions. What can I do to fix this or why is the folder restricting permission even though I appear to be root?
drwxr-xr-x+ ...
the final + means that the file is governed by acl
see
apropos acl : give you the mans to consult
wikipedia
Access Control Lists on Arch wiki

Bash - What is the best way to save the value of a quantity after the script has terminated?

I am attempting to write a script that changes my desktop wallpaper to the next picture in my ~\Picture\Wallpapers directory. I have already created a script, change_wallpaper, which can change my desktop background to any given picture.
My plan was to list all the pictures in ~\Picture\Wallpapers as an array, find the index i of the current wallpaper, and apply change_wallpaper to the i+1 element of the array of pictures. My only issue is finding a way to story the index of the current wallpaper. I could create a file which contains this value, but it seems really inelegant to just have a text file with the number 12, for example, saved somewhere in my home directory.
Is there a better way?
I agree with the general consensus of using a file to store the index of the current wallpaper. A slightly more elegant way would be to put a "." (dot) in front of the file name to keep it hidden in the directory where your script is located. Something like:
admin#myHost:/home/admin$ ls -la
total 6200
drwxrwxr-x 4 admin admin 4096 Jul 02 15:41 .
drwxr-xr-x 71 bin bin 4096 Jun 29 12:43 ..
-rw------- 1 admin admin 3939 Jun 29 16:02 .bash_history
-rw-r--r-- 1 admin admin 21 Nov 04 2014 .bashrc
-rwxr-x--x 1 admin admin 259 Oct 13 2014 .profile
-rw------- 1 admin admin 3939 Jun 29 16:02 .wallpaper_index
-rw------- 1 admin admin 3939 Jun 29 16:02 change_wallpaper
There are countless linux and unix applications that do this.

Detect Ubuntu device as a MIDI keyboard/Interface in Windows

I am creating a little experimentation application on my Odroid XU3 with Ubuntu 15.04 Lite.
http://dn.odroid.com/homebackup/201407071058089142.jpg
The device (Odroid) receives midi as input via a keyboard connected via one of the available USB Host ports (this part is OK) and sents some other midi instructions (also via USB, but USB OTG) to the computer to create harmony (this part is not ok).
The use case is :
you play on your midi keyboard some notes, the odroid received them, the embedded application code analyses them, find new notes (midi instructions) and send them to your Windows PC that you can root them to the VST of your choice.
The issue I have is that in order to achieve that, I need the Odroid device to appear as a MIDI keyboard in Windows that people can add the device in their Digital Audio Workstations.
Most of the midi controllers sold on the market have their own drivers but some are class compliant devices.
How can I make Windows detect this Odroid board an a midi keyboard? If I need to write a specific driver for that, from where to start?
Edit : Found g_midi drivers but not usb_f_midi
odroid#odroid:/lib/modules/3.10.72-23/kernel/drivers/usb/gadget$ ls -al
total 628
drwxr-xr-x 2 root root 4096 May 23 21:28 .
drwxr-xr-x 8 root root 4096 May 23 21:27 ..
-rw-r--r-- 1 root root 37544 May 23 21:11 g_acm_ms.ko
-rw-r--r-- 1 root root 17468 May 23 21:11 g_audio.ko
-rw-r--r-- 1 root root 24164 May 23 21:11 g_cdc.ko
-rw-r--r-- 1 root root 44488 May 23 21:11 g_ether.ko
-rw-r--r-- 1 root root 63552 May 23 21:11 g_ffs.ko
-rw-r--r-- 1 root root 16672 May 23 21:11 g_hid.ko
-rw-r--r-- 1 root root 37084 May 23 21:11 g_mass_storage.ko
-rw-r--r-- 1 root root 17468 May 23 21:11 g_midi.ko
-rw-r--r-- 1 root root 69752 May 23 21:11 g_multi.ko
-rw-r--r-- 1 root root 28164 May 23 21:11 g_ncm.ko
-rw-r--r-- 1 root root 35396 May 23 21:11 g_nokia.ko
-rw-r--r-- 1 root root 20944 May 23 21:11 g_printer.ko
-rw-r--r-- 1 root root 9016 May 23 21:11 g_serial.ko
-rw-r--r-- 1 root root 26628 May 23 21:11 g_webcam.ko
-rw-r--r-- 1 root root 11408 May 23 21:11 g_zero.ko
-rw-r--r-- 1 root root 25380 May 23 21:11 gadgetfs.ko
-rw-r--r-- 1 root root 45940 May 23 21:11 libcomposite.ko
-rw-r--r-- 1 root root 15244 May 23 21:11 u_serial.ko
-rw-r--r-- 1 root root 9972 May 23 21:11 usb_f_acm.ko
-rw-r--r-- 1 root root 8060 May 23 21:11 usb_f_obex.ko
-rw-r--r-- 1 root root 6928 May 23 21:11 usb_f_serial.ko
-rw-r--r-- 1 root root 14584 May 23 21:11 usb_f_ss_lb.ko
Second edit : Thanks to CL
Trying the g_midi driver
odroid#odroid:/proc/asound$ cat cards
0 [odroidaudio ]: odroid-audio - odroid-audio odroid-audio
1 [MPK225 ]: USB-Audio - MPK225 Akai MPK225 at usb-12110000.usb-1.2, full speed
2 [K61 ]: USB-Audio - Keystation 61 M-Audio Keystation 61 at usb-12110000.usb-1.3, full speed.
$ modprobe g_midi in_ports=1 out_ports=1
Error :
modprobe : ERROR : could not insert 'g_midi' : Device Or Ressource busy.
Same error with other ports (3,4, etc)
When removing the Midi keyboards :
odroid#odroid:/proc/asound$ cat cards
0 [odroidaudio ]: odroid-audio - odroid-audio odroid-audio
$ modprobe g_midi in_ports=1 out_ports=1
same error :
modprobe : ERROR : could not insert 'g_midi' : Device Or Ressource busy.
Just load the g_midi module:
$ modprobe g_midi in_ports=1 out_ports=1
(1 and 1 are the defaults.)
This will create a class-compliant USB MIDI interface, which is visible on the Odroid like a normal sound card:
$ cat /proc/asound/cards
0 [whatever ]: ...
1 [gmidi ]: MIDI Gadget - g_midi
MIDI Gadget
... and can be accessed with the normal Linux MIDI APIs.

Access GPIO (/sys/class/gpio) as non-root

The /sys/class/gpio can only be accessed as root by default. So I like that a new group gpio can use the files and directories under /sys/class/gpio. To achieve that I added the following lines to /etc/rc.local (I'm on Debian):
sudo chown root:gpio /sys/class/gpio/unexport /sys/class/gpio/export
sudo chmod 220 /sys/class/gpio/unexport /sys/class/gpio/export
So this gives write permissions to all the gpio group members. So they can now export and unexport pins fine.
The problem is they can't read/write the specific pin files after export (e.x. /sys/class/gpio/gpio17) beacause those are owned by root:root again.
How can I change that they are created by default as root:gpio too? I mean I can do that manually each time I export a pin. But that's a bit uncomfy.
UPDATE
According to larsks' answer I created the missing rule file. Now it partially works:
-rwxrwx--- 1 root gpio 4096 Jun 19 16:48 export
lrwxrwxrwx 1 root gpio 0 Jun 19 16:51 gpio17 -> ../../devices/soc/3f200000.gpio/gpio/gpio17
lrwxrwxrwx 1 root gpio 0 Jun 19 16:45 gpiochip0 -> ../../devices/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx--- 1 root gpio 4096 Jun 19 16:45 unexport
But for the ./gpio17/ I still get root:root:
-rw-r--r-- 1 root root 4096 Jun 19 16:52 active_low
lrwxrwxrwx 1 root root 0 Jun 19 16:52 device -> ../../../3f200000.gpio
-rw-r--r-- 1 root root 4096 Jun 19 16:52 direction
-rw-r--r-- 1 root root 4096 Jun 19 16:52 edge
drwxr-xr-x 2 root root 0 Jun 19 16:52 power
lrwxrwxrwx 1 root root 0 Jun 19 16:52 subsystem -> ../../../../../class/gpio
-rw-r--r-- 1 root root 4096 Jun 19 16:52 uevent
-rw-r--r-- 1 root root 4096 Jun 19 16:52 value
UPDATE 2
Okay I solved the problem. Because I installed Raspbian over the RaspbianInstaller I never went through the raspi-config tool. This seems to be a problem. Because I was also missing the /sys/device/virtual/gpio/ folder.
I followed this guide here: https://community.element14.com/products/raspberry-pi/f/forum/26425/piface-digital-2---setup-and-use#139528
And afterwards the permissions were correct (even for the pin-folders and their files value, direction, ...).
More common rule for 4.x kernels will be the following
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'find -L /sys/class/gpio/ -maxdepth 2 -exec chown root:gpio {} \; -exec chmod 770 {} \; || true'"
The rule in the initial answer will fail to chown the exported gpio if there's a symbolic link in the path
UPD please beg in mind that when you export some GPIO via sysfs, you should wait for udev rule to fire and complete before you get desired access rights. The thing that worked for me was sleep about 100ms before trying to access GPIO files.
You can do this using udev rules, which can define actions to execute when the kernel instantiates new devices. Current versions of the Raspbian distribution for Raspberry Pi devices contain the following in /etc/udev/rules.d/99-com.rules:
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio; chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio'"
This ensures that entries under /sys/class/gpio are always available to members of the gpio group:
# ls -lL /sys/class/gpio/
total 0
-rwxrwx--- 1 root gpio 4096 May 6 23:36 export
drwxrwx--- 2 root gpio 0 Jan 1 1970 gpiochip0
-rwxrwx--- 1 root gpio 4096 May 6 23:37 unexport
# echo 11 > /sys/class/gpio/export
# ls -lL /sys/class/gpio/
total 0
-rwxrwx--- 1 root gpio 4096 May 6 23:37 export
drwxrwx--- 2 root gpio 0 May 6 23:37 gpio11
drwxrwx--- 2 root gpio 0 Jan 1 1970 gpiochip0
-rwxrwx--- 1 root gpio 4096 May 6 23:37 unexport
Update
Permissions are correct for individual pins as well:
# ls -Ll /sys/class/gpio/gpio11/
total 0
-rwxrwx--- 1 root gpio 4096 May 6 23:37 active_low
drwxr-xr-x 3 root root 0 May 6 23:36 device
-rwxrwx--- 1 root gpio 4096 May 6 23:37 direction
-rwxrwx--- 1 root gpio 4096 May 6 23:37 edge
drwxrwx--- 2 root gpio 0 May 6 23:37 subsystem
-rwxrwx--- 1 root gpio 4096 May 6 23:37 uevent
-rwxrwx--- 1 root gpio 4096 May 6 23:37 value
Expanding on the answer by #roman-savrulin, here's a simpler version.
There's no need to run the rule on REMOVE events, only ADD events. There's also no need to run 'find' as the udev environment will supply the exact path of the sysfs directory containing the new GPIO pin's files. You can also use 'chgrp' to change only the owning group, and symbolic modes in 'chmod' to only add the group-write permission bit.
You'll still have to wait for the completion of the rule processing before trying to open the pin's files, but the process should complete more quickly with a simpler rule which only touches the minimum number of files necessary.
SUBSYSTEM=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chgrp -R gpio /sys/${DEVPATH} && chmod -R g+w /sys/${DEVPATH}'"
Check the groups you belong to:
userk#dopamine $: groups
userk sudo dialout
If you belong to dialout the following, if not, comment.
userk#dopamine $: ls -l /dev/gpiomem
crw------- root root /dev/gpiomem
This file mirrors the memory associated with the GPIO device. The output of the command means that the owner of the file is the root user and the group that "owns" it is the root group. The 10 characters represent the file type and the permissions associated with it. The current configuration allows the owner of the file to read and write to the file.
You want to be able to read and write that file if you want to control the gpios.
One option would be to modify the group owner and make it match with the one you belong to (dialout in my case) and set the permissions in order to allow all users of that group to read and write the file.
Long story short:
userk#dopamine $: sudo chown root:dialout /dev/gpiomem
userk#dopamine $: sudo chmod 660 /dev/gpiomem
Wait! This setting won't be persistent and will vanish after reboot.
See this post for further info about the topic
For Ubuntu run.
sudo apt install rpi.gpio-common

How to create drag and drop DMG file, Mac installer

Hi I have created an aplication myprogram.app file. Now I want to create Drag and drop DMG file for that application. Skype and other software does the same thing.
How to create Drag and Drop DMG file foe my application.
Thanks
Sunil Kumar Sahoo
It's actually pretty easy. You just need to compose some hidden files. Easy way to do this is to just copy someone elses and change to suit your app.
For example, if I mount the MonoDevelop DMG, then I see:
atom:MonoDevelop fak$ ls -al
total 40
drwxr-xr-x 8 fak staff 340 Nov 4 14:03 .
drwxrwxrwt# 10 root admin 340 Nov 10 21:33 ..
-rw-r--r--# 1 fak staff 12292 Nov 4 14:03 .DS_Store
d-wx-wx-wt 2 fak staff 68 Nov 4 14:03 .Trashes
drwxr-xr-x 3 fak staff 102 Nov 4 14:03 .background
drwx------ 4 fak staff 136 Nov 4 14:03 .fseventsd
lrwxr-xr-x 1 fak staff 13 Nov 4 14:03 Applications -> /Applications
drwxr-xr-x 3 fak staff 102 Nov 4 14:02 MonoDevelop.app
Here we see .background that is a directory with a PNG file (the background). The app itself (MonoDevelop.app) and a link to /Applications.
The .DS_Store contains the window size, icon positions, etc. Just setup a directory and use the .DS_Store from it.
There's really not any magic to this. You can create a disk image with Disk Utility. Put the stuff on it that you need, and then convert it to a compressed read-only image (again, with Disk Utility).
For some tips on prettying up the appearance of the window, check out this question. If you need to automate this process, check out this other question for some ways to do that.

Resources