[HowTo] OSS4 compilation on Mint 18 MATE LiveCD

OSS specific Linux discussion (x86/amd64)

Moderators: hannu, dev, cesium

igorzwx
Known Member
Posts: 1262
Joined: Sun Jun 28, 2009 9:31 pm

[HowTo] OSS4 compilation on Mint 18 MATE LiveCD

Postby igorzwx » Sat Jul 16, 2016 5:11 pm

oss4-toolkit_20160715.tar.gz
Patches & pulse-killer script
(1.84 KiB) Downloaded 1210 times

oss-linux-v4.2-2011-amd64.deb.tar.gz
for Mint 18 64bit, with "production quality"
(2.19 MiB) Downloaded 1149 times


Boot Linux Mint 18 MATE LiveCD

It can be downloaded here:
64bt _https://www.linuxmint.com/edition.php?id=220
32bit _https://www.linuxmint.com/edition.php?id=219

Set your keyboard preferences:

Code: Select all

$ mate-keyboard-properties


Remove PulseAudio

Code: Select all

$ sudo killall pulseaudio


Code: Select all

$ sudo apt-get purge pulseaudio
The following packages will be REMOVED:
  libcanberra-pulse* pulseaudio* pulseaudio-module-bluetooth*
  pulseaudio-module-x11*


Code: Select all

$ dpkg-query -W -f='${binary:Package}\n' | grep pulseaudio
gstreamer0.10-pulseaudio:amd64
gstreamer1.0-pulseaudio:amd64
pulseaudio-utils


Code: Select all

$ sudo apt-get purge gstreamer0.10-pulseaudio gstreamer1.0-pulseaudio pulseaudio-utils


Code: Select all

$ dpkg-query -W -f='${binary:Package}\n' | grep pulse
libpulse-mainloop-glib0:amd64
libpulse-mainloop-glib0:i386
libpulse0:amd64
libpulse0:i386
libpulsedsp:amd64
libpulsedsp:i386


Code: Select all

$ sudo apt-get install libcanberra-gstreamer ack-grep


Kill the sound applet:

Code: Select all

$ killall mate-volume-control-applet


Startup Applications [Choose what applications to start when you log in]:

Code: Select all

$ mate-session-properties


Startup Applications:
Volume Control
Command: mate-volume-control-applet
Package: mate-media

Download oss4-toolkit_20160715.tar.gz

Unzip it to your current working folder:

Code: Select all

$ find $HOME -name oss4-toolkit_20160715.tar.gz -exec tar -xvzf {} \; 2>/dev/null
oss4-toolkit/mubian/patches/01_linux-4.0.patch
oss4-toolkit/mubian/patches/series
oss4-toolkit/mubian/patches/02_linux-4.6.patch
oss4-toolkit/mubian/patches/03_ossvermagic.patch
oss4-toolkit/mubian/patches/04_gcc-5.patch
oss4-toolkit/mubian/pulse-killer.sh
oss4-toolkit/mubian/patches/
oss4-toolkit/mubian/
oss4-toolkit/


Code: Select all

$ cd oss4-toolkit


Run pulse-killer script:

Code: Select all

$ ./mubian/pulse-killer.sh
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  mint       4670 F.... pulseaudio
 
Killing process 4670 /usr/bin/pulseaudio --start
 
4670 /usr/bin/pulseaudio  – killed


Unload ALSA:

Code: Select all

$ sudo alsa force-unload
Unloading ALSA sound driver modules: snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-intel snd-hda-codec snd-hda-core snd-hwdep snd-pcm snd-seq-midi snd-seq-midi-event snd-rawmidi snd-seq snd-seq-device snd-timer (failed: modules still loaded: snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-codec snd-hda-core snd-hwdep snd-pcm snd-timer).


Code: Select all

$ sudo alsa force-unload
Unloading ALSA sound driver modules: snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-codec snd-hda-core snd-hwdep snd-pcm snd-timer.


Code: Select all

