Mono and Windows Forms on Nokia N900? Sure, not a problem!

    I was somewhat surprised not to see mono in the repositories for this wonderful device. But, since it was desperately needed, I decided to collect it all the same. And then I ran into a very funny feature of the Maem SDK, which did not allow me to do this. But first things first. In the meantime, a small screen of what happened:
    image

    Instead of a normal emulator of the device and a toolchain for assembly, the guys from Nokia adapted the scratchbox for this business, which, using qemu-user, launches arm-binaries directly on the kernel of the current OS. And everything would be great if it worked as it should. In fact, during the build, qemu produces "unsupported syscall 242", after which the build stops. It is difficult to do anything with an ordinary cross-compiler here, because mono, in the best traditions of the bootstrap procedure (lifting oneself by the shoe laces), first compiles its compiler and with it takes it all the rest. How to deal with this is not very clear, if only compiled on the device, but there it will take years. For the N800 mono, some hero was able to assemble, but it refused to work on the n900, falling out with SIGSEGV. If anyone is interested in how this problem was solved,


    To begin, I will describe how to do it did not work . Nevertheless, an experiment was obtained and the information can be very useful.
    I won’t write about the SDK, a lot has been written about me installing and configuring it.

    Damn the first. Compile on the device.


    1. We put /etc/apt/sources.list in the following form:
      deb http_s_://downloads.maemo.nokia.com/fremantle/ssu/apps/ ./
      deb http_s_://downloads.maemo.nokia.com/fremantle/ssu/002 ./
      deb http_s_://downloads.maemo.nokia.com/fremantle1.2/ovi/ ./

      deb http_://repository.maemo.org/extras/ fremantle-1.3 free non-free
      deb http_://repository.maemo.org/extras-testing/ fremantle-1.3 free non-free
      deb http_://repository.maemo.org/extras-devel/ fremantle-1.3 free non-free

      deb http_://repository.maemo.org/ fremantle/sdk free non-free
      deb http_://repository.maemo.org/ fremantle/tools free non-free
      _ we remove from the links, it is there for the simple reason that the parser is a sucker, and does not even understand the code tag.
    2. We put build-essential, bison, gettext, m4
    3. ./configure && make && make install
    4. We realize that the process will take decades and we are looking for other ways


    Damn the second. Compile on the emulator.


    To get started, we need to pull out the uncropped rootfs itself. There are 2 ways. First, you can unzip the firmware with a flasher (flasher-3.5 -u -F IMAGE) and mount rootfs.jffs. Actually there are not jffs, but ubifs, by the way. I got here on this manual .

    You can also load the recovery system, as described here . There they use this image in order to move the sections, but we do not need it. Then in the internal console we do mount -t ubifs ubi: rootfs / mnt and merge everything onto a USB flash drive. A good backup method, by the way, is highly recommended.

    Further on the manual we make ourselves an image of ubuntu for qemu.

    In order to make life easier for yourself and get the opportunity to chroot into your arm environment, you will need the qemu-kvm-extras-static package. After installing / usr / bin / qemu-arm-static, we copy it to / bin of our system and chroot magically starts working. If anyone is interested in how this happens, they can read about binfmt_misc and other goodies that linux allows us to do. Theoretically, this can be started on the ubuntu x86 device in a chroot environment, and you can start wine in it. Although, most likely it will not work, because we come across all the same unsupported system calls.

    Mount, create the maemo directory, expand the image that you dubbed, then everything on the first pancake.

    As a result, during compilation, mcs started to crash with internal error and there was nothing I could do about it. Nevertheless, the build environment was obtained independent of the brittle scratchbox (which, in addition to everything else, is also only for i386 ).

    Finally a success!


    On the third day, the Vigilant Eye noticed that the barn had no wall. Namely: almost all mono are managed dlls, which absolutely all the same under what platform they are launched. As a result, the following plan has matured:

    1. Through apt-src install, we pull out the raw mono. At the same time, they are already laid out in packages so that it is convenient to put them later.
    2. We scoff at the contents of the directory with Debian assembly scripts so that all the files are in / opt (on Nokia there’s a very small rootfs, if anyone doesn’t know)
    3. We collect under amd64
    4. We collect platform-specific binaries in the chroot environment from p. 2 (errors got into scratchbox again, did not understand)
    5. We thoroughly scoff at packages, changing these binaries in them, correcting dependencies, inserting crutches


    Actually, the 4th step was facilitated by the presence of the option --disable-mcs-build, which Novell uncles specially invented for such cases. I will not describe the assembly process, this time (after 5 unsuccessful attempts!) It turned out to be very trivial.

    The packages and versions of the libraries in Maemo and on ubunt are somewhat different, so I had to get it. But it's worth it: I managed to transfer to the device a normal system of libraries scattered in packages (not yet completely, but I'm working on it) instead of the 260-meter tarball that is generated with ./configure && make. Actually, now mono ate about 27 meters / opt with a packet weight of 12. At the same time, almost all of .NET 2.0 is now available:
    System.dll, System.ServiceProcess.dll, System.Drawing.Design.dll, System.Transactions.dll, mscorlib.dll, System.Drawing.dll, System.EnterpriseServices.dll, System.Web.dll, System.ComponentModel. DataAnnotations.dll, System.IdentityModel.dll, System.Web.DynamicData.dll, Mono.Data.SqliteClient.dll, System.Configuration.dll, System.IdentityModel.Selectors.dll, System.Web.Extensions.Design.dll, Mono.Data.Sqlite.dll, System.Configuration.Install.dll, System.Management.dll, System.Web.Extensions.dll, System.Core.dll, System.Messaging.dll, System.Web.Routing.dll, System.Data.DataSetExtensions.dll, System.Runtime.Serialization.dll, System.Web.Services.dll, Mono.Messaging.dll, System.Data.dll, System.Security.dll, System.Windows.Forms.dll, System.Data.Linq.dll, System.ServiceModel.dll, System.Xml.dll, Mono.Security.dll, System.Design.dll, System.ServiceModel.Web.dll, System.Xml.Linq.dll


    You can install this miracle on your device by adding the following line to sources.list:
    deb http_://archive.kebrum.com/n900/ all main

    and installing the libmono-winforms2.0-cil package, which will pull everything else. Unfortunately, I haven’t transferred any packages yet, because it’s already 4 in the morning, but I’ll be sure to do it later (I also need to transfer gtk software).

    If someone wants to transfer their software from C # to N900 using this assembly, be sure to contact me so that I keep you updated on the latest developments.

    And do not judge strictly for spelling with punctuation, the night is in the yard, the eyes are red, I really want to sleep, and I barely get on the keys.

    UPD: With the help of crowbar and some kind of mother, GTK # was transferred (not yet all). Well, such a healthy piece of mono, necessary for the mono-devel package.

    Also popular now: