WSL2 Ubuntu

发布于:2025-07-30 ⋅ 阅读:(17) ⋅ 点赞:(0)

WSL2

win10

https://docs.microsoft.com/zh-cn/windows/wsl/install-win10
https://www.docker.com/products/docker-desktop

wsl_update_x64.msi
Docker Desktop Installer.exe

docker run -dp 80:80 docker/getting-started

move to e

wsl -l --all -v
wsl --export Ubuntu-16.04 e:\Ubuntu1604.tar
wsl --unregister Ubuntu-16.04
wsl --import Ubuntu-16.04 e:\wsl e:\Ubuntu1604.tar --vers

docker-desktop-data

https://github.com/docker/for-win/issues/7348

wsl --shutdown
wsl --export docker-desktop-data e:\SoftwareData\wsl\docker-desktop-data\docker-desktop-data.tar
wsl --import docker-desktop-data E:\SoftwareData\wsl\docker-desktop-data\ E:\SoftwareData\wsl\docker-desktop-data\docker-desktop-data.tar --version 2

.wslconfig

%UserProfile%/.wslconfig

[wsl2]
memory=8GB
swap=0
#swap=2GB
localhostForwarding=true

 adb

ln -s /mnt/d/software/platform-tools/adb.exe /usr/local/bin/adb

win11

wsl --list --online
wsl --install -d Ubuntu-24.04 --location e:\wsl

ftp telnet

apt install inetutils-ftp inetutils-telnet

Ubuntu 16.04.6 TLS

android 9

apt install libswitch-perl libfile-copy-recursive-perl libxml-parser-perl libxml-libxml-perl libxml-simple-perl
apt install lib32stdc++6
apt install m4
apt install libc6-dev-i386

Ubuntu 24.04.1 LTS

nvt repack

apt install lzop cpio android-sdk-libsparse-utils u-boot-tools libpcre3
scp /usr/bin/make_ext4fs

android 9

git clone https://mirrors.ustc.edu.cn/aosp/git-repo repo
.repo/repo/repo sync -l

locale-gen en_US.UTF-8
apt install make
ln -sf /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5
apt install libswitch-perl libfile-copy-recursive-perl libxml-parser-perl libxml-libxml-perl libxml-simple-perl

python3

device/autochips

--- a/build/build/tools/check_kernel_config.py
+++ b/build/build/tools/check_kernel_config.py
@@ -121,8 +121,8 @@ def parse_opt(opts):

 def get_projectConfiguration(prjConfig):
     """query the current platform"""
-    pattern = [re.compile("^([^=\s]+)\s*=\s*(.+)$"),
-               re.compile("^([^=\s]+)\s*=$")]
+    pattern = [re.compile(r"^([^=\s]+)\s*=\s*(.+)$"),
+               re.compile(r"^([^=\s]+)\s*=$")]
     config = {}
     ff = open(prjConfig, "r")
     for line in ff.readlines():
@@ -191,7 +191,7 @@ def run_gen_defconfig(prjOption, kOption):
                     print >> sys.stdout, "*** Int ERROR ***: CONFIG_%s not sync with %s in ProjectConfig.mk" % (i,i)
                     return_code += 1
         elif len(prjOption[i]) > 0:
-            pattern = re.compile('^0x\w*')
+            pattern = re.compile(r'^0x\w*')
             match = pattern.match(prjOption[i])
             if match:
                 #print >> sys.stdout, 'CONFIG_' + i + '=%s' % prjOption[i]
@@ -215,8 +215,8 @@ def run_gen_defconfig(prjOption, kOption):
     for i in mandatory_subsys_FOs.keys():
         if not "kernel" in mandatory_subsys_FOs[i]: continue
         if not kOption.has_key('CONFIG_' + i) and prjOption[i] != "no":
-            print "*** Config Inconsistency ERROR ***: " \
-                "%s is missing in kernel config setting" % (i)
+            print ("*** Config Inconsistency ERROR ***: " \
+                "%s is missing in kernel config setting" % (i))
             return_code += 1

     return return_code
@@ -272,8 +272,8 @@ def run_check_pl_config(prjOption, plOption):
     for i in mandatory_subsys_FOs.keys():
         if not "preloader" in mandatory_subsys_FOs[i]: continue
         if not plOption.has_key(i) and prjOption[i] != "no":
-            print "*** Config Inconsistency ERROR ***: " \
-                "%s is missing in Preloader config setting" % (i)
+            print ("*** Config Inconsistency ERROR ***: " \
+                "%s is missing in Preloader config setting" % (i))
             return_code += 1

     return return_code
@@ -293,8 +293,8 @@ def run_check_lk_config(prjOption, lkOption):
     for i in mandatory_subsys_FOs.keys():
         if not "lk" in mandatory_subsys_FOs[i]: continue
         if not lkOption.has_key(i) and prjOption[i] != "no":
-            print "*** Config Inconsistency ERROR ***: " \
-                "%s is missing in LK config setting" % (i)
+            print ("*** Config Inconsistency ERROR ***: " \
+                "%s is missing in LK config setting" % (i))
             return_code += 1

     return return_code