$ lsmod | grep snd
$ lsmod  | ack --count snd
0


ALSA modules were unloaded.

Install OSS4 Prerequisites:

Code: Select all

$ sudo apt-get install -y binutils libgtk2.0-0 sed gcc libc6
$ sudo apt-get install -y build-essential linux-headers-`uname -r` gawk libtool libgtk2.0-dev
$ sudo apt-get install -y libsdl1.2debian


Code: Select all

$ sudo apt-get install git quilt


Install gcc-multilib [for 64bit]:

Code: Select all

$ sudo apt-get install gcc-multilib


Download the OSS4 source code from git:

Code: Select all

$ git clone git://git.code.sourceforge.net/p/opensound/git opensound-git


Code: Select all

$ ls -1
mubian
opensound-git


Code: Select all

$ export QUILT_PATCHES=mubian/patches
$ export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"


Code: Select all

$ quilt series
mubian/patches/01_linux-4.0.patch
mubian/patches/02_linux-4.6.patch
mubian/patches/03_ossvermagic.patch
mubian/patches/04_gcc-5.patch


Code: Select all

$ uname -a
Linux mint 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


Code: Select all

$ ls -al /usr/bin/gcc
lrwxrwxrwx 1 root root 5 Feb 11 09:47 /usr/bin/gcc -> gcc-5


02_linux-4.6.patch is not needed

Code: Select all

$ quilt delete 02_linux-4.6.patch
Removed patch mubian/patches/02_linux-4.6.patch


Code: Select all

$ quilt series
mubian/patches/01_linux-4.0.patch
mubian/patches/03_ossvermagic.patch
mubian/patches/04_gcc-5.patch


Apply the patches:

Code: Select all

$ quilt push -a
Applying patch mubian/patches/01_linux-4.0.patch
patching file opensound-git/setup/Linux/oss/build/osscore.c
Hunk #1 succeeded at 1953 (offset 3 lines).
Hunk #2 succeeded at 1979 (offset 3 lines).
patching file opensound-git/setup/setupdir.sh

Applying patch mubian/patches/03_ossvermagic.patch
patching file opensound-git/os_cmd/Linux/ossvermagic/ossvermagic.c
Hunk #1 succeeded at 71 (offset -10 lines).

Applying patch mubian/patches/04_gcc-5.patch
patching file opensound-git/kernel/OS/Linux/os_linux.h
Hunk #1 succeeded at 109 (offset -10 lines).
Hunk #2 succeeded at 117 (offset -10 lines).
Hunk #3 succeeded at 125 (offset -10 lines).
Hunk #4 succeeded at 133 (offset -10 lines).

Now at patch mubian/patches/04_gcc-5.patch


OSS4 Resamplers:

Code: Select all

$ cat ./opensound-git/configure | grep GRC_M
GRC_MIN_QUALITY=3
GRC_MAX_QUALITY=3
export GRC_MIN_QUALITY GRC_MAX_QUALITY


Enable "Production quality":

Code: Select all

$ sed -i.bak -e 's/GRC_MAX_QUALITY=3/GRC_MAX_QUALITY=6/g' ./opensound-git/configure


Code: Select all

$ cat ./opensound-git/configure | grep GRC_M
GRC_MIN_QUALITY=3
GRC_MAX_QUALITY=6
export GRC_MIN_QUALITY GRC_MAX_QUALITY


Creating a Build Directory

Code: Select all

$ mkdir build
$ ls -1
build
mubian
opensound-git


Building OSS4

Code: Select all

$ cd build


Run this command:

Code: Select all

$ NO_WARNING_CHECKS=yes ../opensound-git/configure --enable-libsalsa=NO


Code: Select all

$ cat ./kernel/framework/include/local_config.h
/*
 * Automatically generated by the configure script (srcconf.c) - Do not edit.
*/
#define CONFIG_OSS_GRC_MIN_QUALITY 3
#define CONFIG_OSS_GRC_MAX_QUALITY 6
#define CONFIG_OSS_VMIX
#define CONFIG_OSS_VMIX_FLOAT
#define CONFIG_OSS_MIDI
#define OSS_CONFIG_OPTIONS "--enable-libsalsa=NO"


