[Q] iptables on goldfish - Android Q&A, Help & Troubleshooting

hi,
I have modded the config for goldfish to enable netfilter.
And also, a full build of AOSP. The entire thing (system + kernel) works perfectly on the emulator.
In a shell (root), I run iptables -L and I get a 3 rows of data (input, output, forward) with no data (which is expected).
When I try to add a rule like:
iptables -A OUTPUT -m owner --uid-owner 10001 -j DROP
it tells me that it could not find any table/match etc.
I have verified that the "owner" extension exists in the source code. What have I missed here?
cheers,
Earlence

I got it!
a crucial netfilter config was missing
CONFIG_NETFILTER_XT_MATCH_OWNER=m
Once that was in, everything worked like a charm!
Cheers,
Earlence

Can you share how to enable netfilter?
CONFIG_NETFILTER_XT_MATCH_OWNER=m
I want to set this on my HTC phone.

Related

[MOD] Change WiFi hostname - for custom ROMs (Sept 23)

This is useful for identifying phones on the local networks by looking at DHCP lease tables in the routers. It doesn't make your phone appear on Windows networks, since the phone needs to broadcast NetBIOS name for that. If you want your phone to show up on Windows networks (and share files) - you need Samba server, and JimmyChingala is working on one.
ROM developers can insert the option to customize hostname using the way described below in their Spare Parts options. Feel free to do so.
[SOLUTION]
The following shell command does the job of changing WiFi hostname:
echo YOURHOSTNAME > /proc/sys/kernel/hostname
Click to expand...
Click to collapse
For the change to stay, it should be executed on each boot. And here the things start being more problematic.
For custom ROMs:
Most, if not all, custom ROMs include some user init shell script that will be executed on boot, making the solution easy.
Enter the following line in the Terminal / ADB shell:
echo "echo YOURHOSTNAME > /proc/sys/kernel/hostname" >> the_path_and_name_of_userinit_script.sh
chmod 777 the_path_and_name_of_userinit_script.sh
Click to expand...
Click to collapse
Several examples of custom ROMs and their userinit scripts:
Suggested - will work for most ROMs (creates another file in directory of autoexecuted scripts): /etc/init.d/88hostnameinit
Additional possibility for Enomther's ROM: /data/local/userinit.sh
Additional possibility for CyanogenMOD: /sd-ext/userinit.sh
For stock ROMs:
There is no autorun script for stock ROMs, so they have to be added through modifying boot.img. It's a complicated procedure, and even though guides exist for it - I suggest not to mess with it only because of the hostname. The easiest solution would be to create a script file with the line above using Gscript or other scripting solutions, and execute it after each reboot. If anyone really wishes to modify boot.img - I assume that he/she knows enough about Linux/Android since it can be relatively easily done only on Linux, can find the necessary guides with some googling (like I did), and in this case the modification is easiest to do directly in init.rc - changing "hostname localhost" to "hostname name_of_your_choice".
[ORIGINAL POST]
Hi people,
I'm not much of a dev, but I can find my way around with a bit of Google search And sorry about the links that don't link, new user's permissions don't allow me to...
Anyway, after messing with my router today I've noticed that Nexus transmits "localhost" as its host name to DHCP server, causing my DD-WRT to show it as "*". I went to Google and to my surprise, discovered that there isn't such an option in any Nexus ROM yet.
Found this: LINK_www_laslow_net_?p=501
To change your hostname on Cyanogen 5.x, add the following line to the bottom of /system/etc/init.d/01sysctl -- and make sure you make a backup of 01sysctl before editing it!
echo NEWHOSTNAME > /proc/sys/kernel/hostname
Click to expand...
Click to collapse
I tested it, and it didn't work. After booting, the file still read "localhost" in it, and the hostname on DHCP server reflected it.
But, I didn't get frustrated, connected with ADB, manually executed the command:
echo MyHostName > /proc/sys/kernel/hostname
checked that the file was overwritten, disabled WiFi, deleted DHCP lease, enabled WiFi back - and voila, I have a new hostname!
Then I went to search for hostname setting, which got me to /init.rc:
on boot
# basic network init
ifup lo
hostname localhost
domainname localdomain
Click to expand...
Click to collapse
Well, I guess that's the place. A tiny problem, though - it's in the boot image, which can't be easily modified. Thanks to the latest thread on update.zip creation I can probably do it myself, but I wanted to share the findings and ask for the correct way to implement.
There's a "dirty but functional" way of "disable WiFi - override /proc/sys/kernel/hostname - enable WiFi", and it's probably not a problem to stick it somewhere in the boot sequence, or even write an app that writes those changes to one of the boot scripts and allows configuration of host and domain names. But it's not the best way - DHCP might already give out a lease, and the new host name might not register.
And there's a correct (?) way of doing it, introducing it into init.rc. Since it's "on boot", I suppose that it runs after mounting the partitions - which means that the partitions are already accessible.
In this case, the best way would be executing a small shell script that would check for existence of, say, "/system/etc/settinghostdomainnames.rc" and create a default one if it's not there, then use "import /system/etc/settinghostdomainnames.rc" and set a manual trigger, like the guy is trying to do here:
LINK_groups.google.co.jp_group_android-developers_browse_thread_thread_e2f432707b735ff0
"trigger someeventtobringupnetworkinterface"
That would allow to use a custom setting for host and domain names that can be changed by SW, and adding that as another option into ROM Settings app or external app.
But the guy in question didn't succeed. What did he miss? Would it be better to do something like "on fakesystemproperty=something" and instead of manual trigger, doing "setprop fakesystemproperty something"?
I can probably test it and find out myself, but it would take loads of time compared to one of the kernel devs, and I don't even have the environment set up for modifying boot images. I was kinda hoping that one of the kernel devs would test it. I can write and post the modifications to init.rc and the custom script, they're very simple.
So, who can help me with answering the questions in the thread, and/or testing the modification?
Thanks! It's back.
Oh well, I'll keep preparing Ubuntu VM anyway
OK, first test fired - updated /init.rc in my own boot.img, checked the values. It's working, hostname is indeed modified.
Now I'll try to rewrite /init.rc in such way as to load the hostname setting from elsewhere, while not screwing the security. Will post results soon.
Setting it to the same value as the BT value would be ideal. I'm not sure how you could do that though, because the init scripts run before the frameworks load
Looking forward for a fix to this problem.
Update, but only partially on topic:
God, I hate SH scripting. Couldn't even google a normal tutorial that would explain where I went wrong. A script of 10 lines, and I can't make it work.
Let's see, I need something like this:
#!/system/bin/sh
echo "on service-exited-network_prepare" > /system/etc/net_init.rc
echo " ifup lo" >> /system/etc/net_init.rc
if [ -e "/system/etc/net_init.domain" ];
then
echo "hostname `cat /system/etc/net_init.host`" >> /system/etc/net_init.rc
else
echo "hostname localhost" >> /system/etc/net_init.rc
fi
if [ -e "/system/etc/net_init.domain" ];
then
echo "domainname `cat /system/etc/net_init.domain`" >> /system/etc/net_init.rc
else
echo "domainname localdomain" >> /system/etc/net_init.rc
fi
echo >> /system/etc/net_init.rc
Of course, this thing fails miserably with -
Syntax error: end of file unexpected (expecting "then")
What the hell am I doing wrong? Never used SH before, mostly tcsh and perl.
Thanks.
Oh well, I guess I got the problem.. Unix vs Windows file format. Sorry for bothering.
its always bothered me that you cant change the device name for wifi networks, and ive always looked for a way to change it.
kudos to you for the ambition and diligence to do it!
dont give up, if you can get it smoothed out enough im sure cyanogen will implement it in his next mod. ive always wished there was an option in wifi settings to change device name. itd be very useful for lan ip configuring and when your connected to a random hotspot lol
Ok, after fighting for a day, I still didn't manage to import another .RC file and run on service exit (I don't even see the trace of the process I'm trying to start - the first thing it does is attempting to write log, and there is no log, no matter where I put the start command), but at least for a "quick-and-dirty way" there's a very simple solution, given SD-EXT partition (I believe everyone creates it):
open terminal application, type the following command:
echo "echo YOURHOSTNAME > /proc/sys/kernel/hostname" > /sd-ext/userinit.sh
That would override the hostname of the system before boot completion.
After some reading, I believe there's nothing bad in setting the hostname twice - once default localhost in init.rc, and then overriding it using /proc/sys directory, Linux is designed to cope with that and hopefully so does Android.
So, as to pershoot's request, it's possible to write a small application to read Bluetooth device name value and write it as WiFi hostname, and include it in boot process right before 20userinit.
Now this is a task I'm not suitable for, I have no knowledge of frameworks whatsoever. Anybody up to the task?
Jack_R1 said:
After some reading, I believe there's nothing bad in setting the hostname twice - once default localhost in init.rc, and then overriding it using /proc/sys directory, Linux is designed to cope with that and hopefully so does Android.
So, as to pershoot's request, it's possible to write a small application to read Bluetooth device name value and write it as WiFi hostname, and include it in boot process right before 20userinit.
Now this is a task I'm not suitable for, I have no knowledge of frameworks whatsoever. Anybody up to the task?
Click to expand...
Click to collapse
I requested it and I'm not pershoot
Oops Sorry, my bad. Fever and lots of time in front of the computer don't do me good...
Kudos to you Jack_R1. Watching this.
Let me know if you need any help with shell scripting.
Gonna watch this and try it out later, the solution so far.
is this a stable fix?
is this confirmed to work?
Sorted out, updated with the most current info and several examples of custom ROMs.
Jack_R1 said:
Sorted out, updated with the most current info and several examples of custom ROMs.
Click to expand...
Click to collapse
I am running CM6 with a2sd and somehow the /sd-ext/userinit.rc is not executed. Even if I change permissions of the file to 777, it's not executed.
I also haven't found in init.d the script which executes userinit.rc, might be because I am running custom kernel? (wildmonks).
The only way for me to do it was to put the script in /etc/init.d/88userinit file and change it's permissions to 777
It's /scripts/userinit.sh, not userinit.rc
The execution of /sd-ext/userinit.rc used to be in /init.rc, in boot.img.
But the preferred way for most of the ROMs is to use /etc/init.d/ scripts anyway, since a lot of ROMs use them.
Changed the 1st post to reflect it.

