Windows 7+VirtualBox with Linux (Ubuntu) development environment

Started by reddeercity, November 15, 2016, 07:08:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

reddeercity

                                                                                                                                                                        Edit: Update

Looking in to finally setting up a development environment for ML and since I have more PC's then Mac's I been looking at working under Windows 7 Pro .
Is this the best route for windows ? Re: Gettings started as developer
Something better ? Or would it be easier with Linux (Ubuntu) then would that be more alone the lines of a using a Mac platform ?

I figure it's about time I started to get deeper involved with ML code , hopefully I can help with some basic coding stuff , compiling etc.. .

Edit: Looks there my be something better , dfort started this Compiling Magic Lantern with Cygwin/MinGW-64 , I'll maybe give this a try .

tecgen

Quote from: reddeercity on November 15, 2016, 07:08:18 AM
...Something better ? Or would it be easier with Linux (Ubuntu) then would that be more alone the lines of a using a Mac platform ?

I would choose Ubuntu. It's pretty easy to setup for ML. It's much easier than on OSX or even Windows.
What about running Ubuntu within VirtualBox on your Win7 PC? You can share folders between your host OS and the guest OS within VirtualBox. That makes it easy to copy the compiled ML files to your CF or SD card.
Canon 5D Mark II, 50D, 550D/Rebel T2i, EF 40mm f/2.8 STM, Sigma 18-35mm f/1.8, EF 85 f1.8, EF 135 f2.8 SF, Zoom H2n

nikfreak

[size=8pt]70D.112 & 100D.101[/size]

reddeercity

Thanks @ nikfreak I'll check it out and give it a try .

reddeercity

Got Ubuntu VM running @nikfreak  :)  ,  is there a easy way to download the repository to Ubuntu  ?
or did I miss something alone the way ? I get "no repository" when I type "hg pull" 
I tried this but it seems I'm missing something or I haven't done something right .

QuoteQuick Guide HOWTO VirtualBox
11. Double click on Home (Top left)
12. Right-mouse click on magic-lantern and select open terminal here
13. Type hg pull
14.  When done type hg update

Maybe a different syntax , or if you can point me in the right direction that would great .
Sorry I'm new at this , taking my first baby steps with ML development environment
Thanks in advance  :D

Edit: Ok it look like I need to Create a BitBucket account , I didn't read Magic Lantern development on Windows - A detailed step-by-step-guide    :-[

reddeercity

Ok almost got things good to go , created a BitBucket account  downloaded the latest Magic Lantern sources
to my local ML Clone Ubuntu environment on VirtualBox/win7 laptop .
I do have a question if someone could answer , Magic Lantern development on Windows - A detailed step-by-step-guide says to
Quote[8] Erase all the content of the folder where you are into (magic-lantern), all but the file "makefile.user" that is optimized
    for the ubuntu environment and must be left alone and not deleted
[/s]
But in this clone of Ubuntu in the ML folder there was no "makefile.user" file , is this file still used or is there a update version.

Ok after looking at all the files I see there is the "makefile.user" file in the cloned source code.
I found that is was very confusing to read the Magic Lantern development on Windows - A detailed step-by-step-guide When I have some time and when I get this ML development environment working 100% and figure out how to do pull request etc... . I'll do a simple up to date tutorial for Ubuntu

DeafEyeJedi

Quote from: reddeercity on November 17, 2016, 06:50:04 AM
...I'll do a simple up to date tutorial for Ubuntu

Wonderful progress. Looking forward to it!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

dfort

Hi @reddeercity

I wrote up a few getting started compiling tutorials for Mac and Windows but Linux is actually the easiest once you have a Linux development environment setup. Basically you install the ARM cross compiler and clone the ML repository, both in your home directory and you're good to go.

I like using SourceTree and it might work for you if you're using Linux via a virtual machine but there are also some alternatives like Visual Studio Code, GitKraken and TortoiseGit. If you don't mind learning the command line Mercurial is actually quite powerful.

Pull requests are easy to do with the web interface in bitbucket. In fact you can do much of your development work on the web interface if you want and just sync to your local repository in order to compile it.

The Makefile.user file is sort of like your personal preference file for your development environment. It probably isn't necessary for a Linux setup. Just check out the Makefile.user.default and it will tell you what you need where. For example:

ARM_PATH=~/gcc-arm-none-eabi-4_8-2013q4

The tilde "~" is a shortcut for your home directory and the rest of it shows which compiler to download.

Perhaps the one tricky part is setting up a Windows cross compiler so you can build Windows binaries for the command line tools, mlv_dump and cr2hdr that you can run on a stock Windows installation.