Code: Select all

$ make


Code: Select all

$ sudo make deb


Code: Select all

$ ls | grep deb
oss-linux-v4.2-2011-amd64.deb


Install OSS4:

Code: Select all

$ sudo dpkg -i oss*.deb
-----------------------------
Detected Intel High Definition Audio (PPT)
USB support available in the system, adding USB driver
Detected Generic USB audio/MIDI device (BETA)
-----------------------------

Forcing re-detection of installed soundcards
Starting Open Sound System
Processing triggers for man-db (2.7.5-1) ...


Code: Select all

$ sudo soundon
OSS is already loaded.


Run osstest:

Code: Select all

$ osstest


It should play a sort of music.

Resamplers:

Code: Select all

$ ossmix | grep vmix0-src
vmix0-src <Fast|High|High+|Production|OFF> (currently Fast)


Code: Select all

$ ossmix vmix0-src Production
Value of mixer control vmix0-src set to Production


Code: Select all

$ ossmix | grep vmix0-src
vmix0-src <Fast|High|High+|Production|OFF> (currently Production)


This thing is producing noise:

Code: Select all

$ ossmix | grep jack | grep input-mix
codec3.jack.green.input-mix-mut ON|OFF (currently OFF)


It should be muted:

Code: Select all

$ ossmix codec3.jack.green.input-mix-mut ON
Value of mixer control codec3.jack.green.input-mix-mut set to ON


See: _https://wiki.archlinux.org/index.php/Open_Sound_System#Microphone_playing_through_output_channels

This switch might be useful for testing your microphone. If you do not have such switch, you may run:

Code: Select all

$ ossrecord -vl - | ossplay -


or

Code: Select all

$ ossrecord -vl -d<devname> - | ossplay -


Code: Select all

$ ossinfo | grep "device index"
HD Audio play front               /dev/oss/oss_hdaudio0/pcm0  (device index 0)
HD Audio play rear                /dev/oss/oss_hdaudio0/pcm1  (device index 1)
HD Audio play center/LFE          /dev/oss/oss_hdaudio0/pcm2  (device index 2)
HD Audio play side                /dev/oss/oss_hdaudio0/pcm3  (device index 3)
HD Audio play pcm4                /dev/oss/oss_hdaudio0/pcm4  (device index 4)
HD Audio play spdifout            /dev/oss/oss_hdaudio0/spdout0  (device index 5)
HD Audio play spdifout            /dev/oss/oss_hdaudio0/spdout1  (device index 6)
HD Audio rec mix                  /dev/oss/oss_hdaudio0/pcmin0  (device index 7)
HD Audio rec mix                  /dev/oss/oss_hdaudio0/pcmin1  (device index 8)


"device index 7" means "/dev/dsp7" or simply "7" (it is my default mic).

Code: Select all

$ ossrecord -vl -d/dev/dsp7 - | ossplay -
Recording wav: Speed 48000Hz 16 bits Stereo
- [..        ] 2.00 secs VU ---       


Code: Select all

$ ossrecord -vl -d7 - | ossplay -
Recording wav: Speed 48000Hz 16 bits Stereo
- [....      ] 4.00 secs VU ----     


Code: Select all

$ ossrecord -i\?
$ man ossrecord


You may also need a mixer GUI:

Code: Select all

$ ossxmix &
$ ossxmix -b &


Add "ossxmix -b" to Startup Applications:

Code: Select all

$ mate-session-properties


See also:

Code: Select all

$ ossmix
$ ossinfo
$ ossinfo -v9


Code: Select all

$ lsmod | grep oss
oss_usb               116113  2
oss_hdaudio           152241  4
osscore               581591  4 oss_usb,oss_hdaudio


Code: Select all

$ man oss_hdaudio


Code: Select all