[Q]X10mini pro and VPN PPTP (Cisco Router) possible?

Hi guys!
I´ve got problems to establish a connection to the university wlan network with my phone.
We´ve got a Cisco Router, so I need Cisco VPN support.
Any helpful suggestions for me?
Greetings, DaXmYsT
I asked SE, they sad they are not sure if they are intended to implement Cisco PPTP VPN support.
It is possible, but not easy at the moment... If you know linux well, look at the tun.ko module i compiled for the x10 mini and look for get-a-robot-vpnc packages and how to's. You'll have to fix the vpnc scripts but it works. Sorry i'm not at home and won't be able to share more than the kernel module i posted in the x10 mini forum...
Sent from my U20i using XDA App
I too am battling with this.
The vpnc-script as is stands does't work very well and is throwing up loads of errors. I had to install busybox on the device and set PATH so it used those commands so it could find things commands like "which" and "grep" etc. However simple lines in the script to set up variables such as
IPROUTE="`which ip | grep '^/' 2> /dev/null`"
Which is simply trying to set variable IPROUTE to the path where the command "ip" is found is failing, so I've set had to set up all the variable paths manually. I do not know why this is failing, but I suspect it's using "grep" is a slightly different manner to the busybox grep I have. grep didn't exist in /system/bin by default on my phone. (Debranded x10 on Voda)
However the big problem I've now discovered is the "route" command. The default in /system/bin fails miserably with the commands in the script and the busybox route command doesn't support all the options either.
So I'm now working out what the script is trying to do with the routing table so I can set all this manually...
...but appreciate any help!
UPDATE: Well I got vpnc working - turned out my version of busybox was waaay out of date. Installed the latest and it works just fine. Of course now I can connect via RDP to my work machine over my VPN I very much doubt I'll ever want or need to!
Which busybox version are you using?
Also which app from the market?
Thanks!
I am using busybox 1.16.1 downloaded from busybox - I then had to copy the binary over to my phone and installed it in /system/sbin
this caused me a few issues as in init.rc it sets up the path /system/sbin before /system/bin so applets from busybox took priority over /system/bin.
So I had to remove the "ps" and the "su" commands IIRC.
However doing it the other way would have also caused issues, as "route" only worked when I used the busybox 1.16.1 and not the one currently in my /system/sbin
Other strange oddities also included the fact that rmmod from busybox didn't work but it did from the original /system/bin.
meh
I then also got the latest get-a-robot-vpnc.
I also needed the tun module, which I placed into /system/lib/modules
get-a-robot-vpnc didn't automatically install this module correctly though so I modified the scrip to ensure that when I used it the tun.ko module was loaded....
Code:
TUNTEST="`lsmod | grep 'tun'`"
if [ -z "$TUNTEST" ]; then
echo "tun not found try to install"
insmod -f /system/lib/modules/tun.ko
else
echo "tun module installed"
fi
Which seemed to do the trick.
I also had to put in my appropriate flags for vpnc.
Essentially I got it working first just using the shell and typing the commands manually and then got it working with the GUI.
I do not understand you mean that the included VPN client in Mini does not work with cisco VPN (pptp)?
Because for me it worked with a cisco vpn 3000.You say that you do pptp but which one (it could be pptp over ipsec?)
However, there is a free client on the market called "vpn connection", which work very vell with cisco equipement, it worked like a charm on my dream, but only on wifi as my phone provider do not let pass ipsec or pptp/ipsec.
Bye
Herc.