If you want to contribute make sure you make a fork of the hudson/magic-lantern repository, create a new branch off of the unified branch (or whatever branch you want to submit to) and make sure you don't have any more commits than necessary when submitting your pull request.

Happy coding!

reddeercity

thanks @dfort  for the info . At the moment I having a compiling problem maybe I have something not right or configured wrong .
I'm getting a "make: *** No rules to make target '/Makefile.platform.map . Stop"

First I tried "make clean"
This what I get
ml@ml-pc:~/Magic Lantern /magic-lantern-mymodifications$ make clean
Makefile.setup:5: /home/ml/Magic: No such file or directory
Makefile.setup:5: Lantern: No such file or directory
Makefile.setup:5: /magic-lantern-mymodifications/Makefile.top: No such file or directory
Makefile:13: /Makefile.platform.map: No such file or directory
make: *** No rule to make target `/Makefile.platform.map'.  Stop.
ml@ml-pc:~/Magic Lantern /magic-lantern-mymodifications$


Then I tried the code sample from  nikfreak
"make -j2
cd platform
cd 6D*
make zip"

then I get this
ml@ml-pc:~/Magic Lantern /magic-lantern-mymodifications$ make -j2 cd platform cd 6D* make zip
Makefile.setup:5: /home/ml/Magic: No such file or directory
Makefile.setup:5: Lantern: No such file or directory
Makefile.setup:5: /magic-lantern-mymodifications/Makefile.top: No such file or directory
Makefile:13: /Makefile.platform.map: No such file or directory
make: *** No rule to make target `/Makefile.platform.map'.  Stop.ure what I missed

Yet all the file are there , not sure what I missed
Is there something missing in makefile.user.default file ?
this the content of that file
#User-defined values for ML build system
#Copy me to Makefile.user, keeping ONLY the options that you want to customize

UNAME:=$(shell uname)

ifeq ($(UNAME), Darwin)
# Variable declaration for Mac OS X
UMOUNT=hdiutil unmount
CF_CARD="/Volumes/EOS_DIGITAL"
STAT_CMD=stat -f "%N: %z bytes"
else
# Default settings for remaining operating systems
UMOUNT=umount
# CF_CARD=/media/EOS_DIGITAL
CF_CARD:=$(shell mount | grep -oE "[^ ]+/EOS_DIGITAL[^ ]*")
STAT_CMD=stat -c "%n: %s bytes"
endif

# change this if you have to mount the card every time you run "make install"
# examples:
# MOUNT_CARD=gvfs-mount -d /dev/mmcblk0p1
# MOUNT_CARD=gvfs-mount dav://192.168.0.1/
MOUNT_CARD=