$ man ossinfo
$ man ossmix
$ man osspartysh
$ man ossphone
$ man ossplay
$ man ossrecord
$ man osstest
$ man ossxmix
$ man ossdevlinks
$ man savemixer
$ man vmixctl
$ man ossdetect



Adobe Flash plugin

Install the latest version of adobe-flashplugin
_https://get.adobe.com/flashplayer/

Code: Select all

$ find /usr -name libflashplayer.so -exec file {} \; 2>/dev/null
/usr/lib/adobe-flashplugin/libflashplayer.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped


Adobe Flash plugin is now 64-bit.

You can test the Adobe Flash Player on its home page (right click on video to see info):
_http://www.adobe.com/products/flashplayer

To force the Flash Player in YouTube (intead of HTML5 player), you can install the YouTube Flash Player extension for Firefox
_https://addons.mozilla.org/en-us/firefox/addon/youtube-flash-player/

Flash support in OSS4:

Code: Select all

$ ls -1 /usr/lib/oss/lib | grep flash
flashsupport.c
libflashsupport_32.so
libflashsupport_64.so


Code: Select all

$ ldconfig -p | grep libflashsupport
$ ldconfig -p | ack --count libflashsupport
0


Code: Select all

$ find /usr -name libflashsupport.so -exec file {} \; 2>/dev/null
/usr/lib/libflashsupport.so: symbolic link to /usr/lib/oss/lib/libflashsupport_32.so
/usr/lib32/libflashsupport.so: symbolic link to /usr/lib/oss/lib/libflashsupport_32.so


/usr/lib/libflashsupport.so should be re-linked to libflashsupport_64.so

Code: Select all

$ sudo rm /usr/lib/libflashsupport.so


Code: Select all

$ sudo ln -s /usr/lib/oss/lib/libflashsupport_64.so /usr/lib/libflashsupport.so


Code: Select all

$ file /usr/lib/libflashsupport.so
/usr/lib/libflashsupport.so: symbolic link to /usr/lib/oss/lib/libflashsupport_64.so


Code: Select all

$ sudo ldconfig


Code: Select all

$ ldconfig -p | grep libflashsupport
   libflashsupport.so (libc6,x86-64) => /usr/lib/libflashsupport.so
   libflashsupport.so (libc6) => /usr/lib32/libflashsupport.so


Restart browser.

Now it works.

igorzwx
Known Member
Posts: 1262
Joined: Sun Jun 28, 2009 9:31 pm

Re: [HowTo] OSS4 compilation on Mint 18 MATE LiveCD

Postby igorzwx » Sun Jul 31, 2016 12:01 am

OSS4 patches were imported from Arch Linux OSS4 package
_https://aur.archlinux.org/packages/oss
_https://aur.archlinux.org/packages/oss-git
_http://ossnext.trueinstruments.com/forum/viewtopic.php?f=3&t=5827#p21509

Code: Select all

$ git clone https://aur.archlinux.org/oss.git
$ git clone https://aur.archlinux.org/oss-git.git


Code: Select all

$ man quilt | grep -A28 "import \["
       import [-p num] [-R] [-P patch] [-f] [-d {o|a|n}] patchfile ...

           Import external patches.  The patches will be inserted following the current top patch, and must be pushed after import to apply them.


           -p num

               Number of directory levels to strip when applying (default=1)


           -R

               Apply patch in reverse.


           -P patch

               Patch filename to use inside quilt. This option can only be used when importing a single patch.


           -f  Overwrite/update existing patches.


           -d {o|a|n}

               When overwriting in existing patch, keep the old (o), all (a), or new (n) patch header. If both patches include headers, this option must be  specified.  This  option  is  only
               effective when -f is used.


There is also a Funtoo package of OSS4:
_http://www.funtoo.org/Package:Open_Sound_System_(OSS)
_https://github.com/funtoo/funtoo-media
_https://github.com/funtoo/funtoo-media/tree/master/media-sound/oss

Code: Select all

