Jan 132014
 

 

  • fixed: remoteport=4011 when srcport=4011 -> was preventing some ipxe client to boot (uefi for exemple)
  • changed: opt60=empty by default when using opt67 (was ‘PXEClient’ before) -> was preventing ipxe client to boot with opt67
  • changed: opt60=’PXEClient’ when proxydhcp=1 (was hardcoded before) -> more flexible
  • fixed: xid is now displayed correctly -> was reversed order
  • fixed: was sending an empty boot filename in proxydhcp in the dhcp_offer stage -> removed, was preventing proxydhcp+opt67
  • changed: bind=true by default when multiple interfaces detected -> was preventing pxe boot with multiple interfaces when bind=false

Discuss it here.

 Posted by at 23 h 26 min
Jan 122014
 

Here below some drafts notes on how to boot WINPE on a UEFI computers.

1/Files you need from your windows x64 dvd

-\efi\boot\bootx64.efi file (1)
-\efi\boot\bcd file (2)
-\efi\boot\boot.sdi file (3)
-\efi\microsoft\boot\fonts folder (4)
-\sources\boot.wim (5)

If you dont find bootx64.efi, you can use bootmgfw.efi which is in install.wim on your dvd (sources folder).
Use 7zip to extract this file from the wim file and rename it to bootx64.efi

2/Files you need in your tftp root

-get in your tftp root
put bootx64.efi (from 1)
-create a SOURCES folder
put boot.wim in there (from 5)
-create a BOOT folder
put boot.sdi in there (from 3)
put bcd in there (from 2) / applies for Win8
-create a EFI/MICROSOFT/BOOT folder
put bcd in there (from 2) / applies for Win7
put the FONT folder in there (from 4)

You should end up with the following :
=>ROOT
-bootx64.efi
==>SOURCES
==boot.wim
==>BOOT
==boot.sdi
==bcd (for win8)
==>EFI/MICROSOFT/BOOT
==bcd (for win7)
===>FONTS
===*.ttf

3/Things you need to do on your boot.wim

Add the following winpeshl.ini (create it with notepad) file in your boot.wim (system32), making it a « cheap » winpe.

To modify your boot.wim, you can either mount/change/commit it with DISM (from the command line), or with CloneDisk or else modify it with wimlib :
wimlib-imagex update boot.wim 1 --command="add CustomWinpeshl.ini \Windows\System32\winpeshl.ini"


[LaunchApps]
%SYSTEMDRIVE%\Windows\system32\startnet.cmd
%SYSTEMDRIVE%\windows\system32\cmd.exe

4/Things you need to do in your PXE Server :

Set bootx64.efi as the bootp filename.

The UEFI + PXE boot process will be the following :
pxe->bootx64.efi (from windows install dvd)->bcd (pointing to winload.efi)->boot.wim (x64 only)

as opposed to a legacy bios computer :
pxe->pxeboot.n12 (from windows install dvd)-> bootmgr.exe -> bcd (pointing to winload.exe) -> boot.wim

Site note : you can use option dhcp 252 to decide which BCD file to load.
Can be handy when you want to switch from a UEFI computer to a legacy BIOS computer : efi\microsoft\boot or boot\bcd

tps_howto_uefi

side note : you can check if you booted on uefi with the following reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType Will output 0x1 for bios, 0x2 for uefi.

Cheers,
Erwan

Note that the following would aso work : PXE-> IPXE.efi ->MS Bootx64.efi ->BCD (winload.efi) ->Boot.wim (x64).

Ipxe script

#!ipxe
#change with you dhcp or proxydhcp server
set next-server 192.168.1.11
set filename boot/x64/bootmgfw.efi
chain tftp://${next-server}/${filename}

And changes to apply to your BCD : bcdedit.exe /store my.bcd /set {bootmgr} nointegritychecks yes

 Posted by at 21 h 49 min  Tagged with:
Jan 122014
 

Clonedisk now supports WIM format to backup/restore a logical disk.
Clonedisk currently focuses on 2 standard format : RAW and WIM.

In the advanced menu, one can also retrieve WIM informations, capture/apply, export, mount …

Discuss it here.

Cheers,
Erwan

 Posted by at 20 h 27 min
Jan 112014
 

There are times where you may not have a dvd drive or media available, or else, you may also want to perform some tasks before triggering the windows setup.

Agenda

  • Prepare winpe with QuickPE
  • Prepare the ipxe script
  • Prepare the PXE server with TinyPxe Server
  • Boot to winpe and Install windows
  • Reboot and complete the installation on the local drive

Prepare winpe with QuickPE