--- a/common/check_device_diff/check_config_between_device.py
+++ b/common/check_device_diff/check_config_between_device.py
@@ -132,8 +132,8 @@ def get_Configuration_by_pattern(pattern, prjConfig):

 def get_projectConfiguration(prjConfig):
     """query the current platform"""
-    pattern = [re.compile("^([^=\s]+)\s*=\s*(.+)$"),
-               re.compile("^([^=\s]+)\s*=$")]
+    pattern = [re.compile(r"^([^=\s]+)\s*=\s*(.+)$"),
+               re.compile(r"^([^=\s]+)\s*=$")]
     return get_Configuration_by_pattern(pattern, prjConfig)


@@ -157,8 +157,8 @@ def get_kconfig(kconfig):
     """read all the kernel config for furture comparasion
     direct use the comparation result as error message"""

-    pattern = [re.compile("^([^=\s]+)\s*=\s*(.+)$"),
-               re.compile("^#\s(\w+) is not set")]
+    pattern = [re.compile(r"^([^=\s]+)\s*=\s*(.+)$"),
+               re.compile(r"^#\s(\w+) is not set")]

     return get_Configuration_by_pattern(pattern, kconfig)

@@ -166,7 +166,7 @@ def get_lk_config(lkConfig):
     return get_pl_config(lkConfig)

 def get_pl_config(plConfig):
-    pattern = [re.compile("^([^\#\:=\s]+)\s*\:?=\s*(.*)$")]
+    pattern = [re.compile(r"^([^\#\:=\s]+)\s*\:?=\s*(.*)$")]
     return get_Configuration_by_pattern(pattern, plConfig)

 def Usage():

vendor/mediatek/proprietary/frameworks/opt/mage

--- a/legacy/a3m/buildtools/genmemfiles.py
+++ b/legacy/a3m/buildtools/genmemfiles.py
@@ -52,6 +52,10 @@ def hexify(string):
         hex_string += '0x' + char.encode('hex') + ','
     return hex_string