$ git clone https://github.com/funtoo/funtoo-media.git
$ ls
funtoo-media
$ find ./ -name oss -type d -exec cp -r {} ./ \;
$ ls -1
funtoo-media
oss
$ mv oss oss_funtoo_snapshot_20160730


Code: Select all

$ tree -FC oss*
oss_funtoo_snapshot_20160730
├── files/
│   ├── env.d/
│   │   └── 99oss
│   ├── gcc-5.patch
│   ├── init.d/
│   │   └── oss
│   ├── linux-4.6.patch
│   ├── oss-4.2.2011-linux-4.x.patch
│   ├── OSSlib.pc
│   ├── pax_kernel.patch
│   └── usb.patch
├── Manifest
├── oss-4.2.2011.ebuild
└── oss-4.2.2011-r1.ebuild

3 directories, 11 files


oss_funtoo_snapshot_20160730.tar.gz
OSS4 patches from funtoo-media git
(5.35 KiB) Downloaded 973 times

igorzwx
Known Member
Posts: 1262
Joined: Sun Jun 28, 2009 9:31 pm

Re: [HowTo] OSS4 compilation on Mint 18 MATE LiveCD

Postby igorzwx » Mon Aug 01, 2016 2:04 am

The OSS4 patches are open-source. They are not documented. Your freedom of choice is not restricted by the OSS wiki, or any "sacred text", or Holy Scriptures. All the patches are kosher and fit for use. If a patch does not help to fix a problem, you may try another one.

The method of "trial and error" was invented in the Stone Age. Although, it does not always produce the desired results, it is, perhaps, the most democratic method of problem fixing. It can be used by anyone. No special education or technical knowledge is required.

You can easily create your own patches through the help of quilt

Code: Select all

$ man quilt


See also: _https://wiki.debian.org/UsingQuilt

COMMENTS
_https://aur.archlinux.org/pkgbase/oss/?comments=all

keenerd commented on 2013-11-11 20:51