# Experimental setup for Wi-Fi SD cards
# to enable, run this before "make install":
#    export WIFI_SD=y
# alternatives: "make install WIFI_SD=y", "WIFI_SD=y make install"
# override network names and IP address in Makefile.user
# fixme: how to enable it from Makefile.user?
ifeq ($(WIFI_SD),y)
  # fill in the name of your regular wifi network
  # leave this empty to disable wifi after installation
  WIFI_MAIN_NETWORK=<your regular wifi network>
 
  # these are for Toshiba FlashAir; you may have to change them for other wifi cards
  WIFI_CARD_NETWORK=flashair
  WIFI_CARD_IP=192.168.0.1
  CF_CARD=/run/user/1000/gvfs/dav:host=$(WIFI_CARD_IP),ssl=false
 
  # executed before installation
  # connect to WIFI_CARD_NETWORK if not already,
  # and mount card directory via WebDAV
  INSTALL_PREPARE=$(call build,WIFI_SET,\
    if !(nmcli conn show --active | grep $(WIFI_CARD_NETWORK)); then \
      while !(nmcli device wifi list | grep $(WIFI_CARD_NETWORK)); do \
        if [ `nmcli radio wifi` = disabled ]; \
          then nmcli radio wifi on; sleep 5; \
          else nmcli dev wifi rescan 2>/dev/null || true; sleep 2; \
        fi; \
        echo -n "."; \
      done; \
      nmcli conn up $(WIFI_CARD_NETWORK); \
    fi; \
    if !(gvfs-mount -l | grep "dav://$(WIFI_CARD_IP)/"); then \
      gvfs-mount dav://$(WIFI_CARD_IP)/ ; \
    fi; )
 
  # restore connection to your main wifi network
  # or just turn it off if you are using a wired network
  WIFI_RESTORE=$(call build,WIFI_END,\
    [ "$(WIFI_MAIN_NETWORK)" = "" ] && \
    (echo "Turning off Wi-Fi..." && nmcli radio wifi off) || \
    (echo "Connecting to $(WIFI_MAIN_NETWORK)..." && nmcli conn up $(WIFI_MAIN_NETWORK)))
 
  UMOUNT_CARD=$(call build,UNMOUNT,sleep 2 && gvfs-mount -u dav://$(WIFI_CARD_IP)/)
 
  # executed after installation
  define INSTALL_FINISH =
$(UMOUNT_CARD)
$(WIFI_RESTORE)
@echo "\nFinished.\nMake sure the camera will not write anything to the card until restart."
  endef
endif

# Supported camera models
SUPPORTED_MODELS:=50D 60D 550D 600D 500D 5D2 5D3 7D 650D 700D EOSM 1100D 6D

# Supported camera models for "UNIFIED" builds (Digic IV only)
SUPPORTED_UNIFIED_MODELS:=50D 60D 550D 600D 500D 5D2 1100D

# GCC-related stuff
# for yagarto or the official ARM toolchain use ARM_ABI=none-eabi otherwise use ARM_ABI=elf
ARM_ABI=none-eabi
GCC_VERSION=-4.8.3
DIETLIB_VERSION=0.33

NEWLIB_OPT_LEVEL=O3
DIETLIBC_OPT_LEVEL=Os

ARM_PATH=~/gcc-arm-none-eabi-4_8-2013q4
ARM_BINPATH=$(ARM_PATH)/bin
ARM_LIBGCC_PATH=$(ARM_PATH)/lib/gcc/arm-$(ARM_ABI)/$(subst -,,$(GCC_VERSION))
NEWLIB_PATH=$(SRC_DIR)/libs/arm-$(ARM_ABI)-$(NEWLIB_OPT_LEVEL)
DIETLIBC_PATH=$(SRC_DIR)/libs/dietlib-$(DIETLIB_VERSION)-$(ARM_ABI)-$(DIETLIBC_OPT_LEVEL)

# Static libraries used
ARM_LIBGCC_A=$(ARM_LIBGCC_PATH)/libgcc.a
NEWLIB_LIBM_A=$(NEWLIB_PATH)/libm.a
NEWLIB_LIBC_A=$(NEWLIB_PATH)/libc.a
DIETLIBC_A=$(DIETLIBC_PATH)/dietlibc.a

ML_LIBC = dietlibc.a newlib-libc.a newlib-libm.a gcc-libgcc.a

CROSS_COMPILE=$(ARM_BINPATH)/arm-$(ARM_ABI)-

ifeq ($(OS),Windows_NT)
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION).exe
else
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION)
endif

OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
AR=$(CROSS_COMPILE)ar
RANLIB=$(CROSS_COMPILE)ranlib
READELF=$(CROSS_COMPILE)readelf
LD=$(CROSS_COMPILE)ld
STRIP=$(CROSS_COMPILE)strip

#
# Host compiler settings
#
HOST_CC=$(shell which gcc)
HOST_LD=$(shell which ld)
HOST_AR=$(shell which ar)

# You can customize CFLAG here
HOST_CFLAGS=-g -O3 -W -Wall -fms-extensions -std=c99
HOST_LFLAGS=
HOST_LIBS=

# large file support
# you can also get them with $(shell getconf LFS_CFLAGS)
HOST_LFS_FLAGS=-DLARGEFILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64


#
# mingw cross compiler settings
#
MINGW=i686-w64-mingw32
MINGW_GCC=$(MINGW)-gcc
MINGW_AR=$(MINGW)-ar

MINGW_CFLAGS=-g -O3 -W -Wall -fms-extensions -std=c99 -m32
MINGW_LFLAGS=
MINGW_LIBS=
MINGW_LFS_FLAGS=-DLARGEFILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

#
# Additional binaries
#
CCACHE=ccache
GREP=grep
AWK=awk
PYTHON=python2
RST2LATEX=rst2latex.py

# Naming convention for Magic Lantern builds:
# General rules:
# - Always specify the camera and its firmware version number in the build name (e.g. 550d.fw109)
# - For non-release builds, specify the build date and author's (nick)name.
# - For experimental builds, add a short keyword indicating the particular feature tested.

# Examples for experimental builds:
# magiclantern-2010dec07.550d.fw108.cropmarks.a1ex.zip
# magiclantern-2010nov23.550d.fw108.selectable-audio.piers.zip

# Example for pre-release builds:
# magiclantern-2010dec17.550d.fw109.PRERELEASE.alex.zip

# Release builds:
# magiclantern-0.2.0.rc1.550d.fw109.zip
#~ VERSION=0.2.0.rc1.550d.fw109
BUILDVER=$(shell whoami).$(shell hg id -i -r .)
VERSION:=Nightly.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION)