+def hexify3(byte_data):
+    """Convert bytes to a hex-escaped string (e.g., b'\x01' -> '0x01,')."""
+    return ','.join(f'0x{b:02x}' for b in byte_data) + ','
+
 def generate_file(input_dir, output_dir, input_filename,
         namespace=None, force=False, verbose=False):
     """ Generates a header file defining a c-string holding the contents of the
@@ -65,7 +69,7 @@ def generate_file(input_dir, output_dir, input_filename,
     if namespace:
         identifier = '_' + namespace + '__' + identifier

-    if not re.match('^[\w\d_]+$', identifier):
+    if not re.match(r'^[\w\d_]+$', identifier, re.ASCII):
         if verbose:
             print('Error: input filename must contain only a-z, A-Z, 0-9, '
                     '_ and .')
@@ -104,37 +108,38 @@ def generate_file(input_dir, output_dir, input_filename,
     if regenerate:
         with open(output_path, 'wb') as output_file:
             # Write the file header
-            output_file.write(header);
+            output_file.write(header.encode('utf-8'));

             # Write the timestamp
-            output_file.write('// timestamp: {0}\n\n'.format(new_timestamp))
+            output_file.write('// timestamp: {0}\n\n'.format(new_timestamp).encode('utf-8'))

             # Start writing the global static data array
             output_file.write('static A3M_BYTE const {0}[] = {{'.format(
-                array_name))
+                array_name).encode('utf-8'))

             bytes_read = 0

             with open(input_path, 'rb') as input_file:
                 # Read input file into an array
-                chars = str(input_file.read(line_length))
+                while True:
+                    chunk = input_file.read(line_length)
+
                 # Read input file into an array
-                chars = str(input_file.read(line_length))
+                while True:
+                    chunk = input_file.read(line_length)
+
+                    if not chunk:
+                        break

-                # Write bytes to a c-string
-                while chars:
-                    chars_length = len(chars)
+                    chars_length = len(chunk)
                     bytes_read += chars_length
-                    hex_chars = hexify(chars)
-                    output_file.write('\n  ' + hex_chars)
-                    chars = str(input_file.read(line_length))
+                    hex_chars = hexify3(chunk)
+                    output_file.write(('\n  ' + hex_chars).encode('utf-8'))

             # Write a new line if last line is full.
             if chars_length >= line_length:
-                output_file.write('\n  ')
+                output_file.write('\n  '.encode('utf-8'))

             # Finish writing the data array
             # Add a null terminating character so that the array can be
             # read as a string.
-            output_file.write('0x00\n};\n')
+            output_file.write('0x00\n};\n'.encode('utf-8'))

         if verbose:
             print('Generated: {0} --> {1} ({2} bytes)'.format(
@@ -186,13 +191,13 @@ def generate_files(input_dir, output_dir, module_name,

     # Adding an arbitrary string to the checksum calculation forces old main
     # source files to be regenerated
-    new_checksum.update('version2')
+    new_checksum.update('version2'.encode('utf-8'))

     for input_filename in sorted(input_filenames):
         file_info = generate_file(input_dir, output_dir, input_filename,
                 namespace=namespace, force=force, verbose=verbose)
         file_infos.append(file_info)
-        new_checksum.update(file_info.array_name)
+        new_checksum.update(file_info.array_name.encode('utf-8'))

         recognised_files.append(file_info.output_filename)

preloader DvrGen.py问题多多,放弃。 

android 11

python3

vendor/autochips/proprietary/trustzone/optee/toolchains/3.8.4-ubuntu-14.04/x86_64/lib/python3.8/site-packages/Crypto
    PublicKey/RSA.py
    IO/PEM.py
    Hash/MD5.py
    Util/_raw_api.py
    Util/_raw_api.py

Ubuntu 22.04.5 LTS

android 11

bash

ln -sf bash /usr/bin/sh

python2

apt install python2

gcc-multilib

apt install gcc-multilib

lib

ln -s /usr/lib/x86_64-linux-gnu/libffi.so.8 /usr/lib/x86_64-linux-gnu/libffi.so.6
ln -s /lib/x86_64-linux-gnu/libncurses.so.6 /lib/x86_64-linux-gnu/libncurses.so.5
ln -sf /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5

 unzip zip

apt install unzip zip

build success

build completed successfully (01:46:18 (hh:mm:ss))

android 9

locale

System doesn't support either C.UTF-8 or en_US.UTF-8

locale-gen en_US.UTF-8

nano /etc/locale.gen
locale-gen

build/soong/ui/build/config.go

jdk

apt install make openjdk-8-jre-headless openjdk-8-jdk-headless

perl

apt install libswitch-perl libfile-copy-recursive-perl libxml-parser-perl libxml-libxml-perl libxml-simple-perl
apt install m4

flex-2.5.39

flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.

cd prebuilts/misc/linux-x86/flex
mkdir src
tar xzvf flex-2.5.39.tar.gz -C src
cd src/flex-2.5.39
./configure && make
cp -ar flex ../../flex-2.5.39

yylloc kernel-4.9

/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here

--- a/scripts/dtc/dtc-lexer.lex.c_shipped
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
@@ -637,7 +637,7 @@ char *yytext;
 #include "srcpos.h"
 #include "dtc-parser.tab.h"

-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
 extern bool treesource_error;

 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */

config.h TRUSTY

trusty/external/lk

out/target/product/ac8257_demo_1g_32/obj/TRUSTY_OBJ/build-ac8257_demo_1g_32/config.h:91:25: error: missing terminating '"' character [-Werror,-Winvalid-pp-token]
#define GLOBAL_INCLUDES "_I_OPT_WORK_AC8257_OUT_TARGET_PRODUCT_AC8257_DEMO_1G_32_OBJ_TRUSTY_OBJ_BUILD_AC8257_DEMO_1G_32

生成config.h配置文件不正确,各种怀疑sed 4.4 vs 4.8,make 4.1 vs 4.3,bash 4.4.20 vs 5.1.16,折腾了很久,最后发现是macros.mk文件中的SPACE定义导致的问题。

--- a/make/macros.mk
+++ b/make/macros.mk
@@ -11,8 +11,8 @@ TOBUILDDIR = $(addprefix $(BUILDDIR)/,$(1))
 TOBOOL = $(if $(filter-out 0 false,$1),true,false)

 COMMA := ,
-SPACE :=
-SPACE +=
+EMPTY :=
+SPACE := $(EMPTY) $(EMPTY)

 # test if two files are different, replacing the first
 # with the second if so

Unable to initialize runtime

FAILED: out/target/product/ac8257_demo_1g_32/dex_bootjars/system/framework/arm/boot.art
patchoatd E 07-23 08:52:01 464896 464896 image_space.cc:1761] Could not create image space with image file 'out/target/product/ac8257_demo_1g_32/dex_bootjars/system/framework/boot.art'. Attempting to fall back to imageless running. Error was: Failed to mmap at expected address, mapped at 0x7c3995200000 instead of 0x704a8000
patchoatd E 07-23 08:52:01 464896 464896 image_space.cc:1761] Attempted image: out/target/product/ac8257_demo_1g_32/dex_bootjars/system/framework/boot-framework.art
patchoatd E 07-23 08:52:01 464896 464896 runtime.cc:1290] Dex file fallback disabled, cannot continue without image.
patchoatd E 07-23 08:52:01 464896 464896 patchoat.cc:485] Unable to initialize runtime

ubuntu20.04编译Android8编译报错dex2oatd-CSDN博客

--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -504,6 +504,11 @@ MemMap* MemMap::MapFileAtAddress(uint8_t* expected_ptr,
     DCHECK(ContainedWithinExistingMap(expected_ptr, byte_count, error_msg))
         << ((error_msg != nullptr) ? *error_msg : std::string());
     flags |= MAP_FIXED;
+#if !defined(ART_TARGET)
+  } else if (expected_ptr) {
+    #define MAP_FIXED_NOREPLACE 0x100000
+    flags |= MAP_FIXED_NOREPLACE;
+#endif
   } else {
     CHECK_EQ(0, flags & MAP_FIXED);
     // Don't bother checking for an overlapping region here. We'll

build success 

build completed successfully (40:21 (mm:ss))


网站公告

今日签到

点亮在社区的每一天
去签到