Post Installation SD Card Resizing for Raspberry Pi Running Arch Linux

If you install Arch Linux on your SD card you may notice you might not be using all of the storage space your SD card has to offer. In my instance I use a 16GiB card I was only using 1.5GiB of the 16GiB.

# df -h
Filesystem     Size Used Avail Use% Mounted on
/dev/root      1.5G 1.5G 51M   99%  /
devtmpfs       89M  0    89M   0%   /dev
tmpfs          93M  0    93M   0%   /dev/shm
tmpfs          93M  288K 93M   1%   /run
tmpfs          93M  0    93M   0%   /sys/fs/cgroup
tmpfs          93M  0    93M   0%   /tmp
/dev/mmcblk0p1 90M  25M  66M   28%  /boot
tmpfs          19M  0    19M   0%   /run/user/0

You can resize the partition online quite easily by using fdisk. Using the latest Arch Linux for RPi the root filesystem is mounted on mmcblk0p5 which is a logical partition within an extended one.

# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.24.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): d
Partition number (1,2,5, default 5): 
Partition 5 has been deleted.

Command (m for help): d
Partition number (1,2, default 2): 
Partition 2 has been deleted.

Command (m for help): n
Partition type:
 p primary (1 primary, 0 extended, 3 free)
 e extended
Select (default p): e
Partition number (2-4, default 2): 
First sector (186368-31116287, default 186368): 
Last sector, +sectors or +size{K,M,G,T,P} (186368-31116287, default 31116287): 
Created a new partition 2 of type 'Extended' and of size 14.8 GiB.

Command (m for help): n
Partition type:
 p primary (1 primary, 1 extended, 2 free)
 l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (188416-31116287, default 188416): 
Last sector, +sectors or +size{K,M,G,T,P} (188416-31116287, default 31116287): 
Created a new partition 5 of type 'Linux' and of size 14.8 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

At this point the partition table should be properly set-up to use the entire SD card. Reboot. The final step is to resize the filesystem to match the new partition size.

# resize2fs /dev/mmcblk0p5

Done.

Running ICS 4.0.4 on HTC N1

For those wanting to upgrade to the latest and greatest Android OS but are stuck with their Nexus One phone, there is light at the end of the tunnel. Thanks to Evervolv & Texasice, Ice Cream Sandwich is now running on N1 hardware. I upgraded my phone without a hitch and have been very satisfied since the upgrade, beside loving the new interface look & feel.

If you wish to enjoy the beauty of ICS on your N1, follow this link: http://forum.xda-developers.com/showthread.php?t=1366897

Converting Bluray to Matroska (MKV)

Since you may not want to spend over 300$ USD for a 25pk BD-R DL here’s how one can convert a Bluray to the well known Matroska format, bringing down the total size to 8.5GB. Of course, one may also just buy the Bluray… 😉

What you’ll need for this manual conversion guide:

  1. CUDA capable system
  2. Blu-ray Video and Audio Analysis Tool
  3. Demuxer
  4. AVC/MPG/VC1 Decoder and Frame Server
  5. AviSynth Frame Server
  6. H.264 Video Encoder
  7. Bluray Subtitle OCR Processor
  8. Matroska Muxer

First step is to find out where is the main movie inside the Bluray structure. Open up BDInfo and browse to the Bluray drive. Once scanning has completed you should be able to determine the main movie’s playlist by its length:

In this case, there are 2 playlist with the same length however they both link to the same stream so we’ll just use 00000.mpls.  Next is to extract the chapter timecodes so click on “View Report…” and scroll to your main playlist. Once there, scroll down a bit and you should see the chapters listing:

1               0:00:00.000     0:04:06.913     0 kbps          0 kbps          00:00:00.000    0 kbps          00:00:00.000    0 kbps          00:00:00.000    0 bytes         0 bytes         00:00:00.000
2               0:04:06.913     0:05:44.260     0 kbps          0 kbps          00:00:00.000    0 kbps          00:00:00.000    0 kbps          00:00:00.000    0 bytes         0 bytes         00:00:00.000
3               0:09:51.173     0:02:17.262     0 kbps          0 kbps          00:00:00.000    0 kbps          00:00:00.000    0 kbps          00:00:00.000    0 bytes         0 bytes         00:00:00.000
...

Copy/paste the chapters listing into a text file and put it aside for now. We’ll need it at the end during the muxing phase.

Now that we know which playlist to process we need to demux its linked stream. Open up tsMuxer GUI and add your main movie playlist file:

Now uncheck all the streams except for the video/audio/subtitles you’re interested in then under “Output” select “Demux” then set your output folder and click “Start demuxing”. Now is a good time to take a break as this may take some time.

Once everything is demuxed load DGIndexNV and open the video stream (may be saved as .264 or .vc1):

Next go to File -> Save Project and save your project as .DGI file. This may also take some time.

Now create a new AviSynth script that looks something like this:

LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\DGDecodeNV.dll")
DGSource("00115.track_4113.dgi")
Crop(0, 20, -0, -20)

In my case I used the “Crop” function to strip out tiny black borders. Be warned that if you also do so your DAR will be affected and will need to be adjusted accordingly. In my case it went from 1.78 (16:9) to 1.85 (24:13). Also, in order for DGDecodeNV to work you’ll need to fire up CUVIDServer.exe which comes with DGIndexNV.

Now is the time to re-encode the video stream. Use a bitrate calculator to find out the bitrate you should be using to fit this converted movie onto the media of your choice. I used this very basic calculator:

Next open up a command prompt to your output folder and launch the encoding. The encoding options are almost endless but I usually stick with standard profiles so in this case I opted for a high profile at level 4 and a 2-pass encode:

K:\9>x264.exe --profile high --level 4 --bitrate 12751 --pass 1 --output 00115.track_4113.dgi.avs.mkv 00115.track_4113.dgi.avs
K:\9>x264.exe --profile high --level 4 --bitrate 12751 --pass 3 --output 00115.track_4113.dgi.avs.mkv 00115.track_4113.dgi.avs

Depending on your hardware this may take quite a while especially for a 2-pass or more encode.

Next we need to take care of the subtitles. Open up SupRip and load your first (and maybe only) subtitle file (.sup):

Click on the first character in red and at the bottom type in the right text for that character and press enter to switch to the next missing character. Yes, this is a long process which may not suit your level of patience… Once done, switch to the “SRT” tab and review the final text then save to a .SRT file. Repeat for all other subtitles you want to keep (because of the process I usually tend to keep as least subtitles as possible).

We’re getting close now but there is one remaining task before we mux everything back, we need to set up the chapters. Open up mkvmerge GUI (mmg.exe) then switch to the “Chapter Editor” tab. Click Chapter Editor -> New Chapters and click “– (new chapter file)” in the “Chapters:” listbox then click “Add chapter”. Under “EditionEntry 1” click “(unnamed) [eng]” – this is your first chapter. At the bottom, click “(unnamed)” and enter a name for the chapter. Here I like to play the bluray menu and go to the chapters section to see all the chapter names then I use those names in the chapter editor.

For the timecodes, you’ll need that text file we saved at the beginning. Open that up and copy/paste the start/end timecodes in the corresponding “Start:” and “End:” boxes then click “Add chapter” again to create a new chapter. Repeat the process until you’ve managed to enter all the chapters you want to keep. You may also want to set the language/country by clicking the “Set values” button (if you click the root node first you can apply those values to all children quickly). Now save your chapters into an XML file by going to Chapter Editor -> Save as.

Finally we can setup everything to start muxing. Under the “Input” tab drag/add all your streams (in order: video, audio, subtitles). For each stream, click on it then at the bottom make sure to set as much information as possible from the first 2 tabs (“General track options”, “Format specific options”). I usually set the language, default track (default for video/audio and no for each subtitles), aspect ratio or display width and FPS. Under the “Global” tab, make sure to put in a “File/segment title” and load your chapters file then click “Start muxing”.

Enjoy the final result:

VMware Workstation 7 Released

VMware just released version 7 of their well known Workstation application. Here’s an interesting new feature many have been waiting for:

Aero Glass — A new Windows Display Driver Model (WDDM) graphics driver has been developed for Windows Vista and Windows 7 virtual machines. The WDDM driver can display the Windows Aero user interface, OpenGL 1.4, and Shader Model 3.0. For more information on the VMware recommended graphics hardware, see the VMware Workstation User’s Manual.

Full release notes can be found here.
Downloads are here.

Windows 7 x64 - VMware Workstation

Statically Linked Qt On Win32 Using MSVC

I have been trying to compile a statically linked version of Qt on Windows using MSVC for some time now but never found my way through until recently. There is a lot of information on the web about how to do this however I haven’t found one that actually worked for me (some information can be found on Trolltech’s website). So here’s yet another howto for using a static version of Qt with Visual Studio 2008!

What you need:

What you do (assuming VS2008 is already installed):

  1. Unpack the Qt sources. I used C:\Qt\4.5.3-win32-msvc2008 as target (%QTDIR%)
  2. If you have a multicore CPU you might want to speedup things by modifying %QTDIR%\mkspecs\win32-msvc2008\qmake.conf and adding those two lines (change 2 for the no. of CPUs you have):
    QMAKE_CXXFLAGS_RELEASE += -MP2
    QMAKE_CXXFLAGS_DEBUG += -MP2
  3. Next, open a Visual Studio 2008 Command Prompt (under the Start menu), go to %QTDIR% and run configure.exe with at least -static as option. I used the following (minimal build):
  4. configure.exe -debug-and-release -opensource -static -no-exceptions -no-accessibility -no-stl -no-qt3support -no-opengl -platform win32-msvc2008 -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -no-openssl -no-dbus -no-phonon -no-webkit -no-scripttools

  5. Once configured, start the build:
    nmake sub-src
  6. Install the Qt Visual Studio Addin
  7. In Visual Studio, under the Qt menu choose Qt Options. Under the Qt Versions tab click Add and type 4.5.3_win32-msvc2008 (or whatever you want) and fill in the path where you extracted the Qt sources
  8. Optionally you can test your installation by creating a new Qt Project, compiling it and running it.

Easy enough?! Happy Qt’ing!

UPDATE 15/10/2009: This also works with MS Visual Studio C++ Express Edition!

Organizing Your Files

I don’t know about you but I have files spread over multiple PCs since I use multiple PCs. Sometimes you simply don’t have time to transfer them over and find yourself missing a file and looking all over the place to find it.

Welcome Dropbox!  A very neat simple software that allows to automatically sync your files between multiple PCs. It also provides a website repository so you can share files with other people. I’ve been using it for some time now and find it very useful!

Check it out.

If you wish to join and don’t mind giving me credits for the referral, send me your email address and I’ll send you an invite. Referrals can help you gain more disk space online.