You can either use MS WAIK (winpe3), or MS ADK (winpe4) or an existing windows setup DVD or ISO file.
Launch _run_me.cmd and make your choice.

quickpe_menu

Prepare the ipxe script

The following will attach an iscsi drive and will boot your winpe


#!ipxe
dhcp net0
set boot-url http://${dhcp-server}
initrd ${boot-url}/images/winpe4.iso
kernel ${boot-url}/memdisk iso raw
boot

Prepare the PXE server with TinyPxe Server

Use ipxe-undionly.kpxe as « boot file name » and the above script (name it install.ipxe) as « filename if user-class=iPXE »

tinypxeserver

Boot to Winpe

Now lets network boot (pxe as first device in the bios).
Computer will pxe boot, load ipxe, then load your script.
The script will boot into winpe.

Now we are ready to perform the installation : map a drive thanks to PeNetwork (in the tinyshell launchbar) and map a network share containing your windows installation files.
You could eventually script this part (in batch file) :

net use \\servername\sharename /user:username password
\\servername\sharename\setup.exe

Note1 : CloneDisk can also mount a virtual dvd drive from an iso file (only in winpe4).

Note2 : Rather than launching the setup.exe from the windows DVD, you can also apply a wim file to the target drive using imagex (or clonedisk).
If so, then remember that you need to prepare the drive (partition active, boot sector …).
Example code using imagex (we’ll assume the partition has been made active already) :

Imagex /apply \\servername\sharename\install.wim 1 c:
bcdboot c:\windows /s c:
bootsect /nt60 c: /mbr

Launch the windows setup and let it run.

Reboot to local drive

Windows should the complete the installation, and reboot one last to your windows desktop.

See below a video demonstrating the above steps.

 Posted by at 14 h 51 min
Déc 272013
 

For a while, I was (very) upset with ads on my tablets (android and ipad).
And unlike browsers on my windows (firefox or chrome) I could not find something like adblock for ipad.

Therefore I decided to setup a squid on my synology ds210j and to setup an adblock like in squid.
And success, no more nasty popups, quicker web sites, etc 🙂

the steps:

-install ipkg (see here for an how to, in french sorry).
-install squid : ipkg install squid
-customize squid.conf
-use a list of domain you wish to block (i used a list from this site)

my list of blocked domains : denied_domains

my squid.conf

negative_dns_ttl 10 second
connect_timeout 60 second
read_timeout 60 second
request_timeout 60 second
cache_dir ufs /opt/var/squid/cache 512 16 256
cache_access_log /opt/var/squid/logs/access.log
cache_log /opt/var/squid/logs/debug
cache_store_log /opt/var/squid/logs/storage
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32

acl localnet src 192.168.1.0/24

#on which ports do we allow connections using the proxy
acl SSL_ports port 443 # https
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl purge method PURGE
acl CONNECT method CONNECT
#acl url_ads url_regex "/opt/etc/squid/denied_ads.txt"
acl denied_domains dstdomain "/opt/etc/squid/denied_domains.txt"

#http_access deny url_ads
http_access deny denied_domains
http_access allow localnet
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
miss_access allow all

http_port 8080

via off
forwarded_for off
header_access From deny all
header_access Server deny all
header_access WWW-Authenticate deny all
header_access Link deny all
header_access Cache-Control deny all
header_access Proxy-Connection deny all
header_access X-Cache deny all
header_access X-Cache-Lookup deny all
header_access Via deny all
header_access Forwarded-For deny all
header_access X-Forwarded-For deny all
header_access Pragma deny all
header_access Keep-Alive deny all

note : you can use the dns_nameservers directive in squid.conf to use specific dns servers (i use opendns).
note : you can set a vpn client on your synology and your proxy will then use a different network (i use vyrvpn from giganews)
note : you can tweak your dhcp server to set the proxy for your clients automatically (see here)

 Posted by at 23 h 10 min
Déc 082013
 

As seen in article 19 (a platform game), I had came up with a text file format which I used to create levels.

I was about to start coding a level editor when I came on this editor : http://www.mapeditor.org/ .
This is freeware and it seems active enough.
Note : a nice thread here around possible tile editors.

I decided to use it with my current game project (a platform).
I choose the xml format (tmx format). See an example here : level .

I then had to code a method to parse the xml file.
In the process I also completed the multi-tiles to one block trick to avoid the edge-catching bug.
I also managed the texture tiling.

A class to create level in a farseer world will come in a next article.

Here below a screenshot of a level made with Tiled.

tiled

Here below a video playing this level.

 Posted by at 1 h 18 min
Déc 052013
 

Farseer has one specific not always easy to deal with : your world is meant in KMS (kilo meter second) whereas your rendering is in pixel.
Added to that, your world and rendering are two complete different things which does not make it easy to debug.