# Build configuration - untested and debug stuff handy for devs
CONFIG_PTP          = n
CONFIG_PTP_CHDK     = n
CONFIG_PTP_ML       = n
ifndef CONFIG_GDB
CONFIG_GDB          = n
endif
CONFIG_GDBSTUB      = n
ifndef CONFIG_CONSOLE
CONFIG_CONSOLE      = y
endif
CONFIG_DEBUGMSG     = 0
CONFIG_CCACHE       = n
CONFIG_TCC          = y
CONFIG_MODULES      = y
CONFIG_TINYPY       = n

# Work in progress - would be nice to run the unmodified autoexec.bin in QEMU, but we are not there yet
# so, for now, we'll just hack the source code to work around the limitations of the emulator
CONFIG_QEMU         = n
CONFIG_QEMU_MENU_SCREENSHOTS = n

# Work in progress - load ML as position-independent code (PIC)
CONFIG_PIC          = n


Dose anyone see what I'm doing wrong .
Thanks :)

Edit: I'm using the pre-configured Ubuntu from here . I notice I didn't have the latest
extension installed , I'll install them and try again


nikfreak

try this as instructed:


cd ~/
mkdir test
cd test
hg clone -r unified https://bitbucket.org/hudson/magic-lantern
cd magic-lantern
cd platform
cd 6D*
make zip


You seem to have used uppercases and spaces (take a look at your posting. Before your slashes there are spaces!!!) whch probably caused your problem:
[size=8pt]70D.112 & 100D.101[/size]

reddeercity

Thank You  :D :D :D I got it to work as instructed , your right I didn't pay attention to space's and upper case lesson learned !

reddeercity

Now that I got my compiling computer up and running with Ubuntu under Win.7+VirtalBox , I made a Video Screen Capture of one of my PC's
On how to do a quick install & setup software to compile ml code to be executable on your camera .
It took least then 30 Min. from start to compiling code , took me that long just to read all the install instruction  ::)
So I wanted to show how really easy it is to get going and helping out or at least compile for your self , if you before
though it was to much for you . Hope this helps .


I'll Post this Video at the start or the thread , and I'll update anything I found to be helpful for compiling/coding with ml  :)
   

Igor_Braun

Quote from: nikfreak on November 18, 2016, 08:00:05 AM
try this as instructed:


cd ~/
mkdir test
cd test
hg clone -r unified https://bitbucket.org/hudson/magic-lantern
cd magic-lantern
cd platform
cd 6D*
make zip


You seem to have used uppercases and spaces (take a look at your posting. Before your slashes there are spaces!!!) whch probably caused your problem:

Hi! I'm trying to clone ML source files for 5d2 to the pre-configured Ubuntu from Reddeercity instructions from here:
https://youtu.be/mEbWIYYFLQ8?t=740

So my command for the terminal was:
cd ~/
mkdir test
cd test
hg clone -r unified https://bitbucket.org/hudson/magic-lantern
cd magic-lantern
cd platform
cd 5D2*
make zip

and getting the following error:
cd ~/
make: *** No rule to make target `zipcd'.  Stop.
ml@ml-pc:~/test$ mkdir test
ml@ml-pc:~/test$ cd test
ml@ml-pc:~/test/test$ hg clone -r unified https://bitbucket.org/hudson/magic-lantern
abort: error: _ssl.c:510: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
ml@ml-pc:~/test/test$ cd magic-lantern
bash: cd: magic-lantern: No such file or directory
ml@ml-pc:~/test/test$ cd platform
bash: cd: platform: No such file or directory
ml@ml-pc:~/test/test$ cd 5D2*
bash: cd: 5D2*: No such file or directory
ml@ml-pc:~/test/test$ make zip



My Virtual Box is 6.0.6 (5.1.8 one doesn't run well on my PC)
Could anybody explain me please why is it happening, and how can i copy ML source files?

PS: I'm new here and just would like to see the source code and make some minimal changes for me personally. If it works and i don't brick my cam l share it./

names_are_hard

Your download of the source didn't work, that's the "abort: error" message.  Can you download anything in the VM?  Does web browsing work?  You might not have networking configured right for the VM.

reddeercity

@Igor_Braun , since you are on windows 10 you can use the Compiling Magic Lantern on Windows 10 using its Linux subsystem too . Read this Getting started with development may help with issue's
But the easiest way is a VM , I use ver. 5.1.8 (I'm on win7) and I use the Scripts at the end of that post . I installed the latest Linux Ubuntu then ran the script to install toolchains & ML tools , I'm on Beaver 18.04 .

Igor_Braun

@names_are_hard, thanks for answering. Yes, browsing and downloading work properly

Igor_Braun