I'd want the nastiest remaining bugs fixed first.
The two major issues were 'soundon' and the uninstall script.
'soundon' would sometimes take several minutes to finish. (That was isolated to a single line in the soundon script, didn't look deeper.)
The uninstall script had become a complete mess - it was supposed to put the alsa drivers back into place as if nothing happened. Instead you'd have to reinstall the kernel and reboot.

toksik commented on 2013-11-14 18:53

The soundon issue seems to be easy to fix:
ossvermagic.patch

...the deletion of the alsa modules could as well be replaced by some file in /etc/modprobe.d/ that blacklists these modules.


ALSA is a sort of Trojan. It cannot be easily deleted or blacklisted.
To disable ALSA, you may also need to update "initramfs"
_http://kernel-handbook.alioth.debian.org/ch-initramfs.html#s-initramfs-gen-tools

Code: Select all

$ man update-initramfs
DESCRIPTION
       The update-initramfs script manages your initramfs images on your local
       box.  It keeps track of  the  existing  initramfs  archives  in  /boot.
       There  are three modes of operation create, update or delete.  You must
       at least specify one of those modes.

       The initramfs is a gzipped cpio archive.   At  boot  time,  the  kernel
       unpacks  that archive into RAM disk, mounts and uses it as initial root
       file system. All finding of the  root  device  happens  in  this  early
       userspace.


The so-called "initramfs images" are stored in the /boot folder.
They can be named "initrd.img-$(uname -r)", or "initramfs-linux.img", or else.
It depends on the Linux distro.

You can unzip your initramfs image to an empty folder and examine its contents
_http://kernel-handbook.alioth.debian.org/ch-initramfs.html#s-initramfs-exam

Code: Select all

$ mkdir crappix
$ cd crappix
$ zcat /boot/initrd.img-$(uname -r) | cpio -idmv


Code: Select all

$ find ./ -wholename "*/sound/*nd*"
./lib/modules/4.4.0-21-generic/kernel/sound/soundcore.ko
./lib/modules/4.4.0-21-generic/kernel/sound/soc/snd-soc-core.ko
./lib/modules/4.4.0-21-generic/kernel/sound/core/snd-timer.ko
./lib/modules/4.4.0-21-generic/kernel/sound/core/snd-compress.ko
./lib/modules/4.4.0-21-generic/kernel/sound/core/snd-pcm-dmaengine.ko
./lib/modules/4.4.0-21-generic/kernel/sound/core/seq/snd-seq-device.ko


How to blacklist a module on Ubuntu/Debian Linux
_https://linuxconfig.org/how-to-blacklist-a-module-on-ubuntu-debian-linux

There maybe a time when you need to disable some modules from being loaded during your system's boot time. In this "how to" we will discus some of the few ways how to blacklist module including its dependencies, that is, disable permanently module from loading during the boot time.

First, we need to know how to list all modules currently loaded by your Linux system:

Code: Select all

$ lsmod
....
ehci_hcd               40249  0
usbcore               128741  4 ehci_hcd,ohci_hcd,usbhid
usb_common             12354  1 usbcore
e1000                  86156  0
libata                140630  4 libahci,ahci,ata_piix,ata_generic
....


lsmod command lists all currently loaded kernel modules. The above lsmod output has been shortened. Let's say we are going to blacklist usbcore module. Before you unload or blacklist any module it is good to see what other modules depend on it:

Code: Select all

# modinfo -F depends usbcore
usb-common


From the above example we can see that usb-common module depends on usbcore. To blacklist a module without dependencies create a /etc/modprobe.d/blacklist.conf ( if non existing ) file and add line:

Code: Select all

blacklist usbcore


Once done update initramfs and reboot your system:

Code: Select all

# update-initramfs -u
# reboot


After reboot use lsmode to see whether module is present. In case that other modules are dependent on the module you are trying to blacklist, like in the above example, you will need to blacklist all dependent modules otherwise the initial module you have blacklisted would load anyway. Fortunately, there is a trick to blacklist all modules including their dependencies.

If from some reasons you are unable to blacklist modules and all its dependencies, make the module fail to load and thus also cause all dependent modules stop from loading. Add the following line to your /etc/modprobe.d/blacklist.conf to completely blacklist usbcore including all its dependent modules:

Code: Select all

install usbcore /bin/true


Update initramfs and reboot:

Code: Select all

# update-initramfs -u
# reboot


Just to be complete, please note that it is a good practice to create a separate module configuration file for each blacklisted module. For example if you wish to blacklist module e1000 than create separate /etc/modprobe.d/e1000.conf file.


Code: Select all

$ man true
       true - do nothing, successfully
       true [ignored command line arguments]


Code: Select all

$ man false
       false - do nothing, unsuccessfully
       false [ignored command line arguments]


On Ubuntu/Debian, the blacklisting of ALSA modules was already automatized:

Code: Select all

$ sudo dpkg-reconfigure linux-sound-base


Code: Select all

$ cat /usr/share/doc/linux-sound-base/README.Debian
The sound system can be selected by running:

    dpkg-reconfigure linux-sound-base

When ALSA is selected, all OSS modules are blacklisted for udev.
When OSS is selected, all ALSA modules are blacklisted for udev.


After blacklisting ALSA, you may want to examine the contents of initramfs

Code: Select all

$ lsinitramfs /boot/initrd.img-$(uname -r) | grep "soundcore\|snd"


and update initramfs (if needed).
_http://kernel-handbook.alioth.debian.org/ch-initramfs.html

Blacklisting kernel modules:
_https://wiki.archlinux.org/index.php/Kernel_modules#Blacklisting
_https://help.ubuntu.com/community/OpenSound#Blacklisting_ALSA_Kernel_Modules

Blacklisting ALSA modules and hacking the soundon script:
_http://ossnext.trueinstruments.com/forum/viewtopic.php?f=3&t=5204&p=19271

How to disable the removal of ALSA modules in the soundon script:
_http://ossnext.trueinstruments.com/forum/viewtopic.php?f=3&t=5801&start=15#p21194


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 11 guests