Windows 11 Insider Preview build 22593.1 failed to install on my unsupported hardware. - Windows 11

1st i tried installing it through Windows Update, but after rebooting, the update didn't install, when i take a look at the update history, the error code is 0xc1900101
2nd i tried updating through ISO from uupdump.net, but at the point where my computer was about to reboot, it gave me an error called: Windows Server installation failed.

Hi!
Try this:
Copy this code and save as .bat.
Paste inside windows 11 setup folder and execute itas administrator!
Spoiler: Code
Code:
@(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
$_Paste_in_Powershell = { $Code = @'
$Nfo = 'Bypass TPM Check on Dynamic Update'
$Arg = (([environment]::get_CommandLine()-split'-[-]% ')[1]-split'.exe[\p{P}]? ')[1]
foreach ($x in 'Product','DynamicUpdate','Telemetry') {$Arg = $Arg -replace $('\p{P}?/'+ $x +'\p{P}? \p{P}?[A-Z]+\p{P}? '),' '}
$Cli = ' /DynamicUpdate Disable /Telemetry Disable ' + $Arg; $Srv = ' /Product Server' + $Cli
$Dir = join-path $([Environment]::SystemDirectory[0..2]-join'') '$WINDOWS.~BT\Sources\'
$Cfg = join-path $Dir 'EI.cfg'; $EI = '[Channel]' +[char]13+[char]10+ '_Default' +[char]13+[char]10
$Exe = join-path $Dir 'SetupHost.exe'; $Inf = get-item -force -lit $Exe; [int]$Ver = $Inf.VersionInfo.FileBuildPart
if ($Ver -ge 22000) {$Run = $Exe + $Srv} else {$Run = $Exe + $Cli}
if ($Ver -ge 22000 -and !(test-path $Cfg)) {[io.file]::WriteAllText($Cfg, $EI)}
[email protected](); [email protected](); [email protected](); $M=[AppDomain]::CurrentDomain.DefineDynamicAssembly(1,1).DefineDynamicModule(1)
foreach ($x in 0..2) {$D+=$M.DefineType('AveYo_'+$x,1179913,[ValueType])}; foreach ($x in 1..2) {$D+=$D[$x].MakeByRefType()}
$S=[string]; $I=[int32]; $U=[uintptr]; $y=0; $z=0; foreach ($x in $U,$U,$I,$I) {$9=$D[2].DefineField('f'+$y++,$x,6)}
foreach ($x in $I,$S,$S,$S,$I,$I,$I,$I,$I,$I,$I,$I,[int16],[int16],$U,$U,$U,$U) {$9=$D[1].DefineField('f'+$z++,$x,6)}
$9=$D[0].DefinePInvokeMethod('CreateProcess','kernel32',8214,1,[void],($S,$S,$I,$I,[bool],$I,$I,$S,$D[3],$D[4]),1,4)
$9=$D[0].DefinePInvokeMethod('DebugActiveProcessStop','kernel32',8214,1,[void],($I),1,4)
foreach ($x in 0..2) {$T+=$D[$x].CreateType()}; foreach ($x in 1..2) {$A+=[Activator]::CreateInstance($T[$x])}
$R=$null, $Run, $null, $null, $false, 0x02000011, $null, $null, $A[0], $A[1]
$T[0].GetMethod('CreateProcess').invoke(0, $R); $T[0].GetMethod('DebugActiveProcessStop').invoke(0, $R[9].f2)
$W=get-process -pid $R[9].f2 -ea 0; for (;;) {sleep 1; if (0-eq $R[9].f2 -or $null-eq $W -or $W.HasExited) {return} }
'@ -replace '\r?\n|\r', '; ' <# lines 20-29 are needed for escaping ifeo, remain calm ;) #>
$IFEO = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\SetupHost.exe'
$Prog = join-path $([Environment]::SystemDirectory[0..2] -join '') '$WINDOWS.~BT\Sources\SetupHost.exe'
$Skip = "powershell -win 1 -nop -c iex (get-itemproperty '$IFEO\0' 'Code' -ea 0).Code; write-host --%"
if (test-path "$IFEO\0") {
new-item "$IFEO\0" -force -ea 0 >''
set-itemproperty "$IFEO\0" 'Debugger' $Skip -force -ea 0; set-itemproperty "$IFEO\0" 'Code' $Code -force -ea 0
set-itemproperty "$IFEO\0" 'FilterFullPath' $Prog -force -ea 0; set-itemproperty $IFEO 'UseFilter' 1 -type dword -force -ea 0
} else {
new-item "$IFEO\0" -force -ea 0 >''
set-itemproperty "$IFEO\0" 'Debugger' $Skip -force -ea 0; set-itemproperty "$IFEO\0" 'Code' $Code -force -ea 0
set-itemproperty "$IFEO\0" 'FilterFullPath' $Prog -force -ea 0; set-itemproperty $IFEO 'UseFilter' 1 -type dword -force -ea 0
}
remove-item $($IFEO -replace 'SetupHost', 'vdsldr') -rec -force -ea 0 >''; rmdir (split-path $Prog) -rec -force -ea 0 >''
$N = 'Skip TPM Check on Dynamic Update' <# also remove wmi-based v1 if somehow still installed, not just vdsldr-based v2 - v5 #>
$U = 'root\subscription'; $C = gwmi -Class CommandLineEventConsumer -Namespace $U -Filter "Name='$N'" -ea 0
$B = gwmi -Class __FilterToConsumerBinding -Namespace $U -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
$F = gwmi -Class __EventFilter -NameSpace $U -Filter "Name='$N'" -ea 0; $B,$C,$F |% {$_|rwmi -ea 0}
} ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"; start setup.exe
$_Press_Enter
#::
Tell me if worked!

hello does this version still have a watermark? and is it possible to install normally?

Krzysztof 11 said:
hello does this version still have a watermark? and is it possible to install normally?
Click to expand...
Click to collapse
It still have a watermark and it is possible to install it normally as long as your computer meets the Windows 11 system requirements

persona78 said:
Hi!
Try this:
Copy this code and save as .bat.
Paste inside windows 11 setup folder and execute itas administrator!
Spoiler: Code
Code:
@(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
$_Paste_in_Powershell = { $Code = @'
$Nfo = 'Bypass TPM Check on Dynamic Update'
$Arg = (([environment]::get_CommandLine()-split'-[-]% ')[1]-split'.exe[\p{P}]? ')[1]
foreach ($x in 'Product','DynamicUpdate','Telemetry') {$Arg = $Arg -replace $('\p{P}?/'+ $x +'\p{P}? \p{P}?[A-Z]+\p{P}? '),' '}
$Cli = ' /DynamicUpdate Disable /Telemetry Disable ' + $Arg; $Srv = ' /Product Server' + $Cli
$Dir = join-path $([Environment]::SystemDirectory[0..2]-join'') '$WINDOWS.~BT\Sources\'
$Cfg = join-path $Dir 'EI.cfg'; $EI = '[Channel]' +[char]13+[char]10+ '_Default' +[char]13+[char]10
$Exe = join-path $Dir 'SetupHost.exe'; $Inf = get-item -force -lit $Exe; [int]$Ver = $Inf.VersionInfo.FileBuildPart
if ($Ver -ge 22000) {$Run = $Exe + $Srv} else {$Run = $Exe + $Cli}
if ($Ver -ge 22000 -and !(test-path $Cfg)) {[io.file]::WriteAllText($Cfg, $EI)}
[email protected](); [email protected](); [email protected](); $M=[AppDomain]::CurrentDomain.DefineDynamicAssembly(1,1).DefineDynamicModule(1)
foreach ($x in 0..2) {$D+=$M.DefineType('AveYo_'+$x,1179913,[ValueType])}; foreach ($x in 1..2) {$D+=$D[$x].MakeByRefType()}
$S=[string]; $I=[int32]; $U=[uintptr]; $y=0; $z=0; foreach ($x in $U,$U,$I,$I) {$9=$D[2].DefineField('f'+$y++,$x,6)}
foreach ($x in $I,$S,$S,$S,$I,$I,$I,$I,$I,$I,$I,$I,[int16],[int16],$U,$U,$U,$U) {$9=$D[1].DefineField('f'+$z++,$x,6)}
$9=$D[0].DefinePInvokeMethod('CreateProcess','kernel32',8214,1,[void],($S,$S,$I,$I,[bool],$I,$I,$S,$D[3],$D[4]),1,4)
$9=$D[0].DefinePInvokeMethod('DebugActiveProcessStop','kernel32',8214,1,[void],($I),1,4)
foreach ($x in 0..2) {$T+=$D[$x].CreateType()}; foreach ($x in 1..2) {$A+=[Activator]::CreateInstance($T[$x])}
$R=$null, $Run, $null, $null, $false, 0x02000011, $null, $null, $A[0], $A[1]
$T[0].GetMethod('CreateProcess').invoke(0, $R); $T[0].GetMethod('DebugActiveProcessStop').invoke(0, $R[9].f2)
$W=get-process -pid $R[9].f2 -ea 0; for (;;) {sleep 1; if (0-eq $R[9].f2 -or $null-eq $W -or $W.HasExited) {return} }
'@ -replace '\r?\n|\r', '; ' <# lines 20-29 are needed for escaping ifeo, remain calm ;) #>
$IFEO = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\SetupHost.exe'
$Prog = join-path $([Environment]::SystemDirectory[0..2] -join '') '$WINDOWS.~BT\Sources\SetupHost.exe'
$Skip = "powershell -win 1 -nop -c iex (get-itemproperty '$IFEO\0' 'Code' -ea 0).Code; write-host --%"
if (test-path "$IFEO\0") {
new-item "$IFEO\0" -force -ea 0 >''
set-itemproperty "$IFEO\0" 'Debugger' $Skip -force -ea 0; set-itemproperty "$IFEO\0" 'Code' $Code -force -ea 0
set-itemproperty "$IFEO\0" 'FilterFullPath' $Prog -force -ea 0; set-itemproperty $IFEO 'UseFilter' 1 -type dword -force -ea 0
} else {
new-item "$IFEO\0" -force -ea 0 >''
set-itemproperty "$IFEO\0" 'Debugger' $Skip -force -ea 0; set-itemproperty "$IFEO\0" 'Code' $Code -force -ea 0
set-itemproperty "$IFEO\0" 'FilterFullPath' $Prog -force -ea 0; set-itemproperty $IFEO 'UseFilter' 1 -type dword -force -ea 0
}
remove-item $($IFEO -replace 'SetupHost', 'vdsldr') -rec -force -ea 0 >''; rmdir (split-path $Prog) -rec -force -ea 0 >''
$N = 'Skip TPM Check on Dynamic Update' <# also remove wmi-based v1 if somehow still installed, not just vdsldr-based v2 - v5 #>
$U = 'root\subscription'; $C = gwmi -Class CommandLineEventConsumer -Namespace $U -Filter "Name='$N'" -ea 0
$B = gwmi -Class __FilterToConsumerBinding -Namespace $U -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
$F = gwmi -Class __EventFilter -NameSpace $U -Filter "Name='$N'" -ea 0; $B,$C,$F |% {$_|rwmi -ea 0}
} ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"; start setup.exe
$_Press_Enter
#::
Tell me if worked!
Click to expand...
Click to collapse
I have tried the script and it worked like a charm, thank you very much

frankof said:
I have tried the script and it worked like a charm, thank you very much
Click to expand...
Click to collapse
U R welcome!
Change add Solved to your post Header,

persona78 said:
U R welcome!
Change add Solved to your post Header,
Click to expand...
Click to collapse
Unfortunately you didn't noticed but I didn't open this post. I have just give you my feedback as Todortodorv didn't replied anything.

I have a question when will this watermark disappear? and is the white circle when starting the system will it be like that or will they change it?

Krzysztof 11 said:
I have a question when will this watermark disappear? and is the white circle when starting the system will it be like that or will they change it?
Click to expand...
Click to collapse
You can easily remove the watermark using the uwd program (Universal Watermark Disabler)
Download Universal Watermark Disabler
Universal Watermark Disabler is a little tool created by the author "PainteR". Winaero is allowed to distribute it with permissions granted by the author
winaero.com

Krzysztof 11 said:
I have a question when will this watermark disappear? and is the white circle when starting the system will it be like that or will they change it?
Click to expand...
Click to collapse
Windows unsuported watermark???
Copy this to notepad and save as bat, execut it and reboot:
Spoiler: Turn Off Windows Unsuported Hardware WaterMark
Code:
@echo off
setlocal
rem BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
setlocal
@echo. & @echo Turn OFF ‘System requirements not met’ Watermark on Windows 11 & @echo.
powershell.exe New-Item -Path 'HKCU:\Control Panel' -Name 'UnsupportedHardwareNotificationCache' -ErrorAction SilentlyContinue
powershell.exe New-ItemProperty -Path 'HKCU:\Control Panel\UnsupportedHardwareNotificationCache' -Name 'SV2' -PropertyType dword -Value 0 -force
@echo. & @echo Press any key to exit
pause > nul
exit

Don't know if this still works or if it's useful to any one but I did this when the leaked version of windows 11 insider preview first came out but can't test as I'm using legit one now. to by pass unsupported system nag and allow you to install on any machine.
Not sure about water mark as I didn't see any on the first version they may have added that in later builds all I can tell you this worked for the first leaked version .
Open win11 iso using 7zip
now open a win10 21H1 iso using 7zip
At first people were only getting this to work on a VM but thankfully times change
1. Create a folder on your desktop called "Windows 11 folder".
2. Open your win10 iso using 7zip and select all the Windows 10 files and copy to the "Windows 11 folder" on your desktop.
3. Open "Windows 11 folder" on the desktop go to "Sources" find file "Install.esd" and delete it.
2. Open your Windows 11 iso using zip and go to "Sources" and find "Install.wim" and copy it.
3. Now paste the "Install.wim" in the "Sources" directory in the "Windows 11 folder" on the desktop.
4. Download small prog called "ImgBurn" to create an ISO out of the contents of your Windows 11 folder. create and take
note of it's save destination.
5. Download Rufus to create a bootable image out of your new finished ISO.
It should now allow you to install.

CitizenSmith said:
Don't know if this still works or if it's useful to any one but I did this when the leaked version of windows 11 insider preview first came out but can't test as I'm using legit one now. to by pass unsupported system nag and allow you to install on any machine.
Not sure about water mark as I didn't see any on the first version they may have added that in later builds all I can tell you this worked for the first leaked version .
Open win11 iso using 7zip
now open a win10 21H1 iso using 7zip
At first people were only getting this to work on a VM but thankfully times change
1. Create a folder on your desktop called "Windows 11 folder".
2. Open your win10 iso using 7zip and select all the Windows 10 files and copy to the "Windows 11 folder" on your desktop.
3. Open "Windows 11 folder" on the desktop go to "Sources" find file "Install.esd" and delete it.
2. Open your Windows 11 iso using zip and go to "Sources" and find "Install.wim" and copy it.
3. Now paste the "Install.wim" in the "Sources" directory in the "Windows 11 folder" on the desktop.
4. Download small prog called "ImgBurn" to create an ISO out of the contents of your Windows 11 folder. create and take
note of it's save destination.
5. Download Rufus to create a bootable image out of your new finished ISO.
It should now allow you to install.
Click to expand...
Click to collapse
It turned out that Malwarebytes made the installation to fail

Teodortodorv said:
It turned out that Malwarebytes made the installation to fail
Click to expand...
Click to collapse
Did they not find a work around then?

If you get windows 11 up and running or have a final version running I highly recommend WPD it enables you to configure various privacy settings in Windows with simple individual on/off switches. loads of settings to choose from I've been using it since it was created. can take out loads on unnecessary Microsoft spyware and disables those what can't be removed like Edge and Cortana I'm running the final version of Win11 and windows is stable using WPD even when I have chosen to disable all except yellow marked ones, but even if you disable all and have issue its just a simple switch back on and reboot no harm done.
you can get it here. https://wpd.app/ if you fancy supporting it you get a handy Steam gaming platform add-on for the app with some extra's.
Two other free apps worth a mention are Glass2k get it @ https://chime.tv/products/glass2k.shtml
the sites Archived but download still works just scroll down to DL text.
and TranslucentTB which is available of google store or direct at Github https://github.com/TranslucentTB/TranslucentTB/releases
one makes the task bar totally transparent which ois so much nicer than coloured bar and the other makes any window semi transparent with various levels to choose from.
some nice little apps if your into visual effects like me.

wheni used rufus to make a Windows 11 bootable usb rufus has an option to select "installation without rerstrictions" options tab that pops up....and thats what allowed me to install windows 11 pro insider preview onto me Veriton core i5 desktop. may work for you may not im not sure but im only trying to help your situation, as i;ve went thru some difficulties trying to install windows 11 pro at first but then i re-flashed my bios firmware, and use rufus to make a bootable usb and then tried again and now im running
Edition Windows 11 Pro Insider Preview
Version 22H2
Installed on ‎2022-‎06-‎10
OS build 25136.1000
Experience Windows Feature Experience Pack 1000.25136.1000.0
on my Acer Veriton X4630G and I love it...been getting the insider previes updates every week now and its running smooth!!

Teodortodorv said:
1st i tried installing it through Windows Update, but after rebooting, the update didn't install, when i take a look at the update history, the error code is 0xc1900101
2nd i tried updating through ISO from uupdump.net, but at the point where my computer was about to reboot, it gave me an error called: Windows Server installation failed.
Click to expand...
Click to collapse
I had issues with Windows 11 in the beginning...i tried anything i could think of at first, but then i accidently booted up "RUFUS" instead of using the media creation tool for windows 11....and without realizing what i was doing i selected my windows iso and then "Standard Windows installation" or "extended installation without restrictions" menu popped up underneath the spot whetre the iso file goes...that was it..i flashed the usb drive...booted it up and viola Windows 11 Pro Insider Preview....**YOU NEED A INSIDER PREVIEW ACCOUNT FOR FUTURE UPDATES IF YOU CHOOSE TO OPERATE WINDOWS 11 WITHOUT THE 2.0TPM RESTRICTIONS** and if you get the yellow warning signs on the windows insider page of your operating system, i fixed it by re-flashing my bios firmware again...worked perfectly fine for me and im running;
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}

try rufus

Related

[TUTS/DEVELOPMENT] Kernel Development

Kernel Development Tutorials​
Important Links:
Ubuntu - http://www.ubuntu.com/download/ubuntu/download
Sourcery G++ Lite 2011.03-42 for ARM EABI - http://www.codesourcery.com/sgpp/lite/arm/portal/release1802
Stock Samsung Source - https://github.com/dharamg3/kernel_stock_g3 OR https://opensource.samsung.com/
Github for the Tutorials - https://github.com/dharamg3/g3_tuts
Source of Other Kernels to Compare:
G3MOD - Galaxy 3 - https://github.com/dharamg3/G3MOD
FuguMod - Galaxy 3 - https://github.com/sdadier/froyo
I will explain everything Step by Step.
If you got time to learn/develop join in.
If you get some step working and a fellow developer cant get it, please help each other by answering everyone's doubts.I cant reply to each and every query always.
Most of the code is to be run in the terminal. So I wont be mentioning to Open terminal every time.
I would like to thank marcellusbe who was the first one to make a proper custom Kernel for G3, who taught me how to build a kernel, and also lot of other help.
Note:
Please do not post useless messages.
If you dont know coding, please learn that first.
Do not flood my inbox with PM's. I will not respond to PM's regarding Kernel Development. Please post in the thread.
[*]I AM NOT RESPONSIBLE IF YOU HARDBRICK YOUR PHONE, DOING ANY OF THE FOLLOWING STEPS
Install Ubuntu(x86/x64)​
1. Install a virtual machine software.(VMware/Virtualbox)
2. Create a new Virtual Machine.
3. Use Ubuntu ISO to install. Download from here - http://www.ubuntu.com/download/ubuntu/download - I use Ubuntu 10.10 x86
4. Allocate enough space for the Virtual machine as the source is itself around 500mb for Kernel. And if you are like me, then you will want to keep backups at each stage.
5. Recommended RAM is 1GB.
6. Let Ubuntu be installed (VMware and Virtualbox have Easy Install which installs Ubuntu itself)
Logging In As Root​
1. When Ubuntu first boots, login with the username and password you mentioned while installing.
2. Open Terminal
3. Use following command.(Always the code after $/# is the one to be used. The one before that just specifies [email protected]:~)
## Anything after ## is a comment by me.
Code:
[email protected]:~$ sudo passwd
[sudo] password for dharammaniar: ## Enter password which you used to login.
Enter new UNIX password: ## Enter Password for root(it can be same as your prev password)
Retype new UNIX password: ## Re-Enter Password for root
passwd: password updated successfully
[email protected]:~$ su
Password: ## Enter the root password
[email protected]:/home/dharammaniar#
4. Once you get the last line as above means you now have root access.
5. Now logout from this user and login with username as root
6. On starting Terminal now, you should get
Code:
[email protected]:~#
Setting Up Build Environment​
1. You should always be running as root.
2. Go To System->Administration->Synaptic Package Manager
3. Search for ncurses-devel
4. Install libncurses5-dev.
5. Go to http://www.codesourcery.com/sgpp/lite/arm/portal/release1802
6. Download IA32 GNU/Linux Installer. Keep the arm-2011.03-42-arm-none-eabi.bin file on the desktop.(I like to keep everything on the desktop for faster access)
7. Run code and select NO
Code:
dpkg-reconfigure -plow dash
8. Run Installer using code
Code:
apt-get install ia32-libs ## FOR THOSE WHO HAVE x64 Ubuntu installed
/bin/sh /root/Desktop/arm-2011.03-42-arm-none-eabi.bin ## THANKS TO cdesai for the tip :)
9. Do the usual Next Next Next Next.Dont change any paths.Install as typical.
10. Wait till it is installing
11. Wait more
12. Still waiting
13. Again Next -> Done.
14. You now have the development environment ready.
Downloading Sources​
1. Download Samsung Source from https://opensource.samsung.com/ or https://github.com/dharamg3/kernel_stock_g3
2. If you download from https://opensource.samsung.com/ then you will not have the initramfs.
3. To get stock initramfs, you need to extract it from one of the stock kernel(I will explain it later).
Extracting initramfs from zImage​Based on script from mizch - http://forum.xda-developers.com/showthread.php?t=901152​
Download Files from the attachments.
1. Extract files from initramfs-utils.zip to /bin/
2. Make a folder on the Desktop named unpack.
3. Extract the repack-zImage.sh file from repack-zImage.v6.zip in the unpack folder on Desktop.
4. Add your zImage from which you want to extract initramfs in the unpack folder.
5. Run Command
Code:
cd /root/Desktop/unpack
sh repack-zImage.sh -u
6. You will get the unpacked zImage in the same folder which will contain the initramfs folder also.
Note: To make things simple, i use a script to unpack.
Download from attachment.
Add this unpack.sh file to your unpack folder and run it by double clicking
Building Kernel​
1. Download Source as mentioned in the above tutorial.
2. Create a folder on the Desktop. I have named it g3.
3. Add initramfs folder and Kernel folder in that folder.
4. Run Code to make initramfs.cpio
Code:
cd initramfs
find . -print0 | cpio --null -ov --format=newc > ../initramfs.cpio
5. You can also use the script named initramfs.sh from attachments. Copy it to the g3 folder and run it by double clicking.
6. By doing step 4 or 5 you will get initramfs.cpio in the g3 folder.
7. Next you need to do is modify the makefile in Kernel folder.
Original is
Code:
ARCH := arm
CROSS_COMPILE := /opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-
Change to
Code:
ARCH := arm
CROSS_COMPILE := /root/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi-
8. Now you need the configuration file.
9. Copy the apollo_rev_02_android_defconfig file from /Kernel/arch/arm/configs to /Kernel/
10. Rename it to .config (Note: It should be only .config and not apollo_rev_02_android_defconfig.config)
11. Now in Terminal run the following code.
Code:
cd /root/Desktop/g3/Kernel
make menuconfig
12. You will get a GUI menu.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
13. Go to General Setup
14. Next go to Initramfs source file(s)
15. Press Enter and give path as
Code:
../initramfs.cpio
16. Exit from menuconfig
17. Enter Code
Code:
make
OR
Code:
make -j4 ## THIS ONE ONLY IF YOU GOT A GOOD CPU THAT SUPPORTS MULTI-THREADING :)
18. Building will start. There will be many warnings. Ignore them.
19. After building is finished, you will get zImage at /Kernel/arch/arm/boot/
20. Add this zImage to a test.tar(attachment) using Total Commander.
21. Flash as One Package in Odin.
22. Enjoy
Note: This is the stock kernel and supports only rfs filesystem. So before flashing it, please change filesystem to rfs and then flash.
Kernel Basics​
The Kernel is basically divided into 2 parts.
The Kernel and the initramfs.Those are the two folders in your g3folder.
initramfs
initramfs is a root filesystem which is embedded into the kernel and loaded at an early stage of the boot process. It is the successor of initrd. It provides early userspace which lets you do things that the kernel can't easily do by itself during the boot process.
GIT Commits​
I will commit my source every time i make a tutorial. You can check out all the commits on my github for the tutorials - https://github.com/dharamg3/g3_tuts
Fixed Sound Click Bug During Calls - https://github.com/dharamg3/g3_tuts/commit/2f623a5fb88062deb5dbc7d8d1040c05f43b3d91
1% Battery MOD - https://github.com/dharamg3/g3_tuts/commit/f5259a58f14351ccffee49e9fc235b9670369b90
Voodoo Sound v10 - https://github.com/dharamg3/g3_tuts/commit/0bb0f9a538fdb59138e0bcc957d33aa15fd39155
ADB Root and BusyBox - https://github.com/dharamg3/g3_tuts/commit/57424d6a122e6ff219165fd718de8555029a1079
FileSystem Support - https://github.com/dharamg3/g3_tuts/commit/5db762b1402f7775af4ef7da395d5c9d0b99ed0f
Kernel Modding - Part 1​
PLEASE DONT ASK HOW OR WHY ANY PART IS DONE. I WILL EXPLAIN ALL THAT I KNOW. BUT SOME PART OF THIS HAS BEEN DONE BY TRIAL AND ERROR METHOD, WHEREAS SOME PART MAYBE OUT OF MY SCOPE OF KNOWLEDGE.
Removing The Sound Click Bug During Calls
We all know that this is the most basic bug found out in the Kernel of Samsung. The clicking sound we get during calls. Many of you may complain that this bug is solved in the newer ROM's, but remember we are building from the original Samsung Source, which is modified in the newer kernel's. We dont have those modifications so here it goes, the Sound Click Bug.
We to find out this bug you need to check the dmesg when you are in a call.
It shows you that there is some sound routing done during the call. So you know that this is something related to the sound driver.
Now the sound driver for Galaxy 3 is the wm8994 driver, which is present at Kernel/sound/soc/codecs/
So the changes to be made are in the file wm8994.c
In the function static int wm8994_resume(struct platform_device *pdev)
Originally the code was
Code:
if (wm8994_power == 0) {
audio_power(1); /* Board Specific function */
wm8994_power = 1;
}
wm8994_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
wm8994_enable_path(codec, wm8994_curr_path);
After editing the code is
Code:
if (wm8994_power == 0) {
audio_power(1); /* Board Specific function */
wm8994_power = 1;
wm8994_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
wm8994_enable_path(codec, wm8994_curr_path);
}
1% Battery MOD
The battery driver for galaxy 3 is found at Kernel/drivers/power/
The file to be added is s5p6442_battery.c
The Samsung battery driver originally divides battery in the following Steps:
100,90,80,70,60,50,40,30,20,15,5,3,1
If you look at the source code, you should be able to find that out easily.
We need to make it return each value in between also so that we get the 1% MOD that is required.
So now, the original code was
Code:
if (bat_vol > batt_full)
{
int temp = (batt_max - batt_full);
if (bat_vol > (batt_full + temp) ||
s3c_bat_info.bat_info.batt_is_full)
bat_level = 100;
else
bat_level = 90;
#ifdef __CHECK_CHG_CURRENT__
if (s3c_bat_info.bat_info.charging_enabled) {
check_chg_current(bat_ps);
if (!s3c_bat_info.bat_info.batt_is_full)
bat_level = 90;
}
#endif /* __CHECK_CHG_CURRENT__ */
dev_dbg(dev, "%s: (full)level = %d\n", __func__, bat_level );
}
else if (batt_full >= bat_vol && bat_vol > batt_almost)
{
int temp = (batt_full - batt_almost) / 2;
if (bat_vol > (batt_almost + 86))
bat_level = 80;
else
bat_level = 70;
dev_dbg(dev, "%s: (almost)level = %d\n", __func__, bat_level);
}
else if (batt_almost >= bat_vol && bat_vol > batt_high)
{
int temp = (batt_almost - batt_high) / 2;
if (bat_vol > (batt_high + 62))
bat_level = 60;
else
bat_level = 50;
dev_dbg(dev, "%s: (high)level = %d\n", __func__, bat_level );
}
else if (batt_high >= bat_vol && bat_vol > batt_medium)
{
int temp = (batt_high - batt_medium) / 2;
if (bat_vol > (batt_medium + 26))
bat_level = 40;
else
bat_level = 30;
dev_dbg(dev, "%s: (med)level = %d\n", __func__, bat_level);
}
else if (batt_medium >= bat_vol && bat_vol > batt_low)
{
int temp = (batt_medium - batt_low) / 2;
if (bat_vol > (batt_low + 50))
bat_level = 20;
else
bat_level = 15;
dev_dbg(dev, "%s: (low)level = %d\n", __func__, bat_level);
}
else if (batt_low >= bat_vol && bat_vol > batt_critical)
{
bat_level = 5;
dev_dbg(dev, "%s: (cri)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_critical >= bat_vol && bat_vol > batt_min)
{
bat_level = 3;
dev_info(dev, "%s: (min)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_min >= bat_vol && bat_vol > batt_off)
{
bat_level = 1;
dev_info(dev, "%s: (off)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_off >= bat_vol)
{
bat_level = 0;
dev_info(dev, "%s: (off)level = %d, vol = %d", __func__,
bat_level, bat_vol);
}
We need to edit it to make
Code:
if (bat_vol > batt_full)
{
int temp = (batt_max - batt_full);
if (bat_vol > (batt_full + temp) ||
s3c_bat_info.bat_info.batt_is_full)
bat_level = 100;
else
{
bat_level = 90 + (((bat_vol - batt_full) *10) / temp);
}
#ifdef __CHECK_CHG_CURRENT__
if (s3c_bat_info.bat_info.charging_enabled) {
check_chg_current(bat_ps);
if (!s3c_bat_info.bat_info.batt_is_full)
bat_level = 90;
}
#endif /* __CHECK_CHG_CURRENT__ */
dev_dbg(dev, "%s: (full)level = %d\n", __func__, bat_level );
}
else if (batt_full >= bat_vol && bat_vol > batt_almost)
{
int temp = (batt_full - batt_almost) / 2;
bat_level = 70 + (((bat_vol - batt_almost) *10) / temp);
dev_dbg(dev, "%s: (almost)level = %d\n", __func__, bat_level);
}
else if (batt_almost >= bat_vol && bat_vol > batt_high)
{
int temp = (batt_almost - batt_high) / 2;
bat_level = 50 + (((bat_vol - batt_high) *10) / temp);
dev_dbg(dev, "%s: (high)level = %d\n", __func__, bat_level );
}
else if (batt_high >= bat_vol && bat_vol > batt_medium)
{
int temp = (batt_high - batt_medium) / 2;
bat_level = 30 + (((bat_vol - batt_medium) *10) / temp);
dev_dbg(dev, "%s: (med)level = %d\n", __func__, bat_level);
}
else if (batt_medium >= bat_vol && bat_vol > batt_low)
{
int temp = (batt_medium - batt_low) / 2;
bat_level = 15 + ((( bat_vol - batt_low) *5) / temp);
dev_dbg(dev, "%s: (low)level = %d\n", __func__, bat_level);
}
else if (batt_low >= bat_vol && bat_vol > batt_critical)
{
bat_level = 5;
dev_dbg(dev, "%s: (cri)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_critical >= bat_vol && bat_vol > batt_min)
{
bat_level = 3;
dev_info(dev, "%s: (min)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_min >= bat_vol && bat_vol > batt_off)
{
bat_level = 1;
dev_info(dev, "%s: (off)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_off >= bat_vol)
{
bat_level = 0;
dev_info(dev, "%s: (off)level = %d, vol = %d", __func__,
bat_level, bat_vol);
}
and also we need to change the Total ADC count
Originally
Code:
#define ADC_TOTAL_COUNT 20
Change it to
Code:
#define ADC_TOTAL_COUNT 100
Voodoo Sound Driver
The Sound Driver for Galaxy 3 is the wm8994 Wolfson Microelectronics Codec.
The WM8994 is a highly integrated ultra-low power hi-fi CODEC designed for smartphones and other portable devices rich in multimedia features.
Features
Hi-Fi 24-bit 4-channel DAC and 2-channel ADC
100dB SNR during stereo DAC playback (‘A’ weighted)
Smart MIC interface
- Power, clocking and data input for up to four digital MICs
- High performance analogue MIC interface
- MIC activity monitor & interrupt allows processor to sleep
1W stereo / 2W mono class D/AB speaker driver
Capless class W headphone drivers
- Integrated charge pump
- 6mW total power for DAC playback to headphones
4 line outputs (single-ended or differential)
BTL earpiece driver
Digital audio interfaces for multi-processor architecture
- Asynchronous stereo duplex sample rate conversion
- Powerful mixing and digital loopback functions
ReTune™ Mobile 5-band, 6-channel parametric EQ
Programmable dynamic range controller
Dual FLL provides all necessary clocks
- Self-clocking modes allows processor to sleep
- All standard sample rates from 8kHz to 96kHz
Active noise reduction circuits
- DC offset correction removes pops and clicks
- Ground loop noise cancellation
Integrated LDO regulators
72-ball W-CSP package (4.511mm x 4.023mm x 0.7mm)
The Voodoo Driver is developed by supercurio.
The changes to be made for the voodoo driver are at sound/soc/codec/
The Changes are as the following Commit. (Please ignore the /Kernel/scripts part....I forgot to do a make clean -i before commiting )
RootADB and BusyBox
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:
A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
A daemon, which runs as a background process on each emulator or device instance.
You can find the adb tool in <sdk>/platform-tools/.
RootADB gives you root access while performing adb functions.
BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system.
BusyBox has been written with size-optimization and limited resources in mind. It is also extremely modular so you can easily include or exclude commands (or features) at compile time. This makes it easy to customize your embedded systems. To create a working system, just add some device nodes in /dev, a few configuration files in /etc, and a Linux kernel.
The Changes to be made for these are in the initramfs.
These can be found in this Commit.
Kernel Modding - Part 2​
PLEASE DONT ASK HOW OR WHY ANY PART IS DONE. I WILL EXPLAIN ALL THAT I KNOW. BUT SOME PART OF THIS HAS BEEN DONE BY TRIAL AND ERROR METHOD, WHEREAS SOME PART MAYBE OUT OF MY SCOPE OF KNOWLEDGE.
File System Support: rfs/ext2/ext3/ext4
RFS
SAMSUNG RFS (Robust File System) is an embedded flash file system that uses SAMSUNG OneNAND flash memory as storage on any consumer electronic devices.
SAMSUNG RFS runs in the Linux kernel and is fully compatible with FAT file system standards (FAT16/32).
EXT2
http://en.wikipedia.org/wiki/Ext2
EXT3
http://en.wikipedia.org/wiki/Ext3
EXT4
http://en.wikipedia.org/wiki/Ext4
[DEV] Debate: ext2 vs ext3 vs ext4 : http://forum.xda-developers.com/showthread.php?t=800353
[REF] Information About Filesystems : http://forum.xda-developers.com/showthread.php?t=1058095
The changes to be done are as in the commit.
Reserved
Reserved
Reserved
Too many reserved post as usual (all you need is one post to explain all )
Anyways I'll make videos on this soon..
all the users need to know is to install Ubuntu by themself.. everything else will be covered in the video.
well, i intend to add everything here...including where to mod, which code and stuff...
nice to see your post.... XD
dharam can you post some information about overlocking and undervolt?i need it indeed
dxdiag32 said:
nice to see your post.... XD
dharam can you post some information about overlocking and undervolt?i need it indeed
Click to expand...
Click to collapse
everything will come in time...
Thks man, i have never known how to make a kernal before
Sent from my GT-I5801 using XDA App
I hav one question. This tutorial wil b in general or this is specifically for g3?
rudolf895 said:
Too many reserved post as usual (all you need is one post to explain all )
Anyways I'll make videos on this soon..
all the users need to know is to install Ubuntu by themself.. everything else will be covered in the video.
Click to expand...
Click to collapse
the big advantage of having multiple posts reserved is that you can have som kind of directory on the first post linking to the sections in the other posts, this is of big use in a massive theme like kernel development. also i do not see why nobody does this here as of now, always they reserve multiple posts and nobody links them in first post, what makes the use of them obsolete...
vikraam said:
I hav one question. This tutorial wil b in general or this is specifically for g3?
Click to expand...
Click to collapse
well, specifically for g3...the basic steps are same for all phones, but the code and stuff will be more specific for g3...
dharamg3 said:
well, specifically for g3...the basic steps are same for all phones, but the code and stuff will be more specific for g3...
Click to expand...
Click to collapse
I wud like to thank u a million times. Thanq very very much
Hey first a great Karnel now How to make one!!! good going!!! Thanks Mate

[Q] How can I install zip programmatically from an app

Hi, I'm trying to build an app which will automatically reboot recovery and flash a zip from my sd card.
This app can use system app permission since I am going to use it as a system app,
How can I do this?
I tried this code
Code:
File zip = new File("/sdcard/test.zip");
if(zip.exists()) {
Toast.makeText(context,"ZIP EXIST!",Toast.LENGTH_LONG).show();
Process p = Runtime.getRuntime().exec("sh");
OutputStream os = p.getOutputStream();
os.write("mkdir -p /cache/recovery/\n".getBytes());
os.write("echo 'boot-recovery' >/cache/recovery/command\n".getBytes());
String cmd = "echo '--update_package=/sdcard/test.zip' >> /cache/recovery/command\n";
os.write(cmd.getBytes());
os.flush();
// Trigger the reboot
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
powerManager.reboot("recovery");
}
else{
Toast.makeText(context,"ZIP NOT EXIST!",Toast.LENGTH_LONG).show();
}
I also tried this code:
Code:
Process p = Runtime.getRuntime().exec("/system/bin/sh");
OutputStream os = p.getOutputStream();
os.write("echo 'boot-recovery ' > /cache/recovery/command".getBytes());
os.write("echo '--update_package=/sdcard/test.zip' >> /cache/recovery/command".getBytes());
os.write("echo '--wipe_cache' >> /cache/recovery/command".getBytes());
os.write("echo 'reboot' >> /cache/recovery/command".getBytes());
os.write("reboot recovery".getBytes());
os.flush();
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
powerManager.reboot("recovery");
But all it does is to reboot recovery, it does not flash my zip.
Please help.
Did you solve it?
You cannot
You cannot have an app unmounting and wiping /system while keeping android running. You HAVE to reboot to recovery to install zips.

ADB Tools with C#

Hello XDA,
I am writing ADB TOOLs in C# but having a problem with PATH recognition
Code:
private void button6_Click(object sender, EventArgs e)
{
openFileDialog1.InitialDirectory = @"C:\";
openFileDialog1.Title = "Select Kernel File";
openFileDialog1.FileName = "Choose File";
openFileDialog1.CheckFileExists = true;
openFileDialog1.CheckFileExists = true;
openFileDialog1.Filter = ".IMG|*.img";
if (openFileDialog1 .ShowDialog () == DialogResult .OK)
{
label1.Text = openFileDialog1 .FileName;
var process = Process.Start("CMD.exe", "/c fastboot flash boot " [COLOR="Red"]+ textBox2.Text[/COLOR] );
process.WaitForExit();
}
The red marked code has a problem i think, when i select a kernel image file located inside multiple directory to flash the CMD opens and just closes in a second nothing actually happens in a phone but when i use a file from a desktop it flashes w/o any problem.
I tried using path.combine( ) but really don't know how to use it, just started writing things in C#.
Thanks!
Bump!:fingers-crossed:
Bump Bump:crying:

Use Accelerate Kit to calculate PI number

Prerequisites
Android Studio 3.6
Android SDK
Kotlin 1.3.72
Required knowledge
C programming language
Multithreading programming
Integration steps
Add the native build support to your build.gradle file
Code:
externalNativeBuild {
cmake {
cppFlags ""
arguments "-DANDROID_STL=c++_shared"
}
}
ndk {
abiFilters "arm64-v8a","armeabi-v7a"
}
Download the SDK package from this link and decompress it
Copy the header files in the SDK to the resource library.
In the /app directory in the Android Studio project, create an include folder. Copy the files in the /include directory of the SDK to the newly created include folder.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Copy the .so files in the SDK to the resource library.
Create a libs folder in the /app directory and create arm64-v8a folder and armeabi-v7a folder in /app/libs directory.
Copy the libdispatch.so and libBlockRuntime.so in lib64 directory of the SDK to libs/arm64-v8a directory of Android Studio.
Copy the libdispatch.so and libBlockRuntime.so in the lib directory of the SDK to the libs/armeabi-v7a directory of Android Studio.
Create or modify the CMakeLists.txt file in the app/src/main/cpp directory as follows
Code:
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
target_include_directories(
native-lib
PRIVATE
${CMAKE_SOURCE_DIR}/../../../include)
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
add_library(
dispatch
SHARED
IMPORTED)
set_target_properties(
dispatch
PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libdispatch.so)
add_library(
BlocksRuntime
SHARED
IMPORTED)
set_target_properties(
BlocksRuntime
PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libBlocksRuntime.so)
add_custom_command(
TARGET native-lib POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libdispatch.so
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/
COMMAND
${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libBlocksRuntime.so
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/
)
target_compile_options(native-lib PRIVATE -fblocks)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
native-lib
dispatch
BlocksRuntime
# Links the target library to the log library
# included in the NDK.
${log-lib} )
From Android Studio, select Build → Linked C++ projects
Download the NDK if not configured and install it then sync with your projects
PI Formula
We will use the two below formula to calculate PI number
Nilakantha series
Coding steps
Open your application class and add the below code to load the native library when the application is created
Code:
companion object {
// Used to load the 'native-lib' library on application startup.
init {
System.loadLibrary("native-lib")
}
}
On your demo activity, remember to add the external functions as below
Code:
/**
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
private external fun doubleFromJNI(): Double
private external fun doubleFromJNI2(): Double
Then defined these functions in app/src/main/native-lib.cpp as below ( I will explain the dispatch functions later)
Code:
extern "C"
JNIEXPORT jdouble JNICALL
Java_com_pushdemo_jp_huawei_activity_AccelerateDemoActivity_doubleFromJNI(JNIEnv *env,
jobject thiz) {
dispatch_autostat_enable(env);
return dispatch1();
}
extern "C"
JNIEXPORT jdouble JNICALL
Java_com_pushdemo_jp_huawei_activity_AccelerateDemoActivity_doubleFromJNI2(JNIEnv *env,
jobject thiz) {
dispatch_autostat_enable(env);
return dispatch2();
}
For each formula, we will implement each function to calculate and divide them into subthread to execute to save time
For Nilakantha series, we will divide into 2 subthreads, and values of i set as follows:
[2, 6, 10, 14, ...]
[4, 8, 12, 16, ...]
Code:
double calcPiByStep(long start, long end, int step)
{
double total = 0.0;
int sign;
for (long i = start; i <= end; i += step)
{
long frag = i * (i + 1) * (i + 2);
sign = i % 4 == 0 ? -1 : 1;
double val = 4.0 * sign / frag;
total += val;
}
return total;
}
Then we will implement the dispatch1 function to summarize the result. First, create the concurrent queue, the serial queue, and the group queue. Then asynchronously add the subtask calcPiByStep to the concurrent queue, and associate the subtask with the group queue.
Code:
double dispatch1()
{
int i;
int step = 4;
long start = 2;
long limit = 1000000000;
__block double pi_total = 3;
dispatch_queue_t concurr_q = dispatch_queue_create("concurrent", DISPATCH_QUEUE_CONCURRENT);
dispatch_queue_t serial_q = dispatch_queue_create("serial", DISPATCH_QUEUE_SERIAL);
dispatch_group_t group = dispatch_group_create();
for (i = 0; i < step; i += 2) {
dispatch_group_async(group, concurr_q, ^{
double pi = calcPiByStep(start + i, limit, step);
dispatch_sync(serial_q, ^{
pi_total += pi;
});
});
}
dispatch_wait(group, DISPATCH_TIME_FOREVER);
dispatch_release(group);
dispatch_release(serial_q);
return pi_total;
} 
For Gregory and Leibniz series, we will divide into 4 subthreads, and values of i set as follows:
[0, 4, 8, 12, ...]
[1, 5, 9, 13, ...]
[2, 6, 10, 14, ...]
[3, 7, 11, 15, ...]
Code:
double calcPiByStep2(long start, long end, int step)
{
double total = 0.0;
int sign;
for (long i = start; i <= end; i+= step)
{
long frag = 2 * i + 1;
sign = i % 2 == 0 ? 1 : -1;
total += 4.0 * sign / frag;
}
return total;
}
Then we will execute 4 subthreads concurrently as below
Code:
double dispatch2() {
__block double pi = 0;
int mod = 4;
int i = 0;
long limit = 1000000000;
dispatch_queue_t serial = dispatch_queue_create("serial", DISPATCH_QUEUE_SERIAL);
dispatch_apply(mod, DISPATCH_APPLY_AUTO, ^(size_t i) {
double _sum = calcPiByStep2(i, limit, mod);
dispatch_sync(serial, ^{
pi += _sum;
});
});
dispatch_release(serial);
return pi;
}
Result
For HMS devices, the result is quite fast. It took around 1.7 seconds to execute the dispatch1 and 1.4 seconds to execute the dispatch2
But for non-HMS devices, the calculation took longer times: around 6.7 seconds for dispatch1 and 3.5 seconds for dispatch2
Conclusion
The performance depends on the chipset. For HMS devices (using Kirin chip), the performance is good but for non-HMS devices (using other chip), the performance needs to be improved.

Question Windows 11 doesn't remember folder settings

Windows 11 how do I make all files and folders appear as General items and always sorted by date modified and detailed view?
I'm doing the usual ways through file options, but it doesn't work.
In all folders and for some reason it doesn't remember what settings I saved. Is there a way or reg file to make it sealed in the system and that can't be changed?
Chat gpt gave this yet to try ( didn't worked )
Spoiler: Windows Registry Editor Version 5.00
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell]
"FolderType"="NotSpecified"
[HKEY_CURRENT_USER/Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{5C4F28B5-F869-4E84-8E60-F11DB97C5CC7}
"LogicalViewMode"=dword:00000001
"Mode"=dword:00000004
"SortColumn"="prop:System.DateModified"
"SortOrder"="dword:00000001"
Also when win+e it opens home and there are a bunch of things and it slows down, there is a change button to open my computer but it also changes back
When I press saved shortcuts favorites on the left side of the Quick access toolbar, it finds the folder it is in and the view jumps down, and every time I have to scroll up again and again each time I press any favorite.
And when, for example, I need to select a file to upload somewhere, it also does not save the settings and every time hell need yi change the view manually
Please help to sort these problems
Thanks
chat gpt gave this script for PowerShell, not sure if it works
Spoiler: # Specify the view mode and sorting options $viewMode = 1
# Specify the view mode and sorting options
$viewMode = 1 # 1 for Details view
$sortColumn = "System.DateModified"
$sortOrder = 1 # 1 for ascending order, 0 for descending order
# Function to update the view settings for a folder
function UpdateFolderView($folderPath) {
# Path to the desktop.ini file
$desktopIniPath = Join-Path -Path $folderPath -ChildPath "desktop.ini"
# Check if the desktop.ini file exists
if (!(Test-Path -Path $desktopIniPath)) {
# Create the desktop.ini file
New-Item -Path $desktopIniPath -ItemType File | Out-Null
}
# Set the attributes of the desktop.ini file to be hidden and system
(Get-Item -Path $desktopIniPath).Attributes = 'Hidden', 'System'
# Update the content of the desktop.ini file
@"
[ViewState]
Mode=$viewMode
Vid=$sortColumn
Sort=$sortOrder
"@ | Out-File -FilePath $desktopIniPath -Encoding ASCII
}
# Specify the drive letters to target
$driveLetters = 'C', 'F'
# Loop through each drive
foreach ($driveLetter in $driveLetters) {
$drivePath = "$($driveLetter):\"
# Get all folders, including hidden ones, on the drive
$folders = Get-ChildItem -Path $drivePath -Directory -Recurse -Force -ErrorAction SilentlyContinue
# Loop through each folder and update the view settings
foreach ($folder in $folders) {
$folderPath = $folder.FullName
try {
UpdateFolderView -folderPath $folderPath
} catch [System.UnauthorizedAccessException] {
Write-Warning "Skipping folder: $folderPath. Access denied."
} catch {
Write-Warning "An error occurred while processing folder: $folderPath."
}
}
}
Best Windows 11 Folder Settings [Tips & Tricks]
If you wish to keep your PC folder organized, you must check out these Windows 11 folder settings tips and tricks.
windowsreport.com

Categories

Resources