Repository navigation
instructions to demo PowerShell Core on Raspbian #4882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Travis Plunk (TravisEz13)
merged 6 commits into
PowerShell:master
from
SteveL-MSFT:pi-demo
Sep 23, 2017
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aff85c7
created instructions to demo PowerShell Core on Raspbian
SteveL-MSFT 20c939d
fix spelling
SteveL-MSFT 49c3af9
address PR feedback
SteveL-MSFT c1c3739
added link to tracking issue for arm32 on coreclr
SteveL-MSFT 7142b4b
clarified supported Pi devices
SteveL-MSFT 034913e
fix spelling of Pi 2 and Pi 3
SteveL-MSFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Running PowerShell Core 6 on a Raspberry-Pi | ||
|
|
||
| ## Setup your Pi | ||
|
|
||
| Note that CoreCLR (and thus PowerShell Core) will only work on Pi 2 and Pi 3 devices as other devices | ||
| like [Pi Zero](https://github.com/dotnet/coreclr/issues/10605) have an unsupported processor. | ||
|
|
||
| Download [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) and follow the [installation instructions](https://www.raspberrypi.org/documentation/installation/installing-images/README.md) to get it onto your Pi. | ||
|
|
||
| Once your Pi is up and running, [enable SSH remoting](https://www.raspberrypi.org/documentation/remote-access/ssh/). | ||
|
|
||
| ## Building PowerShell Core 6 for arm32 | ||
|
|
||
| We'll need to cross-compile for the Linux arm32 architecture from Ubuntu. | ||
|
|
||
| Follow the [Linux instructions to Build PowerShell](https://github.com/PowerShell/PowerShell/blob/master/docs/building/linux.md). | ||
|
|
||
| Once your environment is working, you'll need to setup the toolchain for cross compilation: | ||
|
|
||
| ```powershell | ||
| Start-PSBootstrap -BuildLinuxArm | ||
| ``` | ||
|
|
||
| You can now build PowerShell Core: | ||
|
|
||
| ```powershell | ||
| Start-PSBuild -Clean -Runtime linux-arm -PSModuleRestore | ||
| ``` | ||
|
|
||
| Note that it's important to do a `-Clean` build because if you previously built for Ubuntu, it won't try to rebuild the native library `pslnative` for arm32. | ||
|
|
||
| ## Copy the bits to your Pi | ||
|
|
||
| Use SSH to copy the bits remotely, replace `yourPi` with the name or IP address of your Pi. | ||
|
|
||
| ```powershell | ||
| scp -r "$(split-path (Get-PSOutput))/*" pi@yourPi:/home/pi/powershell | ||
| ``` | ||
|
|
||
| ## Get latest CoreCLR runtime | ||
|
|
||
| We need to get a CoreCLR that fixes a [threading bug](https://github.com/dotnet/coreclr/pull/13922) which is in DotNetCore 2.0.0. | ||
|
|
||
| You can do these steps locally on your Pi, but we're using SSH remoting here. | ||
|
|
||
| We'll be using the latest [build](https://github.com/dotnet/core-setup#daily-builds) from master which has the fix. | ||
| Note that at the time of authoring these instructions, the 2.0.x servicing build didn't have the necessary fix and the 2.1.x builds may be more unstable. | ||
|
|
||
| We'll use `curl` to get the latest DotNetCore runtime. | ||
|
|
||
| ```bash | ||
| sudo apt install curl | ||
| ``` | ||
|
|
||
| Now we'll download it and unpack it. | ||
|
|
||
| ```bash | ||
| # Connect to your Pi. | ||
| ssh pi@yourpi | ||
| # We'll make a folder to put latest CoreCLR runtime. | ||
| mkdir dotnet | ||
| cd dotnet | ||
| # Download the latest CoreCLR runtime. | ||
| curl -O https://dotnetcli.blob.core.windows.net/dotnet/Runtime/master/dotnet-runtime-latest-linux-arm.tar.gz | ||
| # Unpack it. | ||
| tar xvf ./dotnet-runtime-latest-linux-arm.tar.gz | ||
| # We're going to overwrite the CoreCLR bits we built with newer ones, replace the version named folder below as appropriate. | ||
| # If you build a newer version of PowerShell Core, you'll need to make sure you get latest CoreCLR runtime otherwise you may hit a segmentation fault. | ||
| cp shared/Microsoft.NetCore.App/2.1.0-preview1-25719-04/* ~/powershell | ||
| ``` | ||
|
|
||
| ## Start PowerShell | ||
|
|
||
| ```bash | ||
| ~/powershell/powershell | ||
| ``` | ||
|
|
||
| Note that until arm32 is [fully supported by CoreCLR](https://github.com/dotnet/coreclr/issues/3977), it's not supported by PowerShell Core. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it might be worth mentioning that these instructions apply only to
Raspberry Pi 2andRaspberry Pi 3;On
Pi 1,Pi ZeroandPi Zero WCoreCLR can't run because it requires newer CPU instruction set, so we can't run PowerShell on these versions of Raspberry Pi single-board computers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll clarify.