I was following this tutorial to try to add a system call to Linux, and I finished the section titled "Install the kernel", then rebooted the system. When it started back up, I got this message:
I am running Lubuntu 16.04 on VirtualBox. The only possible reason I could imagine in that the tutorial uses the linux 4.2.0 kernel, and I was using 4.4.0, but everything went fine until I rebooted the VM.
Could something as simple as using the 4.4.0 kernel instead of the 4.2.0 kernel done this? If so, what would I need to different from the tutorial to fix this?
Here is the steps the tutorial says to do (of course, I replaced 4.2.0 with 4.4.0 depending on the kernel I was using):
Install requirements:
sudo apt-get source linux-image-$(uname -r)
sudo cp -r linux-4.2.0 /usr/src
sudo apt-get update
sudo apt-get build-dep linux-image-$(uname -r)
sudo apt-get install kernel-package
sudo apt-get install libncurses-dev
Adding the system call:
cd /usr/src/linux-4.2.0
mkdir hello
Put the following in ./hello/hello.c:
#include <linux/kernel.h>
asmlinkage long sys_hello(void) {
printk(“Hello World!\n”); // printk prints the message to the kernels logs
return 0;
}
Put the following in ./hello/Makefile:
obj-y := hello.o
Update line 900 (line 916 for 4.4.0) of ./Makefile to look like this:
core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ hello/
Edit ./arch/x86/entry/syscalls/syscall_64.tbl and add this line after the last 64 bit syscall (on 4.4.0 it was call 326 not 323):
323 64 hello sys_hello
Add this line before the #endif in include/linux/syscalls.h:
asmlinkage long sys_hello(void);
Compile and install the kernel:
make menuconfig # accept default values
sudo make modules_install install
And finally, reboot, which is what causes the kernel panic on 4.4.0, but not 4.2.0.
Update:
I redid the tutorial on Lubuntu 15.10 which uses the 4.2.0 linux kernel, and it worked fine. So my question now is why does that tutorial crash the 4.4.0 kernel, but it works fine on 4.2.0?
Related
I had to reinstall ubuntu-14.04-64 due to reasons.
After this reinstall, when I try to build my android projets, I get a bunch of these lines (among others) in output:
java.io.IOException: Cannot run program "/home/gps/Android/Sdk/build-tools/23.0.2/aapt": error=2, No such file or directory
Now, I know this file exists in my setup because this:
gps#gps-HP-ProBook-4540s:~$ ls -l /home/gps/Android/Sdk/build-tools/23.0.2/aapt
-rwxrwxr-x 1 gps gps 1146608 Jan 4 18:47 /home/gps/Android/Sdk/build-tools/23.0.2/aapt
gps#gps-HP-ProBook-4540s:~$ file /home/gps/Android/Sdk/build-tools/23.0.2/aapt
/home/gps/Android/Sdk/build-tools/23.0.2/aapt: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=fc8aded5418584519d59f2133e81184fe3d4bdfd, not stripped
gps#gps-HP-ProBook-4540s:~$
I have installed all sdk tools from v19 onwards. Changing project settings to any of them shows same error.
Also, trying to execute the file directly gives same error:
gps#gps-HP-ProBook-4540s:~$ /home/gps/Android/Sdk/build-tools/23.0.2/aapt
bash: /home/gps/Android/Sdk/build-tools/23.0.2/aapt: No such file or directory
Can someone suggest a solution to this problem?
Problem solved as follows:
Issue was missing 32 bit libraries, libc and zlib in this case. Installed using following :
sudo apt-get install libc6:i386
sudo apt-get install zlib1g-dev:i386
Thanks #Joni for clear directions.
You're probably missing some dynamic link library that the program needs. Run this command to list the libraries it uses and install those that are missing:
ldd /home/gps/Android/Sdk/build-tools/23.0.2/aapt
Solution as of Ubuntu 16.04 / 16.10 to enable 32 bit binaries to run on 64 bit host
sudo dpkg --add-architecture i386
sudo apt-get -qqy update
sudo apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386
running a OpenCV-based code on Ubuntu, I incurred in the following error:
OpenCV Error: Unspecified error (The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support.
If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then
re-run cmake or configure script) in cvNamedWindow, file /home/opennao/src/OpenCV-2.3.1/modules/highgui/src/window.cpp, line 275
terminate called after throwing an instance of 'cv::Exception'
So I tried to install this libgtk2.0-dev by typing:
sudo apt-get install libgtk2.0-dev
but it returns the following:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem."
And this is what I did. But then, during the processing of the command request, the pc restarts on its own and the problem comes again when I run my code.
For the sake of clarification, I think it's worth saying that two weeks ago an update on Ubuntu corrupted my grub to choose the OS to run (there are Ubuntu 14.04 and Windows 10 on my pc), so I restored it through minimal-bash line editing.
Now, when I run "sudo dpkg --configure -a" I see that the last printed lines before restarting refer to some information about disk images or kernels that I rembember to have handled to fix the grub. I don't know if this can be a suggestion to understand the problem.
Thank you all for your support, ask me if you need further details.
Running lsb_release -s -d on the Jetson TK1 gives me Ubuntu 14.04 LTS
So I tried sudo apt-get install haskell-platform and sudo apt-get install ghc and with both I get an error that it is unable to locate the package. So I enabled the universe repository as I saw on a stackoverflow post for installing the haskell-platform for ubuntu 14.04. I still get the same result.
I see some people mentioning the got the haskell-platform to install on raspberry pis easily and that GHC now has good support for ARM but I don't see a way to get the install running on the Jetson TK1. My next option is to build from source, I don't see source for ARM architecture on the GHC or Haskell platform website.
I know there is also cross compiling, I will start messing with that when I see there is no easier way.
I managed to compile GHC7.8.3 on the Jetson K1 and Adapteva Parallella.
I wrote a blog post about it here which is more verbose, but here's a summarized rundown of what I did:
You will need GHC7.6.3 or earlier to bootstrap the compilation. I ran
sudo apt-get install ghc automake build-essential cabal-install groff
You’ll also need Alex and Happy, sudo apt-get install alex happy.
I also installed them in Cabal, cabal update && cabal install alex happy
I decided to compile with llvm, clang and gold linker, because gcc wouldn’t compile all the way.
sudo apt-get install llvm clang binutils
Edit mk/build.mk. I uncommented the line about quick-llvm compilation
BuildFlavour = quick-llvm.
You'll also need to replace appearances of -H64m with -H32m
perl boot and sudo ./configure --with-clang=/usr/bin/clang --with-ar=/usr/bin/ar
Because there is a linker issue, obtain the following script that will switch between standard ld and gold: https://gist.githubusercontent.com/bgamari/9399430/raw/build-ghc-arm.sh
chmod ugo+rx build-ghc-arm.sh
sudo /build-ghc-arm.sh -j6
sudo make install
I am trying to install the gnu arm toolchain for ubuntu. I first downloaded the tar from CodeSourcery. However when I go into the bin folder, I cannot run any of the binaries. I have tried with ./ and without and putting it in the PATH and it keeps telling me "Command not Found" yet the file is there in the folder right in front of me. Then I tried sudo apt-get install gcc-arm-linux-gnueabi except after it says it has installed successfully, I cannot find it with whereis gcc-arm-linux-gnueabi. Can anyone help?
fixed, using:
sudo apt-get install gcc-arm*
Are you compiling on a 64-bit OS? Try:
sudo apt-get install ia32-libs
I had the same problem when trying to compile the Raspberry Pi kernel. I was cross-compiling on Ubuntu 12.04 64-bit and the toolchain requires ia32-libs to work on on a 64-bit system.
See http://hertaville.com/2012/09/28/development-environment-raspberry-pi-cross-compiler/
CodeSourcery convention is to use prefix arm-none-linux-gnueabi- for all executables, not gcc-arm-linux-gnueabi that you mention. So, standard name for CodeSourcery gcc would be arm-none-linux-gnueabi-gcc.
After you have installed CodeSourcery G++, you need to add CodeSourcery directory into your PATH.
Typically, I prefer to install CodeSourcery into directory like /opt/arm-2010q1 or something like that. If you don't know where you have installed it, you can find it using locate arm-none-linux-gnueabi-gcc, however you may need to force to update your locate db using sudo updatedb before locate will work properly.
After you have identified where your CodeSourcery is installed, add it your PATH by editing ~/.bashrc like this:
PATH=/opt/arm-2010q1/bin:$PATH
Also, it is customary and very convenient to define
CROSS_COMPILE=arm-none-linux-gnueabi-
in your .bashrc, because with CROSS_COMPILE defined, most tools will automatically use proper compiler for ARM compilation without you doing anything.
if you are on 64 bit os then you need to install this additional libraries.
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
got the same error when trying to cross compile the raspberry pi kernel on ubunto 14.04.03 64bit under VM. the solution was found here:
-Install packages used for cross compiling on the Ubuntu box.
sudo apt-get install gcc-arm-linux-gnueabi make git-core ncurses-dev
-Download the toolchain
cd ~
git clone https://github.com/raspberrypi/tools
-Add the toolchain to your path
PATH=$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
notice the x64 version in the path command
I was also facing the same issue and resolved it after installing the following dependency:
sudo apt-get install lib32z1-dev
If you are on a 64bit build of ubuntu or debian (see e.g. 'cat /proc/version') you should simply use the 64bit cross compilers, if you cloned
git clone https://github.com/raspberrypi/tools
then the 64bit tools are in
tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64
use that directory for the gcc-toolchain.
A useful tutorial for compiling that I followed is available here Building and compiling Raspberry PI Kernel (use the -x64 path from above as ${CCPREFIX})
You have installed a toolchain which was compiled for i686 on a box which is running an x86_64 userland.
Use an i686 VM.
Its a bit counter-intuitive. The toolchain is called gcc-arm-linux-gnueabi. To invoke the tools execute the following: arm-linux-gnueabi-xxx
where xxx is gcc or ar or ld, etc
try the following command:
which gcc-arm-linux-gnueabi
Its very likely the command is installed in /usr/bin.
I had to cross compile C code in Ubuntu for ARM. This worked for me:
$ sudo apt install gcc-arm-none-eabi
Later, tested it on the qemu emulator
#Install qemu
sudo apt-get install qemu qemu-user-static qemu-system-arm
#Cross compile "helloworld.c"
$ arm-none-eabi-gcc --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group helloworld.c -o helloworld
#Run
qemu-arm-static helloworld
I'm trying to do this:
Build 32bit on 64 bit Linux using an automake configure script?
Doesn't work for me :(
Compileing wine. I found this in config.log:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Wine"
| #define PACKAGE_TARNAME "wine"
| #define PACKAGE_VERSION "1.5.19"
| #define PACKAGE_STRING "Wine 1.5.19"
| #define PACKAGE_BUGREPORT "wine-devel#winehq.org"
| #define PACKAGE_URL "http://www.winehq.org"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
Configuration fails with: Cannot build a 32-bit program, you need to install 32-bit development libraries.
apt-get install gcc-multilib libasound2-dev:i386 libgsm1-dev:i386 libjpeg8-dev:i386 liblcms2-dev:i386 libldap2-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libv4l-dev:i386 libx11-dev:i386 libxinerama-dev:i386 libxml2-dev:i386 zlib1g-dev:i386
and
apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgnutls26:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
got me past X error.
To build 32-bit wine on 64-bit machine, you can use LXC (Linux Containers) which is an operating-system-level virtualization environment for running multiple isolated Linux systems. It's the easiest solution so far, as Linux (such as Ubuntu or Debian) makes building 32-bit wine hard because the 64-bit system doesn't come with a full set of 32-bit development libraries (See: Bug #990982).
So the basic approach to compile both 32-bit and 64-bit wine is:
Build 64-bit wine
Build 32-bit tools in lxc
Build 32-bit wine in lxc, referring to the 64-bit wine and 32-bit tools 1. built in the previous steps
Install 32-bit wine
Install 64-bit wine
On the page Building Biarch (Shared WoW64) Wine On Ubuntu we can read the following instructions:
Install the 64-bit prerequisites:
sudo apt-get update
sudo apt-get build-dep wine
Build 64-bit wine:
mkdir $HOME/wine64
cd $HOME/wine64
../wine-git/configure --enable-win64
make -j4
Install lxc:
sudo apt-get install lxc
Create a 32-bit container named "my32bitbox" using the Ubuntu
template and bind your home directory to the /home directory in the
container:
sudo lxc-create -t ubuntu -n my32bitbox -- --bindhome $LOGNAME -a i386
Copy the apt configuration from the host to the lxc container:
sudo cp -R /etc/apt /var/lib/lxc/my32bitbox/rootfs/etc
Start the container; at the console login prompt it gives you, log
in with your username and password.
sudo lxc-start -n my32bitbox
Now you're inside the container, in your real home directory. If you
are not in the container (you do not have the prompt
username#my32bitbox), then open a new terminal and:
sudo lxc-attach -n my32bitbox
login yourusername+password
Now, you are in the container. Do an out-of-tree build of Wine as
normal, just to get the tools. You'll have to install all the needed
prerequisites first. For instance:
sudo apt-get update
sudo apt-get install python-software-properties git-core
sudo apt-get build-dep wine
mkdir $HOME/wine32-tools
cd $HOME/wine32-tools
~/wine-git/configure
make -j4
Still inside the container, do it again, this time pointing to the
64-bit build for data, and the 32-bit tools build for tools:
mkdir $HOME/wine32
cd $HOME/wine32
~/wine-git/configure --with-wine64=$HOME/wine64 --with-wine-tools=$HOME/wine32-tools
make -j4
Still inside the container, install the 32-bit wine to force the
last little bit of building:
cd $HOME/wine32
sudo make install
While still inside the container, shut it down:
sudo shutdown -h now
This drops you back out into your real machine. Next, you need to
remove all existing Wine packages. You can do this from the command
line but it's probably easier with aptitude or one of the GUI
package management tools. You will need wine-mono, wine-gecko, and
optionally winetricks for your compiled version of wine. However,
these packages may depend on the existing wine installation which
may force you to remove them.
Install the newly built wine into your real machine:
cd $HOME/wine32
sudo make install
cd $HOME/wine64
sudo make install
Warning: When you install a locally built version of Wine, the
package management system will not know it exists since it did not
come from a package. Thus it is possible to later break its
dependencies or install a conflicting version of wine without a
warning from the package management tools. You can prevent this by
creating a package or by blocking conflicting packages with
apt-pinning by setting "Pin-Priority: -1" for the packages.
Next, install Mono, Gecko, and optionally winetricks if you had to
remove their packages because of a dependency on a conflicting wine
package.
Notes:
Many of the above commands require root privileges. Your user account needs to have access to root via sudo or you need to switch to a user account.
It's not necessary to remove your distro version and 'install' your compiled versions (32bit, 64bit) You simply need to invoke your personal version of wine appropriate for the Windows app. For example: ~/wine32/wine32 ~/.wine/path_to_winapp/my_app.
What worked to some extent for me on Debian Wheezy:
dpkg --add-architecture i386
apt-get update
to enable installation from the i386 repos
apt-get install ia32-libs libc6-dev-i386 lib32z1-dev lib32bz2-dev
to install the 32 bit libs. I'm actually still having trouble with X libs:
configure: error: X 32-bit development files not found. Wine will be built
without X support, which probably isn't what you want. You will need
to install 32-bit development packages of Xlib/Xfree86 at the very least.
Use the --without-x option if you really want this.
but it's technically optional.
you may solve the X error:
sudo apt-get install xorg-dev
Don't do that. Wine builds for 32-bit by default even on 64-bit systems (since it has to run 32-bit Windows programs.) It also builds a 64-bit Wine at the same time. If you want to disable that, configure it with:
./configure --disable-win64
I guess you use Ubuntu x64 which now supports multi-architecture. In other words on a 64 bit system you can build only Wine-x64 version. Building 32bit Wine on Ubuntu 12.04 x64 seems to buggy as for now.
So just run:
./configure --enable-win64
The Wine wiki has an easy way to install the needed 32bit development libraries on a 64bit system, using chroot: http://wiki.winehq.org/WineOn64bit