This where the DebugViewXNA class kicks in : it will render your world 🙂
This and a few other things like stats, datas, etc.

The how to use the DebugViewXNA class is rather easy :

add the project reference to debugview.xna.dll
add an imports to FarseerPhysics.DebugView
declare a _debugView As DebugViewXNA
set it up in loadcontent (for instance) :

_debugView = New DebugViewXNA(world)
_debugView.AppendFlags(DebugViewFlags.DebugPanel)
_debugView.DebugPanelPosition = New Vector2(15, 15)
_debugView.DefaultShapeColor = Color.White
_debugView.SleepingShapeColor = Color.LightGray
_debugView.LoadContent(GraphicsDevice, Content)

-use it in your draw method (after your spritebatch.end) :

Dim projection As Matrix = Matrix.CreateOrthographicOffCenter(0.0F, graphics.GraphicsDevice.Viewport.Width * DrawablePhysicsObject.pixelToUnit, graphics.GraphicsDevice.Viewport.Height * DrawablePhysicsObject.pixelToUnit, 0.0F, 0.0F, 1.0F)
_debugView.RenderDebugDataVB(projection)

A video to illustrate switching between rendering and debugging.

 Posted by at 22 h 35 min
Déc 032013
 

Recap #3 of recent articles around VB.Net and XNA :

VB.Net and Article 22 : 2 classes to handle character move
VB.Net and Article 21 : A simple 2D camera Version 2
VB.Net and XNA : Article 20 – A simple 2D camera
VB.Net and XNA : Article 19 – A platform game with FPE 3.5
XNA to Monogame part2
XNA to Monogame part1
VB.Net and XNA : Article 18 – Get text input from user
VB.Net and XNA : Article 17 – Farseer mouse joint & body from texture
VB.Net and XNA : Article 16 – Animating a sprite

Recap #2 of recent articles around VB.Net and XNA :

VB.Net and XNA : Vrooom V3 (car racing game)
VB.Net and XNA : PixDead by my 12 years old son 🙂
VB.Net and XNA : Article 15 – Screen Manager (i.e multi screens in XNA)
VB.Net and XNA : Article 14 – simple buttons
VB.Net and XNA : Article 13 – First steps with Farseer Physics Engine
VB.Net and XNA : Article 12 – Pixel collision on rotated shapes
VB.Net and XNA : Article 11 – Use a gamepad
VB.Net and XNA : Article 10 – A simple progressbar
XNA Games : how to distribute with Inno Setup

previous recap of recent articles around VB.Net and XNA :

VB.Net and XNA : Article 9 – A Pong Game
VB.Net and XNA : Vroom V1
VB.Net and XNA : Article 8 (pixel collision)
VB.Net and XNA : Article 7 (Scrolling)
VB.Net and XNA : Article 6 (move a texture, add a background, play some sound)
VB.Net and XNA : Article 5 (mouse input)
VB.NET and XNA : Article 4 (keyboard input)
VB.NET and XNA : Article 3 (draw text)
VB.Net and XNA : Article 2 (moving texture)
VB.Net and XNA : Article 1 (skeleton class)
VB.Net and XNA : Article 0 (introduction)

 Posted by at 19 h 45 min
Déc 032013
 

In previous article, I have regularly used either a rotating sprite (a car, a rocket, a tank, etc) OR an animated sprite (a walking character).

Here below these 2 classes.
You can use them in as a quick start for a game so that you dont have to bother with this part.

To use it the animated class :
declare it Dim animated As Animated
load it animated = New Animated(mTexture, 1, position, 0, 28, 32)
update it animated.Update(position, direction_)
draw it animated.Draw(spriteBatch)

Same goes with the rotating class :
declare it Dim rotated As rotated
load it rotated = New rotated(texture, _scale, New Vector2(50, 50), New Vector2(0, 0), _rotation, _speed)
update it rotated.Update(_rotation, _speed)
draw it rotated.Draw(SpriteBatch)

The animated class here : clsRotated .
The rotating class here : clsAnimated .

 Posted by at 19 h 38 min
Déc 022013
 

This time, lets add a zoom and rotating effect on our camera.

And lets re use the rotated sprite class you may have seen in Article 12 – Pixel collision on rotated shapes.

The only major change in the camera is the following where we will now use the position + rotation + zoom.

viewmatrix = Matrix.CreateTranslation(New Vector3(-position, 0)) * Matrix.CreateRotationZ(_rotation) * Matrix.CreateScale(New Vector3(_zoom, _zoom, 1))

The video.

The source code.
XNA_DEMO_20.2

 Posted by at 22 h 56 min