[Q] Wifi tethering uses slightly broken iptables line for masquerading?

As seen when I type with wifi tethering enabled
iptables -L -t nat -v
the MASQUERADE line is like "-o pdp0 -i any", this means that packets are matched only when they exit via the mobile network.
However, the line should be more like "-i softap0 ! -o softap0". The MASQUERADE line should match packets that enter via the wifi access point, and leave via any other interface. (But see below, -i doesn't work, must use -s)
I found this while trying to use openvpn. When openvpn is running, the android device has complete access to the vpn according to my tests. The laptop associated with the AP can access the internet, the android device, but not the network behind the VPN connection. I can find no reason for this other than the MASQUERADE line. The routing table, sysctl *.forward etc. are all looking fine.
With this MASQUERADE line, it cannot possibly work, because when the unmasqueraded softap0 packets go down the tun0 interface, no machine knows where to route the reply packets.
This is on Android 2.3, Samsung galaxytab stock firmware. I'll investigate further.
Update:
when I stop tethering, the MASQUERADE rule goes away. This proves it's indeed controlled by tethering.
I tried it on Android 4.0, Sony Xperia pro, Cyanogenmod 9 ---> same thing
I can understand that noone ever thinks about making a MASQUERADE line with "-i interface", but it seems actually the right thing to me. (Must use -s addr/mask instead) I'm doing this on a laptop with lots of virtual machines connected to an internal network. This must be masqueraded for outgoing packets, no matter what interface it goes out (wlan0, eth0, openvpn etc.)
Update:
-i interface doesn't work in POSTROUTING. So the line should be "-s address_range_of_softap ! -o interface".
This complicates matters for a workaround. I'm planning to schedule a script at boot time, but I don't know how to (correctly) find the softap address when it's not running.
Update:
I tried tethering and replaced the iptables rule with "-s address_range_of_softap ! -o softap0" instead of just "-o pdp0". This still works to route/masquerade traffic to the internet, but doesn't work vor tun0 (openvpn). I don't know why. No packets/bytes go through it (counter doesn't increase) when pinging the other side of the vpn.

No rsync on Oreo thanks to noexec

Hi,
before Oreo I happily used "Rsync for Android" to sync images from my NAS to my Pixel C (and backups the other way).
Since Oreo this no longer works. The rsync and ssh executables in /sdcard/Android/data/eu.kowalczuk.rsync4android/files/ are no longer executable, as the sdcard is mounted noexec.
The devices is rooted, stock ROM.
I am looking for either alternative apps that do not rely on executables on the sdcard or ways to make "Rsync for Android" usable again. Preferable a solution that survives system updates.
thx
afx
I am on the same boat. Any ideas?
prescaler said:
I am on the same boat. Any ideas?
Click to expand...
Click to collapse
Ok,
found something today:
Rsync Wrapper by Letscorp from the play store.
seems to work, though one needs to experiment a bit with the options.
cheers
afx
Rsync Wrapper doesn't work for me even on Nougat. One review says it may be a problem with running it on Lineage.
Could not create directory '/data/.ssh'.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at external/rsync/io.c(226) [sender=3.1.1]
I used llama + rsync4android to backup DCIM/Camera to my Linux server. Same problem w/ Oreo. The easiest work around is to use SmbSync2 instead. The other workaround is to use root the phone and use one of the following:
- llamaLab's Automate. (Search the community contributed tasks for an rsync example).
- Tasker + com.termux's plugin (I haven't tested this one)
The really hacker's method (My first attempt):
- install rsync4android
- install the rsync binaries (rsync, ssh, dropbearkey)
- generate dss_key
- as root, copy those binaries to to /system/bin (will need remount /system rw)
- chmod 755 those binaries
- install a cron scheduler (I used ru.kslabs.scheduler)
- create a task and directly run rsync. (Might need to run as root)
I have the same issues with rsync4android on LineageOS 15.1 (Oreo 8.1). The "really hacker's method" do not work at all. With my old, yet broken cellphone, running with CarbonROM Oreo 8.1, rsync4android worked fine.
Any ideas?
Any alternatives?
Been using rsync wrapper for quite a wile now and it works just fine (two stock Oreo systems).
Give it a try.
cheers
afx
a.f.x. said:
Been using rsync wrapper for quite a wile now and it works just fine (two stock Oreo systems).
Give it a try.
Click to expand...
Click to collapse
Thank you. I tried again with various options and for hours.
I always get this:
rsync: connection unexpectedly closed 90 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at external/rsync/io.c(226) [Receiver=3.1.2]
I found a solution for this issue.:
Connect the smartphone by USB to a computer.
Mount it with JMTPFS.
Write a bash script with different rsync commands.
Execute the rsync bash script.
That will do it for me. For Calendar and Contacts synchronization I use Radicale.
Still, the SD Card remains unencrypted and Adoptable SD Cards are no longer possible. I blame Google for this retrograde and insecure step.
Sorry, I was wrong. The mount with jmtpfs + rsync method did not work. Unfortunately, the files were not copied to the phone. For me this Google-FBE is a big disadvantage for Android and I have a broken smartphone, I want to get rid of it.
I faced 2 issues with rsync4android:
- The binaries didn't seem to work with Oreo
- Dropbearkey generates a DSS key instead of a RSA one
So I installed rsync wrapper and with the key it generates, it worked. But I want to be able to automate my backups with Tasker so it wbsn't perfect. So I overwrote the binaries of /data/data/eu.kowalczuk.rsync4android/files with those from /data/data/net.letscorp.rsyncwrapper/files. with the RSA key, it did work with rsync4android and Tasker
I finally got rsync wrapper to work in Lineage 15.1 by converting my dropbear formatted key to openssh format, and replacing my old rsync -e option with...
-e "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22 -i '/sdcard/id_rsa'"
Running LineageOS 15.1 and here is my finding:
The issue is with ssh client included in ROM. Workaround is to update the -e parameter in to include full path to local ssh instead
From: -e "ssh -l <your username>...
To: -e "/data/data/net.letscorp.rsyncwrapper/files/ssh -l <your username>...
An easy fix for Rsync Wrapper. But I was unable to edit command line for Rsync4android.
I just cannot get Rsync Wrapper to work, even playing with the options. My rsync4android command was
Code:
rsync -vHrltD --chmod=Du+rwx,go-rwx,Fu+rw,go-rw --no-perms --exclude=.trashcan --exclude=.android_secure --delete-after -e "ssh -y -p 22 -i '/sdcard/dss_key'" /storage/F975-D0D2/ [email protected]:/media/HDD/folder
I tried a number of variations including the ones you all suggested, with the end string being
Code:
rsync -vHrltD --chmod=Du+rwx,go-rwx,Fu+rw,go-rw --no-perms --exclude=.trashcan --exclude=.android_secure --delete-after -e "/data/data/net.letscorp.rsyncwrapper/files/ssh -y -p 22 -i '/sdcard/dss_key" /storage/F975-D0D2/ [email protected]:/media/HDD/folder
It just does not work: I always get as a result
Code:
/data/data/net.letscorp.rsyncwrapper/files/ssh: Exited: Error connecting: Connection refused
rsync: connection unexpectedly closed (0bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]
Would you kindly suggest any other attempts I could try? My phone is not rooted, and I wish to backup my SD Card to a raspberrypi I have in my home; with Nougat it worked wonderfully and it still does from my girlfriend's Nougat phone.

[Linux] Porting native Linux to Galaxy Note9

This thread is about starting native Linux on Samsung Galaxy Note9. This isn't my first attempt to do such thing. The history looks like Galaxy Spica -> Galaxy J1 (2016) -> Galaxy Note9. So I know what I'm doing
Later I'll post instructions how to install and run it.
Note9 isn't my main device, so I won't work on dualboot. If some wants to make it, feel free to build dualboot (kexec) recovery and post it here.
Source code.
Kernel: https://github.com/LONELY-WOLF/crownlte-linux-os
First success
So, here is a first result.
With minor modifications to DECON (framebuffer) my Note9 is able to run Arch Linux form SD card.
So far it has no serial or USB console. I can't find a way to make UART JIG for Type-C Samsungs. USB gadgets are hardcoded and can't be easy changed to CDC ACM. This is not good and makes development harder.
Arch Linux says it started GUI but I don't know what happened to Xorg. It can be on back buffer or on another display (since Note9 has it via Type-C).
This would be awesome for me during pen testing?!
Def following!
Could install it on dualboot?
giorgior.r said:
Could install it on dualboot?
Click to expand...
Click to collapse
Yes, it's possible. As for now kernel is inside phone memory and root FS is on SD card.
There are two ways to install it alongside Android:
Flash Linux kernel as recovery. So when you try to enter recovery it'll boot into Linux. You lose recovery in this case.
Install special dualboot/kexec recovery and start Linux from recovery menu. (If someone will make such recovery for Note9)
All Linux files (except kernel) are on SD card. SD has following partition scheme:
Storage. That's what your Android sees as SD card. FAT32 or exFAT
Apps2SD. Is someone still using it? However this partition can be 1MB in size.
Linux rootfs. That's where Linux "ROM" lives.
So SD is also ready for daily use.
nice, have similar thing based on exynos-linux-stable and debian stretch wifi work but sound and usb not yet for me. how you enabled boot console? also need to swap red and blue channel because they are flipped on 24/32 bit colours
Sisah said:
nice, have similar thing based on exynos-linux-stable and debian stretch wifi work but sound and usb not yet for me. how you enabled boot console? also need to swap red and blue channel because they are flipped on 24/32 bit colours
Click to expand...
Click to collapse
For fbcon you need to patch decon driver. Take a look at my commits on GitHub.
Yes, RGB<->BGR is a common issue. I have it on J120F too. This hack work for J1. But it would be nice to find a source of the problem. I believe decon reports wrong color order.
WARNING! I had to disable fbcon on J1 because it messed up with Xorg.
Still no luck with USB. I try to configure it with configfs, but got error
Code:
Config c/1 of g1 needs at least one function
Looks like Samsung hardcoded something inside USB drivers.
Found out that USB configfs is heavily modified. That's the reason why Linux can't configure USB gadgets properly. Bring back compatibility seems to be a hard task.
ho ho ho... so long time im not play dualboot
sorry i have diferent question, i see on youtube, normal windows 10 work on lumia 950 and 950xl, what its that ?
Ce Doresti said:
ho ho ho... so long time im not play dualboot
sorry i have diferent question, i see on youtube, normal windows 10 work on lumia 950 and 950xl, what its that ?
Click to expand...
Click to collapse
Since I'm a Windows Phone hacker, I can answer your question
That project is very similar to what I do here. Starting from Windows Phone 8, phone OS and desktop one have one (NT) kernel. Just like Android and desktop Linux do. Windows you see on NL950 on YouTube is "Windows for ARM". It looks like desktop but it can't run normal Windows EXEs because of different processor architecture. Maybe it can run desktop .NET applications (I've made proof-of-concept EXE that worked on both Windows Mobile 5.0 and Windows XP) but I'm not sure.
Linux is a better way to get desktop OS on mobile device. Open source nature of most Linux software makes it possible to use almost any program on any processor architecture. Take a look at single board computers (like Raspberry Pi) if you want to see what Linux can do on ARM architecture.
I think win 10 for arm have integrated x86 emulator, so it probably launch nearly anything.
If i can have one more question. How you refreshing screen? Refresh rate is set to 0 and my every attempt to configure screen with fbset result in black screen and hard reset, so i must use infinite loop that send "1" to /sys/class/graphics/fb0/rotate to refresh my screen
-W_O_L_F- said:
Since I'm a Windows Phone hacker, I can answer your question
That project is very similar to what I do here. Starting from Windows Phone 8, phone OS and desktop one have one (NT) kernel. Just like Android and desktop Linux do. Windows you see on NL950 on YouTube is "Windows for ARM". It looks like desktop but it can't run normal Windows EXEs because of different processor architecture. Maybe it can run desktop .NET applications (I've made proof-of-concept EXE that worked on both Windows Mobile 5.0 and Windows XP) but I'm not sure.
Linux is a better way to get desktop OS on mobile device. Open source nature of most Linux software makes it possible to use almost any program on any processor architecture. Take a look at single board computers (like Raspberry Pi) if you want to see what Linux can do on ARM architecture.
Click to expand...
Click to collapse
thank you !
I can see the potential of this project if things go according to your vision.. I will for sure donate you for your amazing effort
Interesting, is it more for the challenge itself or what's your goal?
Linux on Dex works great for me, it's missing a gui if you don't connect it to a display but you could probably trick it to believe that the phone screen is an external display.
Sisah said:
I think win 10 for arm have integrated x86 emulator, so it probably launch nearly anything.
If i can have one more question. How you refreshing screen? Refresh rate is set to 0 and my every attempt to configure screen with fbset result in black screen and hard reset, so i must use infinite loop that send "1" to /sys/class/graphics/fb0/rotate to refresh my screen
Click to expand...
Click to collapse
Since we use the same kernel can you share your work on GitHub too? Also I need all your current work on OS. What image you use? What modifications you made? It's a good idea for me to migrate to the same distro. This can speed up our work.
-W_O_L_F- said:
Since we use the same kernel can you share your work on GitHub too? Also I need all your current work on OS. What image you use? What modifications you made? It's a good idea for me to migrate to the same distro. This can speed up our work.
Click to expand...
Click to collapse
Here is my config files for debian.
https://www.mediafire.com/file/ccziy42yj2bn28x/LINUX.zip
(Include precompiled mtev driver from meefik https://github.com/meefik/xorg-input-mtev
Also it set wacom driver for spen to work
)
kernel .config
https://www.mediafire.com/file/czrct62638xpkhz/.config
And debian install cdrom
https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/
installation was little tricky, need to install linuxdeploy compile kernel with atleast isofs, systemv-ipc, vt console, kernel automounter-v4, fanotify and raid-dm support and put it to recovery.img, then dd it to BOOT partition.
Now download debian-installer.iso, extract ramdisk.gz from him and reboot to modified recovery.
Here mount system, go to terminal, type linuxdeploy shell.
Now we must unpack ramdisk.gz from installer with abootimg or mkbootimg, mount debian-installer.iso to unpacked-ramdisk/cdrom and then we can chroot to installer ramdisk with chroot /unpacked-ramdisk /bin/ash
After that just type
./init
debian-installer-startup
debian-installer
Use sdcard as root partition and install.
After installing base system it probably fail to setup apt, so we must open terminal in setup program then
mount --bind /cdrom /target/media/cdrom (need to create that dir first)
then
chroot /target /bin/bash
apt-cdrom add
apt-get update
Now you can run tasksel and install desktop (kde xfce and gnome work but need lightdm for virtual keyboard on login)
(Here is nice place to copy those config files i posted and run install.sh, but also be sure to install lightdm and onboard keyboard, its not in my pack)
after that type exit few times until you get back to installer where you can finish installation.
Then need to compile kernel make initrd and create boot.img (can be done in linuxdeploy on android)
Also copy /vendor from phone to installed system then wifi start working and we can install from netinst-cd with little less trouble, or install to .img maybe even folder from internal_sdcard, its much faster than booting from memory card
Here is my fresh install of debian stretch and kde, only modification is in lightdm-gtk-greeter.conf, 40-libinput.conf, xorg.conf (not needed much), /usr/share/initramfs-tools/scripts/local (hardcoded root partition and loop .img for boot) and added framebuffer_refresh systemd service. To install just unpack .zip to root of /data (sda25) and flash linux-boot.img to boot partition.
Sound, USB, and 24bit colors are still broken, but maybe still better than linux on dex with some hardware graphics acceleration like panfrost driver it may be better than my pc
Root - 16GB .img after unpack
https://mega.nz/#!zeAA3KzY!vK5g2HtI0H3CD654wx40w14VstT6ktLX6tzNsUMWNoU
Boot.img
https://mega.nz/#!LCQB0QJK!YKTflwPsAJosaxr0Bqlu_9XtfgCFxkgNCmrbyNNaBvM
Login as sisah with password 123456, root password 123456, kde wallet password is set to 123456 too. Made on n960f dual sim.
Sisah said:
Here is my fresh install of debian stretch and kde, only modification is in lightdm-gtk-greeter.conf, 40-libinput.conf, xorg.conf (not needed much), /usr/share/initramfs-tools/scripts/local (hardcoded root partition and loop .img for boot) and added framebuffer_refresh systemd service. To install just unpack .zip to root of /data (sda25) and flash linux-boot.img to boot partition.
Sound, USB, and 24bit colors are still broken, but maybe still better than linux on dex with some hardware graphics acceleration like panfrost driver it may be better than my pc
Root - 16GB .img after unpack
https://mega.nz/#!zeAA3KzY!vK5g2HtI0H3CD654wx40w14VstT6ktLX6tzNsUMWNoU
Boot.img
https://mega.nz/#!LCQB0QJK!YKTflwPsAJosaxr0Bqlu_9XtfgCFxkgNCmrbyNNaBvM
Login as sisah with password 123456, root password 123456, kde wallet password is set to 123456 too. Made on n960f dual sim.
Click to expand...
Click to collapse
Good work
@Sisah
I've managed to get USB to work. Here, take the code:
Code:
#!/bin/bash
mkdir -p /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1
echo 0xabcd > idVendor
echo 0x1234 > idProduct
mkdir -p strings/0x409
echo SM-960F > strings/0x409/serialnumber
echo Samsung > strings/0x409/manufacturer
echo Note9 > strings/0x409/product
# Config 1
mkdir -p configs/c.1
echo 120 > configs/c.1/MaxPower
mkdir -p configs/c.1/strings/0x409
echo "ACM" > configs/c.1/strings/0x409/configuration
mkdir functions/acm.GS0
ln -s functions/acm.GS0 configs/c.1
# Config 2
#mkdir -p configs/c.2
#echo 120 > configs/c.2/MaxPower
#mkdir -p configs/c.2/strings/0x409
#echo "RNDIS" > configs/c.2/strings/0x409/configuration
mkdir functions/rndis.usb0 # use default parameters
ln -s functions/rndis.usb0 configs/c.1
echo "acm,rndis" > /sys/class/android_usb/android0/functions
echo 10c00000.dwc3 > UDC
echo 1 > /sys/class/android_usb/android0/enable
# to unbind it: echo "" UDC; sleep 1; rm -rf /sys/kernel/config/usb_gadget/g1
/sbin/agetty -w -L 115200 ttyGS0 linux
exit 0
-W_O_L_F- said:
@Sisah
I've managed to get USB to work. Here, take the code:
Code:
#!/bin/bash
mkdir -p /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1
echo 0xabcd > idVendor
echo 0x1234 > idProduct
mkdir -p strings/0x409
echo SM-960F > strings/0x409/serialnumber
echo Samsung > strings/0x409/manufacturer
echo Note9 > strings/0x409/product
# Config 1
mkdir -p configs/c.1
echo 120 > configs/c.1/MaxPower
mkdir -p configs/c.1/strings/0x409
echo "ACM" > configs/c.1/strings/0x409/configuration
mkdir functions/acm.GS0
ln -s functions/acm.GS0 configs/c.1
# Config 2
#mkdir -p configs/c.2
#echo 120 > configs/c.2/MaxPower
#mkdir -p configs/c.2/strings/0x409
#echo "RNDIS" > configs/c.2/strings/0x409/configuration
mkdir functions/rndis.usb0 # use default parameters
ln -s functions/rndis.usb0 configs/c.1
echo "acm,rndis" > /sys/class/android_usb/android0/functions
echo 10c00000.dwc3 > UDC
echo 1 > /sys/class/android_usb/android0/enable
# to unbind it: echo "" UDC; sleep 1; rm -rf /sys/kernel/config/usb_gadget/g1
/sbin/agetty -w -L 115200 ttyGS0 linux
exit 0
Click to expand...
Click to collapse
Nice it enable usb, but still getting errors when i plug otg, and phone reboot if i connect it to pc, its strenge because i installed linux on more phones and otg alwais worked without any configuration.

Categories

Resources